/** * Deployment System * * The problem: you have 8 services and 3 machines. You need to * decide what runs where, generate the right configs for each * machine, ensure discovery works, handle rolling deploys, and * do it all without the developer manually editing addresses. * * From a manifest, `forge deploy` generates: * * 1. Per-node forge.config.js files * 2. Docker Compose for local dev * 3. Systemd unit files for production * 4. HTTP-based inter-service communication configs * 5. Deployment scripts (rsync + restart) */ import { type RegistryMode as RegistryModeValue, type ServiceType as ServiceTypeValue } from "../core/config-enums.js"; interface ServiceEndpoint { host: string; port: number; remote?: boolean; } interface ResourceLimits { cpus?: string; memory?: string; } interface ManifestNode { host: string; services: string[]; role?: string; endpoints?: Record; resources?: ResourceLimits; } interface ForgeProxyConfig { enabled?: boolean; host?: string; port?: number; keepalive?: number; } interface SslConfig { cert: string; key: string; } interface WebSocketConfig { enabled?: boolean; paths?: string[]; } interface RoutingConfig { strategy?: string; } interface ServiceConfig { entry?: string; type?: ServiceTypeValue; port?: number; threads?: number | string; weight?: number; connects?: string[]; group?: string; websocket?: boolean | string[] | WebSocketConfig; routing?: RoutingConfig; prefix?: string | null; } interface ServiceNodeMapping { node: string; host: string; } interface RawManifest { cluster?: string; nodes: Record; overrides?: Record>>; registry?: RegistryModeValue; httpBasePort?: number; metricsPort?: number; region?: string; domain?: string; ssl?: SslConfig; rateLimits?: Record; staticDir?: string; forgeProxy?: boolean | ForgeProxyConfig | null; websockets?: boolean; websocketPaths?: string[]; maxBodySize?: number; } interface ValidatedManifest extends RawManifest { serviceToNode: Record; allServices: string[]; } interface FrontendSiteConfig { plugin?: string; basePath?: string; outDir?: string; spaFallback?: boolean; } interface AppConfig { domains?: string[]; domain?: string; services?: string[]; ssl?: SslConfig | null; static?: string | null; frontend?: FrontendSiteConfig; } interface SiteEntry { domains?: string[]; frontend?: FrontendSiteConfig; staticDir?: string; } interface HostMetaEntry { domain?: string; services: string[]; } interface PlatformConfig { apps?: Record; globalAuth?: boolean; ssl?: SslConfig | null; maxBodySize?: number; forgeProxy?: boolean | ForgeProxyConfig | null; } interface FrontendManifestSite { siteId?: string; outDir?: string; } interface FrontendManifest { sites?: FrontendManifestSite[]; mounts?: Record; } interface StaticMountEntry { siteId?: string; domains?: string[]; basePath?: string; dir: string; spaFallback?: boolean; cachePolicy?: "immutable" | "none" | "short"; } interface PlatformAllOptions { sites?: Record; frontendManifest?: FrontendManifest; } interface GenerateAllResult { nodes: string[]; files: string[]; } interface SystemdEnvFileResult { path: string; content: string; } interface PlatformAllResult { files: string[]; } export interface SecretsCheckResult { ok: boolean; missing: string[]; warnings: string[]; } /** * Validate that required secrets are set in the environment. * Returns a result object with missing and warning lists. */ export declare function checkSecrets(env?: Record): SecretsCheckResult; /** * Load and validate a deployment manifest. */ export declare function loadManifest(manifest: RawManifest, serviceConfigs: Record): ValidatedManifest; /** * Generate per-node forge.config.js files. * * Each node gets a config where: * - Services it runs are defined with their full config (entry, type, etc.) * - Services on OTHER nodes are defined as type: 'remote' with HTTP addresses */ export declare function generateNodeConfigs(manifest: ValidatedManifest, serviceConfigs: Record, _options?: Record): Map; /** * Generate Docker Compose for local development that simulates * the multi-machine topology. */ export declare function generateDockerCompose(manifest: ValidatedManifest, serviceConfigs: Record): string; /** * Generate a systemd service unit file for a node. */ export declare function generateSystemdUnit(nodeName: string, node: ManifestNode, manifest: ValidatedManifest): string; /** * Generate the environment file content for a systemd unit. * Write this to /etc/threadforge/.env */ export declare function generateSystemdEnvFile(nodeName: string, node: ManifestNode): SystemdEnvFileResult; /** * Generate a deployment script that syncs code and restarts services. */ export declare function generateDeployScript(manifest: ValidatedManifest): string; /** * Generate a Dockerfile for the deployment. */ export declare function generateDockerfile(manifest: RawManifest, serviceConfigs: Record): string; /** * Generate a .dockerignore file. */ export declare function generateDockerignore(): string; /** * Generate all deployment artifacts from a manifest. */ export declare function generateAll(manifest: RawManifest, serviceConfigs: Record, outputDir: string): GenerateAllResult; /** * Generate all platform deployment artifacts. */ export declare function generatePlatformAll(platformConfig: PlatformConfig, services: Record, hostMeta: Record, outputDir: string, options?: PlatformAllOptions): PlatformAllResult; export {}; //# sourceMappingURL=index.d.ts.map