foundation-forgejo (forgejo:11, digest-pinned) on foundation-net: git repos on the foundation-forgejo-data volume (the irreducible state), metadata in external Postgres, blobs in RustFS (default storage + LFS over the minio API). Config is seeded via FORGEJO__section__KEY env -> app.ini; INSTALL_LOCK skips the web installer and the crypto secrets (SECRET_KEY/INTERNAL_TOKEN/JWT) auto-generate and persist in the volume. HTTP 3000 is internal (Caddy fronts forge.olsitec.net); the image's openssh sshd owns container :22 (START_SSH_SERVER=false — explicitly, so a stale app.ini value can't keep Forgejo's built-in Go SSH server colliding on :22), published on host :22 (scp-form goal) and :2222 (CONTRACT_003). A healthz-gated ready command is GATE B for T09/T10. Live on cx33 Helsinki: container healthy, https://forge.olsitec.net = 200 over a valid Let's Encrypt cert, API 11.0.15, sshd reachable on :22 and :2222. Acceptance T08 met. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
81 lines
3.7 KiB
TypeScript
81 lines
3.7 KiB
TypeScript
// index.ts — foundation bootstrap entrypoint (the egg, PLAN-002 §0, Layer 0).
|
|
//
|
|
// Phase orchestration (PLAN-002 §2, §5). Components are created against the shared
|
|
// provider + foundation-net (ADR-006); GATES between phases are Pulumi dependsOn
|
|
// edges, NOT imperative sequencing, so `pulumi up` derives the order. Wave-2+ tasks
|
|
// fill the marked slots — this file is the single composition point; components stay
|
|
// pure factories in components/*.
|
|
import { loadConfig } from "./config";
|
|
import { buildBaseContext, DeployCtx } from "./lib/context";
|
|
import { deployNetwork } from "./components/network";
|
|
import { deployDns } from "./components/dns";
|
|
import {
|
|
generateCredentials,
|
|
writeCredentialsToVault,
|
|
} from "./components/credentials";
|
|
import { deployPostgres } from "./components/postgres";
|
|
import { deployRustfs } from "./components/rustfs";
|
|
import { deployVault } from "./components/vault";
|
|
import { deployProxy } from "./components/proxy";
|
|
import { deployForgejo } from "./components/forgejo";
|
|
|
|
const cfg = loadConfig();
|
|
|
|
// --- shared substrate: provider + network (always first) ---
|
|
const base = buildBaseContext(cfg);
|
|
const network = deployNetwork(base);
|
|
const ctx: DeployCtx = { ...base, network };
|
|
|
|
// --- public DNS records → the VM (independent of the container plane) ---
|
|
const dnsRecords = deployDns(ctx);
|
|
export const dnsHosts = dnsRecords.map((r) => r.name);
|
|
|
|
// --- credentials: generation is pure (no deps); Vault distribution is T06 ---
|
|
const credentials = generateCredentials(ctx);
|
|
|
|
// =============================================================================
|
|
// PHASE 3 — DATA PLANE (depends on: network)
|
|
// T03 postgres ✓ · T04 rustfs ✓ · T05 vault ✓
|
|
// -----------------------------------------------------------------------------
|
|
const postgres = deployPostgres(ctx, credentials.postgres);
|
|
const rustfs = deployRustfs(ctx, credentials.rustfs);
|
|
const vault = deployVault(ctx);
|
|
|
|
// --- GATE A: Vault init + unseal (T05). T06 writes the generated data-plane creds
|
|
// into Vault (CONTRACT_002), dependsOn vault.init so it runs only once unsealed.
|
|
const vaultCreds = writeCredentialsToVault(ctx, credentials, vault);
|
|
// =============================================================================
|
|
// PHASE 6 — FORGE (depends on: credentials, GATE A)
|
|
// T07 caddy ✓ · T08 forgejo · T10 runner
|
|
// -----------------------------------------------------------------------------
|
|
const proxy = deployProxy(ctx);
|
|
const forgejo = deployForgejo(ctx, {
|
|
postgres,
|
|
rustfs,
|
|
pgCreds: credentials.postgres,
|
|
rustfsCreds: credentials.rustfs,
|
|
});
|
|
// --- GATE B: Forgejo healthy → handover (T11) + runner registration (T10).
|
|
// const runner = deployRunner(ctx, { forgejo, credentials });
|
|
// =============================================================================
|
|
|
|
// Stack outputs (extended as phases land).
|
|
// vaultCreds (T06) is a gate for Forgejo (T08) — it has no output to export yet.
|
|
void vaultCreds;
|
|
|
|
export const phase = "T08-forgejo"; // forge live (postgres + rustfs + caddy + ssh)
|
|
export const caddyImageId = proxy.imageId;
|
|
export const forgejoEndpoint = forgejo.endpoint;
|
|
void forgejo.ready; // GATE B for T09/T10
|
|
export const networkName = network.name;
|
|
export const vmTarget = `${cfg.vm.user}@${cfg.vm.host}`;
|
|
export const postgresEndpoint = postgres.endpoint;
|
|
export const rustfsEndpoint = rustfs.endpoint;
|
|
export const vaultEndpoint = vault.endpoint;
|
|
// Captured by run.sh into vaultCredentials:* (passphrase-encrypted config) after
|
|
// `up` — the one bootstrap secret that cannot live in Vault (CONTRACT_002 §2.4).
|
|
export const vaultUnsealKeys = vault.unsealKeys;
|
|
export const vaultRootToken = vault.rootToken;
|
|
export const enabledFeatures = Object.entries(cfg.features)
|
|
.filter(([, on]) => on)
|
|
.map(([name]) => name);
|