feat: add individual and bulk chart upgrade, fix health check URL
All checks were successful
Build & Release / build (push) Successful in 12s

This commit is contained in:
Ryan Moon
2026-04-03 21:26:35 -05:00
parent 766ad63278
commit 31684f4a15
4 changed files with 84 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ export async function getCustomerDnsRecord(slug: string): Promise<{ exists: bool
export async function checkCustomerHealth(slug: string): Promise<{ reachable: boolean; status: number | null }> {
try {
const res = await fetch(`https://${slug}.lunarfront.tech/api/health`, {
const res = await fetch(`https://${slug}.lunarfront.tech/v1/health`, {
signal: AbortSignal.timeout(5000),
});
return { reachable: res.ok, status: res.status };

View File

@@ -4,7 +4,7 @@ import { tmpdir } from "os";
import { join } from "path";
import { config } from "../lib/config";
async function getLatestChartVersion(): Promise<string> {
export async function getLatestChartVersion(): Promise<string> {
const res = await fetch("https://api.digitalocean.com/v2/registry/lunarfront/repositories/lunarfront/tags?page=1&per_page=100", {
headers: { Authorization: `Bearer ${config.doToken}` },
});
@@ -57,6 +57,26 @@ export async function addCustomerChart(slug: string, appVersion: string) {
});
}
export async function upgradeCustomerChart(slug: string, version: string) {
withRepo((dir, env) => {
const manifest = buildArgoCDApp(slug, version);
writeFileSync(join(dir, "customers", `${slug}.yaml`), manifest);
execSync(`git -C ${dir} add customers/${slug}.yaml`, { env });
execSync(`git -C ${dir} commit -m "chore: upgrade customer ${slug} to chart ${version}"`, { env });
});
}
export async function upgradeAllCustomerCharts(slugs: string[], version: string) {
withRepo((dir, env) => {
for (const slug of slugs) {
const manifest = buildArgoCDApp(slug, version);
writeFileSync(join(dir, "customers", `${slug}.yaml`), manifest);
execSync(`git -C ${dir} add customers/${slug}.yaml`, { env });
}
execSync(`git -C ${dir} commit -m "chore: upgrade all customers to chart ${version}"`, { env });
});
}
export function removeCustomerChart(slug: string) {
withRepo((dir, env) => {
const filePath = join(dir, "customers", `${slug}.yaml`);