Build failure fix
CI / ci (push) Canceled after 0s

This commit is contained in:
Stefan Lazic committed 2026-09-04 21:22:33 +01:00
1 parent b219fb4519
commit 7f774e95bb
3 files changed
+19 -10

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ const EXTENSION_MIME_TYPES: Record<string, string> = {
export const MEDIA_MAX_UPLOAD_BYTES = Number(process.env.MEDIA_MAX_UPLOAD_BYTES ?? 5_000_000);
/** Overridable so a non-Docker deployment can point this somewhere else; defaults to a directory next to the app, outside public/. */
const MEDIA_ROOT = path.resolve(process.env.MEDIA_STORAGE_ROOT || path.join(process.cwd(), "storage", "media"));
const MEDIA_ROOT = path.resolve(process.env.MEDIA_STORAGE_ROOT || path.join(/* turbopackIgnore: true */ process.cwd(), "storage", "media"));
export const MEDIA_URL_PREFIX = "/api/media/";
@@ -15,6 +15,10 @@ function containerName(slug: string) {
return `nextchair-${slug}`;
}
function healthState(value: string | undefined): BusinessStatus["health"] {
return value === "healthy" || value === "unhealthy" || value === "starting" ? value : "unknown";
}
async function readRegistry(): Promise<BusinessDeployment[]> {
try {
return JSON.parse(await fs.readFile(registryPath(), "utf8")) as BusinessDeployment[];
@@ -36,7 +40,7 @@ async function inspectContainer(slug: string) {
try {
const result = await docker(["inspect", "-f", "{{.State.Status}}|{{if .State.Health}}{{.State.Health.Status}}{{end}}", containerName(slug)]);
const [container, health] = result.stdout.trim().split("|");
return { container: container === "running" ? "running" : container ? "stopped" : "unknown", health: health || "unknown" } as const;
return { container: container === "running" ? "running" : container ? "stopped" : "unknown", health: healthState(health) } as const;
} catch {
return { container: "unknown", health: "unknown" } as const;
}
@@ -54,8 +58,13 @@ async function databaseStatus() {
async function storageBytes(slug: string) {
try {
const volume = await docker(["volume", "inspect", "-f", "{{.Mountpoint}}", `nextchair-media-${slug}`]);
const usage = await run("du", ["-sk", volume.stdout.trim()], { maxBuffer: 1024 * 64 });
return Number.parseInt(usage.stdout.trim().split(/\s+/)[0], 10) * 1024;
const mountpoint = volume.stdout.trim();
if (!mountpoint) return null;
const usage = await run("du", ["-sk", mountpoint], { maxBuffer: 1024 * 64 });
const kilobytes = usage.stdout.trim().split(/\s+/)[0];
if (!kilobytes) return null;
const bytes = Number.parseInt(kilobytes, 10) * 1024;
return Number.isFinite(bytes) ? bytes : null;
} catch {
return null;
}