@marinoscar/platform-cli 0.1.0-next.3 → 0.1.0-next.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +358 -0
- package/README.md +163 -31
- package/dist/android/build.d.ts +30 -0
- package/dist/android/build.d.ts.map +1 -0
- package/dist/android/build.js +126 -0
- package/dist/android/build.js.map +1 -0
- package/dist/android/command.d.ts +21 -0
- package/dist/android/command.d.ts.map +1 -0
- package/dist/android/command.js +355 -0
- package/dist/android/command.js.map +1 -0
- package/dist/android/deploy-step.d.ts +85 -0
- package/dist/android/deploy-step.d.ts.map +1 -0
- package/dist/android/deploy-step.js +268 -0
- package/dist/android/deploy-step.js.map +1 -0
- package/dist/android/doctor.d.ts +47 -0
- package/dist/android/doctor.d.ts.map +1 -0
- package/dist/android/doctor.js +219 -0
- package/dist/android/doctor.js.map +1 -0
- package/dist/android/exec.d.ts +42 -0
- package/dist/android/exec.d.ts.map +1 -0
- package/dist/android/exec.js +103 -0
- package/dist/android/exec.js.map +1 -0
- package/dist/android/fix-plan.d.ts +44 -0
- package/dist/android/fix-plan.d.ts.map +1 -0
- package/dist/android/fix-plan.js +86 -0
- package/dist/android/fix-plan.js.map +1 -0
- package/dist/android/git-freshness.d.ts +34 -0
- package/dist/android/git-freshness.d.ts.map +1 -0
- package/dist/android/git-freshness.js +120 -0
- package/dist/android/git-freshness.js.map +1 -0
- package/dist/android/gradle.d.ts +32 -0
- package/dist/android/gradle.d.ts.map +1 -0
- package/dist/android/gradle.js +55 -0
- package/dist/android/gradle.js.map +1 -0
- package/dist/android/identity.d.ts +27 -0
- package/dist/android/identity.d.ts.map +1 -0
- package/dist/android/identity.js +60 -0
- package/dist/android/identity.js.map +1 -0
- package/dist/android/index.d.ts +7 -0
- package/dist/android/index.d.ts.map +1 -0
- package/dist/android/index.js +8 -0
- package/dist/android/index.js.map +1 -0
- package/dist/android/installer.d.ts +28 -0
- package/dist/android/installer.d.ts.map +1 -0
- package/dist/android/installer.js +96 -0
- package/dist/android/installer.js.map +1 -0
- package/dist/android/java.d.ts +26 -0
- package/dist/android/java.d.ts.map +1 -0
- package/dist/android/java.js +65 -0
- package/dist/android/java.js.map +1 -0
- package/dist/android/keystore.d.ts +54 -0
- package/dist/android/keystore.d.ts.map +1 -0
- package/dist/android/keystore.js +159 -0
- package/dist/android/keystore.js.map +1 -0
- package/dist/android/metadata.d.ts +39 -0
- package/dist/android/metadata.d.ts.map +1 -0
- package/dist/android/metadata.js +61 -0
- package/dist/android/metadata.js.map +1 -0
- package/dist/android/operations.d.ts +42 -0
- package/dist/android/operations.d.ts.map +1 -0
- package/dist/android/operations.js +59 -0
- package/dist/android/operations.js.map +1 -0
- package/dist/android/paths.d.ts +29 -0
- package/dist/android/paths.d.ts.map +1 -0
- package/dist/android/paths.js +97 -0
- package/dist/android/paths.js.map +1 -0
- package/dist/android/publish.d.ts +37 -0
- package/dist/android/publish.d.ts.map +1 -0
- package/dist/android/publish.js +119 -0
- package/dist/android/publish.js.map +1 -0
- package/dist/android/registrations.d.ts +92 -0
- package/dist/android/registrations.d.ts.map +1 -0
- package/dist/android/registrations.js +112 -0
- package/dist/android/registrations.js.map +1 -0
- package/dist/android/release-status.d.ts +73 -0
- package/dist/android/release-status.d.ts.map +1 -0
- package/dist/android/release-status.js +161 -0
- package/dist/android/release-status.js.map +1 -0
- package/dist/android/release.d.ts +33 -0
- package/dist/android/release.d.ts.map +1 -0
- package/dist/android/release.js +59 -0
- package/dist/android/release.js.map +1 -0
- package/dist/android/screen-layout.d.ts +26 -0
- package/dist/android/screen-layout.d.ts.map +1 -0
- package/dist/android/screen-layout.js +24 -0
- package/dist/android/screen-layout.js.map +1 -0
- package/dist/android/screen-model.d.ts +56 -0
- package/dist/android/screen-model.d.ts.map +1 -0
- package/dist/android/screen-model.js +207 -0
- package/dist/android/screen-model.js.map +1 -0
- package/dist/android/screen.d.ts +8 -0
- package/dist/android/screen.d.ts.map +1 -0
- package/dist/android/screen.js +395 -0
- package/dist/android/screen.js.map +1 -0
- package/dist/android/sdk.d.ts +48 -0
- package/dist/android/sdk.d.ts.map +1 -0
- package/dist/android/sdk.js +82 -0
- package/dist/android/sdk.js.map +1 -0
- package/dist/android/server-url.d.ts +19 -0
- package/dist/android/server-url.d.ts.map +1 -0
- package/dist/android/server-url.js +36 -0
- package/dist/android/server-url.js.map +1 -0
- package/dist/android/upload-progress.d.ts +3 -0
- package/dist/android/upload-progress.d.ts.map +1 -0
- package/dist/android/upload-progress.js +47 -0
- package/dist/android/upload-progress.js.map +1 -0
- package/dist/android/version.d.ts +47 -0
- package/dist/android/version.d.ts.map +1 -0
- package/dist/android/version.js +136 -0
- package/dist/android/version.js.map +1 -0
- package/dist/api-client/index.d.ts +3 -0
- package/dist/api-client/index.d.ts.map +1 -0
- package/dist/api-client/index.js +5 -0
- package/dist/api-client/index.js.map +1 -0
- package/dist/commands/index.d.ts +52 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +63 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/core/cli-registry.d.ts +41 -0
- package/dist/core/cli-registry.d.ts.map +1 -0
- package/dist/core/cli-registry.js +49 -0
- package/dist/core/cli-registry.js.map +1 -0
- package/dist/core/command-registry.d.ts +10 -0
- package/dist/core/command-registry.d.ts.map +1 -1
- package/dist/core/command-registry.js +17 -0
- package/dist/core/command-registry.js.map +1 -1
- package/dist/core/env-annotation-registry.d.ts +58 -0
- package/dist/core/env-annotation-registry.d.ts.map +1 -0
- package/dist/core/env-annotation-registry.js +80 -0
- package/dist/core/env-annotation-registry.js.map +1 -0
- package/dist/core/env-generator-registry.d.ts +59 -0
- package/dist/core/env-generator-registry.d.ts.map +1 -0
- package/dist/core/env-generator-registry.js +102 -0
- package/dist/core/env-generator-registry.js.map +1 -0
- package/dist/core/env-group-registry.d.ts +65 -0
- package/dist/core/env-group-registry.d.ts.map +1 -0
- package/dist/core/env-group-registry.js +77 -0
- package/dist/core/env-group-registry.js.map +1 -0
- package/dist/core/env-spec-registry.d.ts +16 -2
- package/dist/core/env-spec-registry.d.ts.map +1 -1
- package/dist/core/env-spec-registry.js +15 -0
- package/dist/core/env-spec-registry.js.map +1 -1
- package/dist/core/env-values.d.ts +3 -2
- package/dist/core/env-values.d.ts.map +1 -1
- package/dist/core/env-values.js +5 -3
- package/dist/core/env-values.js.map +1 -1
- package/dist/core/index.d.ts +10 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- package/dist/deploy/index.d.ts +3 -0
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +5 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/engine/api-client.d.ts +211 -0
- package/dist/engine/api-client.d.ts.map +1 -0
- package/dist/engine/api-client.js +350 -0
- package/dist/engine/api-client.js.map +1 -0
- package/dist/engine/browser.d.ts +18 -0
- package/dist/engine/browser.d.ts.map +1 -0
- package/dist/engine/browser.js +115 -0
- package/dist/engine/browser.js.map +1 -0
- package/dist/engine/builtin-registrations.d.ts +20 -0
- package/dist/engine/builtin-registrations.d.ts.map +1 -0
- package/dist/engine/builtin-registrations.js +86 -0
- package/dist/engine/builtin-registrations.js.map +1 -0
- package/dist/engine/commands/api.d.ts +88 -0
- package/dist/engine/commands/api.d.ts.map +1 -0
- package/dist/engine/commands/api.js +398 -0
- package/dist/engine/commands/api.js.map +1 -0
- package/dist/engine/commands/config.d.ts +5 -0
- package/dist/engine/commands/config.d.ts.map +1 -0
- package/dist/engine/commands/config.js +83 -0
- package/dist/engine/commands/config.js.map +1 -0
- package/dist/engine/commands/deploy.d.ts +250 -0
- package/dist/engine/commands/deploy.d.ts.map +1 -0
- package/dist/engine/commands/deploy.js +1186 -0
- package/dist/engine/commands/deploy.js.map +1 -0
- package/dist/engine/commands/init.d.ts +18 -0
- package/dist/engine/commands/init.d.ts.map +1 -0
- package/dist/engine/commands/init.js +50 -0
- package/dist/engine/commands/init.js.map +1 -0
- package/dist/engine/commands/login.d.ts +4 -0
- package/dist/engine/commands/login.d.ts.map +1 -0
- package/dist/engine/commands/login.js +205 -0
- package/dist/engine/commands/login.js.map +1 -0
- package/dist/engine/commands/node.d.ts +21 -0
- package/dist/engine/commands/node.d.ts.map +1 -0
- package/dist/engine/commands/node.js +503 -0
- package/dist/engine/commands/node.js.map +1 -0
- package/dist/engine/config.d.ts +284 -0
- package/dist/engine/config.d.ts.map +1 -0
- package/dist/engine/config.js +469 -0
- package/dist/engine/config.js.map +1 -0
- package/dist/engine/conformance.d.ts +193 -0
- package/dist/engine/conformance.d.ts.map +1 -0
- package/dist/engine/conformance.js +243 -0
- package/dist/engine/conformance.js.map +1 -0
- package/dist/engine/create-cli.d.ts +181 -0
- package/dist/engine/create-cli.d.ts.map +1 -0
- package/dist/engine/create-cli.js +91 -0
- package/dist/engine/create-cli.js.map +1 -0
- package/dist/engine/deploy/about.d.ts +12 -0
- package/dist/engine/deploy/about.d.ts.map +1 -0
- package/dist/engine/deploy/about.js +110 -0
- package/dist/engine/deploy/about.js.map +1 -0
- package/dist/engine/deploy/adopt.d.ts +21 -0
- package/dist/engine/deploy/adopt.d.ts.map +1 -0
- package/dist/engine/deploy/adopt.js +78 -0
- package/dist/engine/deploy/adopt.js.map +1 -0
- package/dist/engine/deploy/answers-file.d.ts +7 -0
- package/dist/engine/deploy/answers-file.d.ts.map +1 -0
- package/dist/engine/deploy/answers-file.js +49 -0
- package/dist/engine/deploy/answers-file.js.map +1 -0
- package/dist/engine/deploy/app-role.d.ts +278 -0
- package/dist/engine/deploy/app-role.d.ts.map +1 -0
- package/dist/engine/deploy/app-role.js +826 -0
- package/dist/engine/deploy/app-role.js.map +1 -0
- package/dist/engine/deploy/app-version.d.ts +103 -0
- package/dist/engine/deploy/app-version.d.ts.map +1 -0
- package/dist/engine/deploy/app-version.js +344 -0
- package/dist/engine/deploy/app-version.js.map +1 -0
- package/dist/engine/deploy/checks/compose.d.ts +16 -0
- package/dist/engine/deploy/checks/compose.d.ts.map +1 -0
- package/dist/engine/deploy/checks/compose.js +149 -0
- package/dist/engine/deploy/checks/compose.js.map +1 -0
- package/dist/engine/deploy/checks/database.d.ts +83 -0
- package/dist/engine/deploy/checks/database.d.ts.map +1 -0
- package/dist/engine/deploy/checks/database.js +455 -0
- package/dist/engine/deploy/checks/database.js.map +1 -0
- package/dist/engine/deploy/checks/dns.d.ts +3 -0
- package/dist/engine/deploy/checks/dns.d.ts.map +1 -0
- package/dist/engine/deploy/checks/dns.js +85 -0
- package/dist/engine/deploy/checks/dns.js.map +1 -0
- package/dist/engine/deploy/checks/host.d.ts +19 -0
- package/dist/engine/deploy/checks/host.d.ts.map +1 -0
- package/dist/engine/deploy/checks/host.js +543 -0
- package/dist/engine/deploy/checks/host.js.map +1 -0
- package/dist/engine/deploy/checks/index.d.ts +35 -0
- package/dist/engine/deploy/checks/index.d.ts.map +1 -0
- package/dist/engine/deploy/checks/index.js +75 -0
- package/dist/engine/deploy/checks/index.js.map +1 -0
- package/dist/engine/deploy/checks/registry.d.ts +110 -0
- package/dist/engine/deploy/checks/registry.d.ts.map +1 -0
- package/dist/engine/deploy/checks/registry.js +104 -0
- package/dist/engine/deploy/checks/registry.js.map +1 -0
- package/dist/engine/deploy/checks/source.d.ts +45 -0
- package/dist/engine/deploy/checks/source.d.ts.map +1 -0
- package/dist/engine/deploy/checks/source.js +175 -0
- package/dist/engine/deploy/checks/source.js.map +1 -0
- package/dist/engine/deploy/checks/stack-ports.d.ts +4 -0
- package/dist/engine/deploy/checks/stack-ports.d.ts.map +1 -0
- package/dist/engine/deploy/checks/stack-ports.js +261 -0
- package/dist/engine/deploy/checks/stack-ports.js.map +1 -0
- package/dist/engine/deploy/checks/tls.d.ts +87 -0
- package/dist/engine/deploy/checks/tls.d.ts.map +1 -0
- package/dist/engine/deploy/checks/tls.js +552 -0
- package/dist/engine/deploy/checks/tls.js.map +1 -0
- package/dist/engine/deploy/checks/types.d.ts +202 -0
- package/dist/engine/deploy/checks/types.d.ts.map +1 -0
- package/dist/engine/deploy/checks/types.js +199 -0
- package/dist/engine/deploy/checks/types.js.map +1 -0
- package/dist/engine/deploy/compose-command.d.ts +16 -0
- package/dist/engine/deploy/compose-command.d.ts.map +1 -0
- package/dist/engine/deploy/compose-command.js +40 -0
- package/dist/engine/deploy/compose-command.js.map +1 -0
- package/dist/engine/deploy/compose-containers.d.ts +101 -0
- package/dist/engine/deploy/compose-containers.d.ts.map +1 -0
- package/dist/engine/deploy/compose-containers.js +191 -0
- package/dist/engine/deploy/compose-containers.js.map +1 -0
- package/dist/engine/deploy/compose-files.d.ts +29 -0
- package/dist/engine/deploy/compose-files.d.ts.map +1 -0
- package/dist/engine/deploy/compose-files.js +118 -0
- package/dist/engine/deploy/compose-files.js.map +1 -0
- package/dist/engine/deploy/compose-hints.d.ts +11 -0
- package/dist/engine/deploy/compose-hints.d.ts.map +1 -0
- package/dist/engine/deploy/compose-hints.js +70 -0
- package/dist/engine/deploy/compose-hints.js.map +1 -0
- package/dist/engine/deploy/compose-port-variables.d.ts +58 -0
- package/dist/engine/deploy/compose-port-variables.d.ts.map +1 -0
- package/dist/engine/deploy/compose-port-variables.js +184 -0
- package/dist/engine/deploy/compose-port-variables.js.map +1 -0
- package/dist/engine/deploy/compose-ports.d.ts +98 -0
- package/dist/engine/deploy/compose-ports.d.ts.map +1 -0
- package/dist/engine/deploy/compose-ports.js +204 -0
- package/dist/engine/deploy/compose-ports.js.map +1 -0
- package/dist/engine/deploy/compose-project.d.ts +113 -0
- package/dist/engine/deploy/compose-project.d.ts.map +1 -0
- package/dist/engine/deploy/compose-project.js +177 -0
- package/dist/engine/deploy/compose-project.js.map +1 -0
- package/dist/engine/deploy/consent.d.ts +29 -0
- package/dist/engine/deploy/consent.d.ts.map +1 -0
- package/dist/engine/deploy/consent.js +35 -0
- package/dist/engine/deploy/consent.js.map +1 -0
- package/dist/engine/deploy/database-drop.d.ts +22 -0
- package/dist/engine/deploy/database-drop.d.ts.map +1 -0
- package/dist/engine/deploy/database-drop.js +135 -0
- package/dist/engine/deploy/database-drop.js.map +1 -0
- package/dist/engine/deploy/database.d.ts +116 -0
- package/dist/engine/deploy/database.d.ts.map +1 -0
- package/dist/engine/deploy/database.js +252 -0
- package/dist/engine/deploy/database.js.map +1 -0
- package/dist/engine/deploy/deploy-info.d.ts +48 -0
- package/dist/engine/deploy/deploy-info.d.ts.map +1 -0
- package/dist/engine/deploy/deploy-info.js +163 -0
- package/dist/engine/deploy/deploy-info.js.map +1 -0
- package/dist/engine/deploy/deployment-evidence.d.ts +38 -0
- package/dist/engine/deploy/deployment-evidence.d.ts.map +1 -0
- package/dist/engine/deploy/deployment-evidence.js +92 -0
- package/dist/engine/deploy/deployment-evidence.js.map +1 -0
- package/dist/engine/deploy/edge-config.d.ts +103 -0
- package/dist/engine/deploy/edge-config.d.ts.map +1 -0
- package/dist/engine/deploy/edge-config.js +170 -0
- package/dist/engine/deploy/edge-config.js.map +1 -0
- package/dist/engine/deploy/env-absence.d.ts +61 -0
- package/dist/engine/deploy/env-absence.d.ts.map +1 -0
- package/dist/engine/deploy/env-absence.js +33 -0
- package/dist/engine/deploy/env-absence.js.map +1 -0
- package/dist/engine/deploy/env-file.d.ts +14 -0
- package/dist/engine/deploy/env-file.d.ts.map +1 -0
- package/dist/engine/deploy/env-file.js +58 -0
- package/dist/engine/deploy/env-file.js.map +1 -0
- package/dist/engine/deploy/env-fragments.d.ts +29 -0
- package/dist/engine/deploy/env-fragments.d.ts.map +1 -0
- package/dist/engine/deploy/env-fragments.js +73 -0
- package/dist/engine/deploy/env-fragments.js.map +1 -0
- package/dist/engine/deploy/env-metadata.d.ts +73 -0
- package/dist/engine/deploy/env-metadata.d.ts.map +1 -0
- package/dist/engine/deploy/env-metadata.js +227 -0
- package/dist/engine/deploy/env-metadata.js.map +1 -0
- package/dist/engine/deploy/env-spec.d.ts +75 -0
- package/dist/engine/deploy/env-spec.d.ts.map +1 -0
- package/dist/engine/deploy/env-spec.js +239 -0
- package/dist/engine/deploy/env-spec.js.map +1 -0
- package/dist/engine/deploy/env-wizard.d.ts +56 -0
- package/dist/engine/deploy/env-wizard.d.ts.map +1 -0
- package/dist/engine/deploy/env-wizard.js +235 -0
- package/dist/engine/deploy/env-wizard.js.map +1 -0
- package/dist/engine/deploy/executor.d.ts +81 -0
- package/dist/engine/deploy/executor.d.ts.map +1 -0
- package/dist/engine/deploy/executor.js +247 -0
- package/dist/engine/deploy/executor.js.map +1 -0
- package/dist/engine/deploy/free-ports.d.ts +145 -0
- package/dist/engine/deploy/free-ports.d.ts.map +1 -0
- package/dist/engine/deploy/free-ports.js +235 -0
- package/dist/engine/deploy/free-ports.js.map +1 -0
- package/dist/engine/deploy/health.d.ts +153 -0
- package/dist/engine/deploy/health.d.ts.map +1 -0
- package/dist/engine/deploy/health.js +335 -0
- package/dist/engine/deploy/health.js.map +1 -0
- package/dist/engine/deploy/hooks.d.ts +66 -0
- package/dist/engine/deploy/hooks.d.ts.map +1 -0
- package/dist/engine/deploy/hooks.js +19 -0
- package/dist/engine/deploy/hooks.js.map +1 -0
- package/dist/engine/deploy/host-facts.d.ts +23 -0
- package/dist/engine/deploy/host-facts.d.ts.map +1 -0
- package/dist/engine/deploy/host-facts.js +67 -0
- package/dist/engine/deploy/host-facts.js.map +1 -0
- package/dist/engine/deploy/install.d.ts +239 -0
- package/dist/engine/deploy/install.d.ts.map +1 -0
- package/dist/engine/deploy/install.js +1474 -0
- package/dist/engine/deploy/install.js.map +1 -0
- package/dist/engine/deploy/inventory.d.ts +30 -0
- package/dist/engine/deploy/inventory.d.ts.map +1 -0
- package/dist/engine/deploy/inventory.js +122 -0
- package/dist/engine/deploy/inventory.js.map +1 -0
- package/dist/engine/deploy/journal.d.ts +77 -0
- package/dist/engine/deploy/journal.d.ts.map +1 -0
- package/dist/engine/deploy/journal.js +221 -0
- package/dist/engine/deploy/journal.js.map +1 -0
- package/dist/engine/deploy/layout.d.ts +77 -0
- package/dist/engine/deploy/layout.d.ts.map +1 -0
- package/dist/engine/deploy/layout.js +191 -0
- package/dist/engine/deploy/layout.js.map +1 -0
- package/dist/engine/deploy/oauth-check.d.ts +58 -0
- package/dist/engine/deploy/oauth-check.d.ts.map +1 -0
- package/dist/engine/deploy/oauth-check.js +213 -0
- package/dist/engine/deploy/oauth-check.js.map +1 -0
- package/dist/engine/deploy/proxy-bootstrap.d.ts +149 -0
- package/dist/engine/deploy/proxy-bootstrap.d.ts.map +1 -0
- package/dist/engine/deploy/proxy-bootstrap.js +416 -0
- package/dist/engine/deploy/proxy-bootstrap.js.map +1 -0
- package/dist/engine/deploy/proxy-streams.d.ts +110 -0
- package/dist/engine/deploy/proxy-streams.d.ts.map +1 -0
- package/dist/engine/deploy/proxy-streams.js +208 -0
- package/dist/engine/deploy/proxy-streams.js.map +1 -0
- package/dist/engine/deploy/proxy.d.ts +375 -0
- package/dist/engine/deploy/proxy.d.ts.map +1 -0
- package/dist/engine/deploy/proxy.js +758 -0
- package/dist/engine/deploy/proxy.js.map +1 -0
- package/dist/engine/deploy/renewal.d.ts +54 -0
- package/dist/engine/deploy/renewal.d.ts.map +1 -0
- package/dist/engine/deploy/renewal.js +169 -0
- package/dist/engine/deploy/renewal.js.map +1 -0
- package/dist/engine/deploy/repo.d.ts +119 -0
- package/dist/engine/deploy/repo.d.ts.map +1 -0
- package/dist/engine/deploy/repo.js +282 -0
- package/dist/engine/deploy/repo.js.map +1 -0
- package/dist/engine/deploy/run-record.d.ts +28 -0
- package/dist/engine/deploy/run-record.d.ts.map +1 -0
- package/dist/engine/deploy/run-record.js +44 -0
- package/dist/engine/deploy/run-record.js.map +1 -0
- package/dist/engine/deploy/stack-ports-gate.d.ts +19 -0
- package/dist/engine/deploy/stack-ports-gate.d.ts.map +1 -0
- package/dist/engine/deploy/stack-ports-gate.js +54 -0
- package/dist/engine/deploy/stack-ports-gate.js.map +1 -0
- package/dist/engine/deploy/state.d.ts +289 -0
- package/dist/engine/deploy/state.d.ts.map +1 -0
- package/dist/engine/deploy/state.js +163 -0
- package/dist/engine/deploy/state.js.map +1 -0
- package/dist/engine/deploy/steps/app-step-context.d.ts +24 -0
- package/dist/engine/deploy/steps/app-step-context.d.ts.map +1 -0
- package/dist/engine/deploy/steps/app-step-context.js +45 -0
- package/dist/engine/deploy/steps/app-step-context.js.map +1 -0
- package/dist/engine/deploy/steps/pipeline.d.ts +46 -0
- package/dist/engine/deploy/steps/pipeline.d.ts.map +1 -0
- package/dist/engine/deploy/steps/pipeline.js +73 -0
- package/dist/engine/deploy/steps/pipeline.js.map +1 -0
- package/dist/engine/deploy/steps/plan.d.ts +28 -0
- package/dist/engine/deploy/steps/plan.d.ts.map +1 -0
- package/dist/engine/deploy/steps/plan.js +32 -0
- package/dist/engine/deploy/steps/plan.js.map +1 -0
- package/dist/engine/deploy/steps/registry.d.ts +182 -0
- package/dist/engine/deploy/steps/registry.d.ts.map +1 -0
- package/dist/engine/deploy/steps/registry.js +214 -0
- package/dist/engine/deploy/steps/registry.js.map +1 -0
- package/dist/engine/deploy/steps/step-values.d.ts +28 -0
- package/dist/engine/deploy/steps/step-values.d.ts.map +1 -0
- package/dist/engine/deploy/steps/step-values.js +33 -0
- package/dist/engine/deploy/steps/step-values.js.map +1 -0
- package/dist/engine/deploy/testing/fake-containers.d.ts +29 -0
- package/dist/engine/deploy/testing/fake-containers.d.ts.map +1 -0
- package/dist/engine/deploy/testing/fake-containers.js +32 -0
- package/dist/engine/deploy/testing/fake-containers.js.map +1 -0
- package/dist/engine/deploy/testing/fake-postgres.d.ts +88 -0
- package/dist/engine/deploy/testing/fake-postgres.d.ts.map +1 -0
- package/dist/engine/deploy/testing/fake-postgres.js +236 -0
- package/dist/engine/deploy/testing/fake-postgres.js.map +1 -0
- package/dist/engine/deploy/testing/fake-vps.d.ts +147 -0
- package/dist/engine/deploy/testing/fake-vps.d.ts.map +1 -0
- package/dist/engine/deploy/testing/fake-vps.js +371 -0
- package/dist/engine/deploy/testing/fake-vps.js.map +1 -0
- package/dist/engine/deploy/uninstall.d.ts +87 -0
- package/dist/engine/deploy/uninstall.d.ts.map +1 -0
- package/dist/engine/deploy/uninstall.js +321 -0
- package/dist/engine/deploy/uninstall.js.map +1 -0
- package/dist/engine/deploy/update.d.ts +114 -0
- package/dist/engine/deploy/update.d.ts.map +1 -0
- package/dist/engine/deploy/update.js +1385 -0
- package/dist/engine/deploy/update.js.map +1 -0
- package/dist/engine/deploy/version-step.d.ts +74 -0
- package/dist/engine/deploy/version-step.d.ts.map +1 -0
- package/dist/engine/deploy/version-step.js +177 -0
- package/dist/engine/deploy/version-step.js.map +1 -0
- package/dist/engine/device-auth.d.ts +240 -0
- package/dist/engine/device-auth.d.ts.map +1 -0
- package/dist/engine/device-auth.js +442 -0
- package/dist/engine/device-auth.js.map +1 -0
- package/dist/engine/device-login.d.ts +126 -0
- package/dist/engine/device-login.d.ts.map +1 -0
- package/dist/engine/device-login.js +164 -0
- package/dist/engine/device-login.js.map +1 -0
- package/dist/engine/errors.d.ts +314 -0
- package/dist/engine/errors.d.ts.map +1 -0
- package/dist/engine/errors.js +561 -0
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/github-raw-manifest.d.ts +59 -0
- package/dist/engine/github-raw-manifest.d.ts.map +1 -0
- package/dist/engine/github-raw-manifest.js +197 -0
- package/dist/engine/github-raw-manifest.js.map +1 -0
- package/dist/engine/identity.d.ts +169 -0
- package/dist/engine/identity.d.ts.map +1 -0
- package/dist/engine/identity.js +227 -0
- package/dist/engine/identity.js.map +1 -0
- package/dist/engine/index.d.ts +141 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +147 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/init/local-profile.d.ts +93 -0
- package/dist/engine/init/local-profile.d.ts.map +1 -0
- package/dist/engine/init/local-profile.js +295 -0
- package/dist/engine/init/local-profile.js.map +1 -0
- package/dist/engine/init/run-init.d.ts +41 -0
- package/dist/engine/init/run-init.d.ts.map +1 -0
- package/dist/engine/init/run-init.js +297 -0
- package/dist/engine/init/run-init.js.map +1 -0
- package/dist/engine/node/capabilities.d.ts +433 -0
- package/dist/engine/node/capabilities.d.ts.map +1 -0
- package/dist/engine/node/capabilities.js +597 -0
- package/dist/engine/node/capabilities.js.map +1 -0
- package/dist/engine/node/daemon-channels.d.ts +66 -0
- package/dist/engine/node/daemon-channels.d.ts.map +1 -0
- package/dist/engine/node/daemon-channels.js +65 -0
- package/dist/engine/node/daemon-channels.js.map +1 -0
- package/dist/engine/node/daemon.d.ts +63 -0
- package/dist/engine/node/daemon.d.ts.map +1 -0
- package/dist/engine/node/daemon.js +279 -0
- package/dist/engine/node/daemon.js.map +1 -0
- package/dist/engine/node/doctor.d.ts +60 -0
- package/dist/engine/node/doctor.d.ts.map +1 -0
- package/dist/engine/node/doctor.js +447 -0
- package/dist/engine/node/doctor.js.map +1 -0
- package/dist/engine/node/enrollment.d.ts +98 -0
- package/dist/engine/node/enrollment.d.ts.map +1 -0
- package/dist/engine/node/enrollment.js +189 -0
- package/dist/engine/node/enrollment.js.map +1 -0
- package/dist/engine/node/env-flags.d.ts +5 -0
- package/dist/engine/node/env-flags.d.ts.map +1 -0
- package/dist/engine/node/env-flags.js +22 -0
- package/dist/engine/node/env-flags.js.map +1 -0
- package/dist/engine/node/executors/credential-hygiene.d.ts +63 -0
- package/dist/engine/node/executors/credential-hygiene.d.ts.map +1 -0
- package/dist/engine/node/executors/credential-hygiene.js +210 -0
- package/dist/engine/node/executors/credential-hygiene.js.map +1 -0
- package/dist/engine/node/executors/db-backup-run.d.ts +73 -0
- package/dist/engine/node/executors/db-backup-run.d.ts.map +1 -0
- package/dist/engine/node/executors/db-backup-run.js +362 -0
- package/dist/engine/node/executors/db-backup-run.js.map +1 -0
- package/dist/engine/node/executors/example-checksum.d.ts +30 -0
- package/dist/engine/node/executors/example-checksum.d.ts.map +1 -0
- package/dist/engine/node/executors/example-checksum.js +56 -0
- package/dist/engine/node/executors/example-checksum.js.map +1 -0
- package/dist/engine/node/executors/index.d.ts +213 -0
- package/dist/engine/node/executors/index.d.ts.map +1 -0
- package/dist/engine/node/executors/index.js +58 -0
- package/dist/engine/node/executors/index.js.map +1 -0
- package/dist/engine/node/executors/registry.d.ts +38 -0
- package/dist/engine/node/executors/registry.d.ts.map +1 -0
- package/dist/engine/node/executors/registry.js +103 -0
- package/dist/engine/node/executors/registry.js.map +1 -0
- package/dist/engine/node/heap-snapshot.d.ts +37 -0
- package/dist/engine/node/heap-snapshot.d.ts.map +1 -0
- package/dist/engine/node/heap-snapshot.js +160 -0
- package/dist/engine/node/heap-snapshot.js.map +1 -0
- package/dist/engine/node/host-telemetry.d.ts +38 -0
- package/dist/engine/node/host-telemetry.d.ts.map +1 -0
- package/dist/engine/node/host-telemetry.js +39 -0
- package/dist/engine/node/host-telemetry.js.map +1 -0
- package/dist/engine/node/host-vitals.d.ts +51 -0
- package/dist/engine/node/host-vitals.d.ts.map +1 -0
- package/dist/engine/node/host-vitals.js +117 -0
- package/dist/engine/node/host-vitals.js.map +1 -0
- package/dist/engine/node/install-deps.d.ts +231 -0
- package/dist/engine/node/install-deps.d.ts.map +1 -0
- package/dist/engine/node/install-deps.js +392 -0
- package/dist/engine/node/install-deps.js.map +1 -0
- package/dist/engine/node/ipc-protocol.d.ts +114 -0
- package/dist/engine/node/ipc-protocol.d.ts.map +1 -0
- package/dist/engine/node/ipc-protocol.js +122 -0
- package/dist/engine/node/ipc-protocol.js.map +1 -0
- package/dist/engine/node/lifecycle.d.ts +103 -0
- package/dist/engine/node/lifecycle.d.ts.map +1 -0
- package/dist/engine/node/lifecycle.js +260 -0
- package/dist/engine/node/lifecycle.js.map +1 -0
- package/dist/engine/node/logger.d.ts +95 -0
- package/dist/engine/node/logger.d.ts.map +1 -0
- package/dist/engine/node/logger.js +241 -0
- package/dist/engine/node/logger.js.map +1 -0
- package/dist/engine/node/memory-watchdog.d.ts +89 -0
- package/dist/engine/node/memory-watchdog.d.ts.map +1 -0
- package/dist/engine/node/memory-watchdog.js +248 -0
- package/dist/engine/node/memory-watchdog.js.map +1 -0
- package/dist/engine/node/models.d.ts +195 -0
- package/dist/engine/node/models.d.ts.map +1 -0
- package/dist/engine/node/models.js +379 -0
- package/dist/engine/node/models.js.map +1 -0
- package/dist/engine/node/node-api.d.ts +439 -0
- package/dist/engine/node/node-api.d.ts.map +1 -0
- package/dist/engine/node/node-api.js +125 -0
- package/dist/engine/node/node-api.js.map +1 -0
- package/dist/engine/node/node-config.d.ts +128 -0
- package/dist/engine/node/node-config.d.ts.map +1 -0
- package/dist/engine/node/node-config.js +237 -0
- package/dist/engine/node/node-config.js.map +1 -0
- package/dist/engine/node/node-dashboard-source.d.ts +83 -0
- package/dist/engine/node/node-dashboard-source.d.ts.map +1 -0
- package/dist/engine/node/node-dashboard-source.js +181 -0
- package/dist/engine/node/node-dashboard-source.js.map +1 -0
- package/dist/engine/node/node-engine.d.ts +282 -0
- package/dist/engine/node/node-engine.d.ts.map +1 -0
- package/dist/engine/node/node-engine.js +925 -0
- package/dist/engine/node/node-engine.js.map +1 -0
- package/dist/engine/node/node-errors.d.ts +54 -0
- package/dist/engine/node/node-errors.d.ts.map +1 -0
- package/dist/engine/node/node-errors.js +71 -0
- package/dist/engine/node/node-errors.js.map +1 -0
- package/dist/engine/node/node-events-queue.d.ts +27 -0
- package/dist/engine/node/node-events-queue.d.ts.map +1 -0
- package/dist/engine/node/node-events-queue.js +46 -0
- package/dist/engine/node/node-events-queue.js.map +1 -0
- package/dist/engine/node/node-events.d.ts +132 -0
- package/dist/engine/node/node-events.d.ts.map +1 -0
- package/dist/engine/node/node-events.js +2 -0
- package/dist/engine/node/node-events.js.map +1 -0
- package/dist/engine/node/node-vitals.d.ts +123 -0
- package/dist/engine/node/node-vitals.d.ts.map +1 -0
- package/dist/engine/node/node-vitals.js +266 -0
- package/dist/engine/node/node-vitals.js.map +1 -0
- package/dist/engine/node/paths.d.ts +39 -0
- package/dist/engine/node/paths.d.ts.map +1 -0
- package/dist/engine/node/paths.js +60 -0
- package/dist/engine/node/paths.js.map +1 -0
- package/dist/engine/node/pg-dump.d.ts +126 -0
- package/dist/engine/node/pg-dump.d.ts.map +1 -0
- package/dist/engine/node/pg-dump.js +223 -0
- package/dist/engine/node/pg-dump.js.map +1 -0
- package/dist/engine/node/pidfile.d.ts +38 -0
- package/dist/engine/node/pidfile.d.ts.map +1 -0
- package/dist/engine/node/pidfile.js +156 -0
- package/dist/engine/node/pidfile.js.map +1 -0
- package/dist/engine/node/power-probe.d.ts +59 -0
- package/dist/engine/node/power-probe.d.ts.map +1 -0
- package/dist/engine/node/power-probe.js +240 -0
- package/dist/engine/node/power-probe.js.map +1 -0
- package/dist/engine/node/power-watcher.d.ts +30 -0
- package/dist/engine/node/power-watcher.d.ts.map +1 -0
- package/dist/engine/node/power-watcher.js +116 -0
- package/dist/engine/node/power-watcher.js.map +1 -0
- package/dist/engine/node/runtime-state.d.ts +24 -0
- package/dist/engine/node/runtime-state.d.ts.map +1 -0
- package/dist/engine/node/runtime-state.js +19 -0
- package/dist/engine/node/runtime-state.js.map +1 -0
- package/dist/engine/node/runtime-tuning.d.ts +174 -0
- package/dist/engine/node/runtime-tuning.d.ts.map +1 -0
- package/dist/engine/node/runtime-tuning.js +327 -0
- package/dist/engine/node/runtime-tuning.js.map +1 -0
- package/dist/engine/node/service.d.ts +39 -0
- package/dist/engine/node/service.d.ts.map +1 -0
- package/dist/engine/node/service.js +215 -0
- package/dist/engine/node/service.js.map +1 -0
- package/dist/engine/node/start.d.ts +69 -0
- package/dist/engine/node/start.d.ts.map +1 -0
- package/dist/engine/node/start.js +325 -0
- package/dist/engine/node/start.js.map +1 -0
- package/dist/engine/node/worker-env-aliases.d.ts +39 -0
- package/dist/engine/node/worker-env-aliases.d.ts.map +1 -0
- package/dist/engine/node/worker-env-aliases.js +126 -0
- package/dist/engine/node/worker-env-aliases.js.map +1 -0
- package/dist/engine/node/worker-env-table.d.ts +15 -0
- package/dist/engine/node/worker-env-table.d.ts.map +1 -0
- package/dist/engine/node/worker-env-table.js +100 -0
- package/dist/engine/node/worker-env-table.js.map +1 -0
- package/dist/engine/node/worker-env.d.ts +67 -0
- package/dist/engine/node/worker-env.d.ts.map +1 -0
- package/dist/engine/node/worker-env.js +114 -0
- package/dist/engine/node/worker-env.js.map +1 -0
- package/dist/engine/output.d.ts +97 -0
- package/dist/engine/output.d.ts.map +1 -0
- package/dist/engine/output.js +274 -0
- package/dist/engine/output.js.map +1 -0
- package/dist/engine/package-info.d.ts +7 -0
- package/dist/engine/package-info.d.ts.map +1 -0
- package/dist/engine/package-info.js +38 -0
- package/dist/engine/package-info.js.map +1 -0
- package/dist/engine/program.d.ts +53 -0
- package/dist/engine/program.d.ts.map +1 -0
- package/dist/engine/program.js +213 -0
- package/dist/engine/program.js.map +1 -0
- package/dist/engine/prompt.d.ts +69 -0
- package/dist/engine/prompt.d.ts.map +1 -0
- package/dist/engine/prompt.js +205 -0
- package/dist/engine/prompt.js.map +1 -0
- package/dist/engine/registries.d.ts +5 -0
- package/dist/engine/registries.d.ts.map +1 -0
- package/dist/engine/registries.js +68 -0
- package/dist/engine/registries.js.map +1 -0
- package/dist/engine/request-body.d.ts +31 -0
- package/dist/engine/request-body.d.ts.map +1 -0
- package/dist/engine/request-body.js +156 -0
- package/dist/engine/request-body.js.map +1 -0
- package/dist/engine/semver.d.ts +31 -0
- package/dist/engine/semver.d.ts.map +1 -0
- package/dist/engine/semver.js +100 -0
- package/dist/engine/semver.js.map +1 -0
- package/dist/engine/test-support.d.ts +50 -0
- package/dist/engine/test-support.d.ts.map +1 -0
- package/dist/engine/test-support.js +86 -0
- package/dist/engine/test-support.js.map +1 -0
- package/dist/engine/tui/app-registry.d.ts +103 -0
- package/dist/engine/tui/app-registry.d.ts.map +1 -0
- package/dist/engine/tui/app-registry.js +103 -0
- package/dist/engine/tui/app-registry.js.map +1 -0
- package/dist/engine/tui/app.d.ts +11 -0
- package/dist/engine/tui/app.d.ts.map +1 -0
- package/dist/engine/tui/app.js +134 -0
- package/dist/engine/tui/app.js.map +1 -0
- package/dist/engine/tui/builtin-screens.d.ts +11 -0
- package/dist/engine/tui/builtin-screens.d.ts.map +1 -0
- package/dist/engine/tui/builtin-screens.js +69 -0
- package/dist/engine/tui/builtin-screens.js.map +1 -0
- package/dist/engine/tui/conformance.d.ts +149 -0
- package/dist/engine/tui/conformance.d.ts.map +1 -0
- package/dist/engine/tui/conformance.js +428 -0
- package/dist/engine/tui/conformance.js.map +1 -0
- package/dist/engine/tui/context.d.ts +220 -0
- package/dist/engine/tui/context.d.ts.map +1 -0
- package/dist/engine/tui/context.js +258 -0
- package/dist/engine/tui/context.js.map +1 -0
- package/dist/engine/tui/dashboard/index.d.ts +8 -0
- package/dist/engine/tui/dashboard/index.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/index.js +5 -0
- package/dist/engine/tui/dashboard/index.js.map +1 -0
- package/dist/engine/tui/dashboard/jobs-insights.d.ts +145 -0
- package/dist/engine/tui/dashboard/jobs-insights.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/jobs-insights.js +63 -0
- package/dist/engine/tui/dashboard/jobs-insights.js.map +1 -0
- package/dist/engine/tui/dashboard/node-embedded.d.ts +33 -0
- package/dist/engine/tui/dashboard/node-embedded.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/node-embedded.js +81 -0
- package/dist/engine/tui/dashboard/node-embedded.js.map +1 -0
- package/dist/engine/tui/dashboard/source.d.ts +294 -0
- package/dist/engine/tui/dashboard/source.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/source.js +397 -0
- package/dist/engine/tui/dashboard/source.js.map +1 -0
- package/dist/engine/tui/dashboard/use-dashboard.d.ts +23 -0
- package/dist/engine/tui/dashboard/use-dashboard.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/use-dashboard.js +32 -0
- package/dist/engine/tui/dashboard/use-dashboard.js.map +1 -0
- package/dist/engine/tui/index.d.ts +25 -0
- package/dist/engine/tui/index.d.ts.map +1 -0
- package/dist/engine/tui/index.js +89 -0
- package/dist/engine/tui/index.js.map +1 -0
- package/dist/engine/tui/layout.d.ts +152 -0
- package/dist/engine/tui/layout.d.ts.map +1 -0
- package/dist/engine/tui/layout.js +214 -0
- package/dist/engine/tui/layout.js.map +1 -0
- package/dist/engine/tui/menu-registry.d.ts +201 -0
- package/dist/engine/tui/menu-registry.d.ts.map +1 -0
- package/dist/engine/tui/menu-registry.js +205 -0
- package/dist/engine/tui/menu-registry.js.map +1 -0
- package/dist/engine/tui/menu-tree.d.ts +198 -0
- package/dist/engine/tui/menu-tree.d.ts.map +1 -0
- package/dist/engine/tui/menu-tree.js +276 -0
- package/dist/engine/tui/menu-tree.js.map +1 -0
- package/dist/engine/tui/raw-mode.d.ts +54 -0
- package/dist/engine/tui/raw-mode.d.ts.map +1 -0
- package/dist/engine/tui/raw-mode.js +106 -0
- package/dist/engine/tui/raw-mode.js.map +1 -0
- package/dist/engine/tui/routes.d.ts +5 -0
- package/dist/engine/tui/routes.d.ts.map +1 -0
- package/dist/engine/tui/routes.js +16 -0
- package/dist/engine/tui/routes.js.map +1 -0
- package/dist/engine/tui/screen-registry.d.ts +170 -0
- package/dist/engine/tui/screen-registry.d.ts.map +1 -0
- package/dist/engine/tui/screen-registry.js +180 -0
- package/dist/engine/tui/screen-registry.js.map +1 -0
- package/dist/engine/tui/screen-sections.d.ts +9 -0
- package/dist/engine/tui/screen-sections.d.ts.map +1 -0
- package/dist/engine/tui/screen-sections.js +45 -0
- package/dist/engine/tui/screen-sections.js.map +1 -0
- package/dist/engine/tui/screens/deploy/advanced-model.d.ts +69 -0
- package/dist/engine/tui/screens/deploy/advanced-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/advanced-model.js +228 -0
- package/dist/engine/tui/screens/deploy/advanced-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor-model.d.ts +37 -0
- package/dist/engine/tui/screens/deploy/doctor-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor-model.js +89 -0
- package/dist/engine/tui/screens/deploy/doctor-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor.d.ts +8 -0
- package/dist/engine/tui/screens/deploy/doctor.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor.js +163 -0
- package/dist/engine/tui/screens/deploy/doctor.js.map +1 -0
- package/dist/engine/tui/screens/deploy/fields.d.ts +123 -0
- package/dist/engine/tui/screens/deploy/fields.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/fields.js +202 -0
- package/dist/engine/tui/screens/deploy/fields.js.map +1 -0
- package/dist/engine/tui/screens/deploy/flags-model.d.ts +67 -0
- package/dist/engine/tui/screens/deploy/flags-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/flags-model.js +302 -0
- package/dist/engine/tui/screens/deploy/flags-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/index.d.ts +6 -0
- package/dist/engine/tui/screens/deploy/index.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/index.js +83 -0
- package/dist/engine/tui/screens/deploy/index.js.map +1 -0
- package/dist/engine/tui/screens/deploy/install-model.d.ts +159 -0
- package/dist/engine/tui/screens/deploy/install-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/install-model.js +319 -0
- package/dist/engine/tui/screens/deploy/install-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/install.d.ts +8 -0
- package/dist/engine/tui/screens/deploy/install.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/install.js +365 -0
- package/dist/engine/tui/screens/deploy/install.js.map +1 -0
- package/dist/engine/tui/screens/deploy/model.d.ts +49 -0
- package/dist/engine/tui/screens/deploy/model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/model.js +59 -0
- package/dist/engine/tui/screens/deploy/model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/run-model.d.ts +58 -0
- package/dist/engine/tui/screens/deploy/run-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/run-model.js +117 -0
- package/dist/engine/tui/screens/deploy/run-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/run.d.ts +75 -0
- package/dist/engine/tui/screens/deploy/run.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/run.js +201 -0
- package/dist/engine/tui/screens/deploy/run.js.map +1 -0
- package/dist/engine/tui/screens/deploy/status.d.ts +17 -0
- package/dist/engine/tui/screens/deploy/status.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/status.js +107 -0
- package/dist/engine/tui/screens/deploy/status.js.map +1 -0
- package/dist/engine/tui/screens/deploy/update.d.ts +41 -0
- package/dist/engine/tui/screens/deploy/update.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/update.js +175 -0
- package/dist/engine/tui/screens/deploy/update.js.map +1 -0
- package/dist/engine/tui/screens/deploy.d.ts +12 -0
- package/dist/engine/tui/screens/deploy.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy.js +23 -0
- package/dist/engine/tui/screens/deploy.js.map +1 -0
- package/dist/engine/tui/screens/invoke.d.ts +6 -0
- package/dist/engine/tui/screens/invoke.d.ts.map +1 -0
- package/dist/engine/tui/screens/invoke.js +196 -0
- package/dist/engine/tui/screens/invoke.js.map +1 -0
- package/dist/engine/tui/screens/jobs.d.ts +12 -0
- package/dist/engine/tui/screens/jobs.d.ts.map +1 -0
- package/dist/engine/tui/screens/jobs.js +72 -0
- package/dist/engine/tui/screens/jobs.js.map +1 -0
- package/dist/engine/tui/screens/login.d.ts +6 -0
- package/dist/engine/tui/screens/login.d.ts.map +1 -0
- package/dist/engine/tui/screens/login.js +263 -0
- package/dist/engine/tui/screens/login.js.map +1 -0
- package/dist/engine/tui/screens/logout.d.ts +6 -0
- package/dist/engine/tui/screens/logout.d.ts.map +1 -0
- package/dist/engine/tui/screens/logout.js +149 -0
- package/dist/engine/tui/screens/logout.js.map +1 -0
- package/dist/engine/tui/screens/menu.d.ts +25 -0
- package/dist/engine/tui/screens/menu.d.ts.map +1 -0
- package/dist/engine/tui/screens/menu.js +124 -0
- package/dist/engine/tui/screens/menu.js.map +1 -0
- package/dist/engine/tui/screens/node.d.ts +6 -0
- package/dist/engine/tui/screens/node.d.ts.map +1 -0
- package/dist/engine/tui/screens/node.js +277 -0
- package/dist/engine/tui/screens/node.js.map +1 -0
- package/dist/engine/tui/screens/not-logged-in.d.ts +12 -0
- package/dist/engine/tui/screens/not-logged-in.d.ts.map +1 -0
- package/dist/engine/tui/screens/not-logged-in.js +14 -0
- package/dist/engine/tui/screens/not-logged-in.js.map +1 -0
- package/dist/engine/tui/screens/status.d.ts +6 -0
- package/dist/engine/tui/screens/status.d.ts.map +1 -0
- package/dist/engine/tui/screens/status.js +138 -0
- package/dist/engine/tui/screens/status.js.map +1 -0
- package/dist/engine/tui/scroll-box.d.ts +42 -0
- package/dist/engine/tui/scroll-box.d.ts.map +1 -0
- package/dist/engine/tui/scroll-box.js +62 -0
- package/dist/engine/tui/scroll-box.js.map +1 -0
- package/dist/engine/tui/section-registry.d.ts +65 -0
- package/dist/engine/tui/section-registry.d.ts.map +1 -0
- package/dist/engine/tui/section-registry.js +90 -0
- package/dist/engine/tui/section-registry.js.map +1 -0
- package/dist/engine/tui/terminal.d.ts +31 -0
- package/dist/engine/tui/terminal.d.ts.map +1 -0
- package/dist/engine/tui/terminal.js +142 -0
- package/dist/engine/tui/terminal.js.map +1 -0
- package/dist/engine/tui/testing/feeds.d.ts +58 -0
- package/dist/engine/tui/testing/feeds.d.ts.map +1 -0
- package/dist/engine/tui/testing/feeds.js +67 -0
- package/dist/engine/tui/testing/feeds.js.map +1 -0
- package/dist/engine/tui/testing/harness.d.ts +243 -0
- package/dist/engine/tui/testing/harness.d.ts.map +1 -0
- package/dist/engine/tui/testing/harness.js +332 -0
- package/dist/engine/tui/testing/harness.js.map +1 -0
- package/dist/engine/tui/theme.d.ts +179 -0
- package/dist/engine/tui/theme.d.ts.map +1 -0
- package/dist/engine/tui/theme.js +111 -0
- package/dist/engine/tui/theme.js.map +1 -0
- package/dist/engine/tui/tty.d.ts +56 -0
- package/dist/engine/tui/tty.d.ts.map +1 -0
- package/dist/engine/tui/tty.js +146 -0
- package/dist/engine/tui/tty.js.map +1 -0
- package/dist/engine/tui/ui/active-items.d.ts +40 -0
- package/dist/engine/tui/ui/active-items.d.ts.map +1 -0
- package/dist/engine/tui/ui/active-items.js +38 -0
- package/dist/engine/tui/ui/active-items.js.map +1 -0
- package/dist/engine/tui/ui/event-log.d.ts +58 -0
- package/dist/engine/tui/ui/event-log.d.ts.map +1 -0
- package/dist/engine/tui/ui/event-log.js +32 -0
- package/dist/engine/tui/ui/event-log.js.map +1 -0
- package/dist/engine/tui/ui/index.d.ts +20 -0
- package/dist/engine/tui/ui/index.d.ts.map +1 -0
- package/dist/engine/tui/ui/index.js +14 -0
- package/dist/engine/tui/ui/index.js.map +1 -0
- package/dist/engine/tui/ui/meter-legend.d.ts +26 -0
- package/dist/engine/tui/ui/meter-legend.d.ts.map +1 -0
- package/dist/engine/tui/ui/meter-legend.js +25 -0
- package/dist/engine/tui/ui/meter-legend.js.map +1 -0
- package/dist/engine/tui/ui/run-summary.d.ts +58 -0
- package/dist/engine/tui/ui/run-summary.d.ts.map +1 -0
- package/dist/engine/tui/ui/run-summary.js +29 -0
- package/dist/engine/tui/ui/run-summary.js.map +1 -0
- package/dist/engine/tui/ui/segment-meter.d.ts +72 -0
- package/dist/engine/tui/ui/segment-meter.d.ts.map +1 -0
- package/dist/engine/tui/ui/segment-meter.js +128 -0
- package/dist/engine/tui/ui/segment-meter.js.map +1 -0
- package/dist/engine/tui/ui/status-line.d.ts +42 -0
- package/dist/engine/tui/ui/status-line.d.ts.map +1 -0
- package/dist/engine/tui/ui/status-line.js +35 -0
- package/dist/engine/tui/ui/status-line.js.map +1 -0
- package/dist/engine/tui/ui/tone.d.ts +46 -0
- package/dist/engine/tui/ui/tone.d.ts.map +1 -0
- package/dist/engine/tui/ui/tone.js +48 -0
- package/dist/engine/tui/ui/tone.js.map +1 -0
- package/dist/engine/update-notice-options.d.ts +70 -0
- package/dist/engine/update-notice-options.d.ts.map +1 -0
- package/dist/engine/update-notice-options.js +79 -0
- package/dist/engine/update-notice-options.js.map +1 -0
- package/dist/engine/update-notice.d.ts +69 -0
- package/dist/engine/update-notice.d.ts.map +1 -0
- package/dist/engine/update-notice.js +204 -0
- package/dist/engine/update-notice.js.map +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +5 -0
- package/dist/node/index.js.map +1 -0
- package/dist/telemetry/index.d.ts +2 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/node-span-relay.d.ts +1 -1
- package/dist/telemetry/node-span-relay.d.ts.map +1 -1
- package/dist/telemetry/node-span-relay.js +39 -6
- package/dist/telemetry/node-span-relay.js.map +1 -1
- package/dist/telemetry/node-span.d.ts +39 -7
- package/dist/telemetry/node-span.d.ts.map +1 -1
- package/dist/telemetry/node-span.js +19 -1
- package/dist/telemetry/node-span.js.map +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tui/index.d.ts +3 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +7 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/testing/index.d.ts +5 -0
- package/dist/tui/testing/index.d.ts.map +1 -0
- package/dist/tui/testing/index.js +12 -0
- package/dist/tui/testing/index.js.map +1 -0
- package/dist/tui/ui/index.d.ts +2 -0
- package/dist/tui/ui/index.d.ts.map +1 -0
- package/dist/tui/ui/index.js +10 -0
- package/dist/tui/ui/index.js.map +1 -0
- package/package.json +56 -5
|
@@ -0,0 +1,1474 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync } from 'node:fs';
|
|
2
|
+
import { basename, join } from 'node:path';
|
|
3
|
+
import { cliName, cliVersion } from '../identity.js';
|
|
4
|
+
import { PreconditionError, UsageError } from '../errors.js';
|
|
5
|
+
import { allChecks, checksPassed, gitCredentialStateFor, requiredChecks, runChecks, } from './checks/index.js';
|
|
6
|
+
import { parseEnvExample, parseEnvFile } from './env-spec.js';
|
|
7
|
+
import { composeFilesFor, effectiveGroups } from './compose-files.js';
|
|
8
|
+
import { composeArgv, composeCwd } from './compose-command.js';
|
|
9
|
+
import { writeEnvContents, writeEnvFile } from './env-file.js';
|
|
10
|
+
import { isDeployment } from './deployment-evidence.js';
|
|
11
|
+
import { runEnvWizard } from './env-wizard.js';
|
|
12
|
+
import { runCommand as defaultRunCommand } from './executor.js';
|
|
13
|
+
import { canObtainConsent, consented, obtainConsent, } from './consent.js';
|
|
14
|
+
import { ensureApplicationRole, loginHelpMetadata, plannedRoleName, provisioningMetadata, resolveAdminLogin, roleOptionsFrom, superuserRecord, } from './app-role.js';
|
|
15
|
+
import { ensureDatabase, onlyDatabaseMissing, unattendedDatabaseRefusal } from './database.js';
|
|
16
|
+
import { waitForHealthy, collectHealth, isHealthy } from './health.js';
|
|
17
|
+
import { runOAuthCheck } from './oauth-check.js';
|
|
18
|
+
import { bootstrapProxy, ensureExternalNetworks, externalNetworksIn, inspectProxy, } from './proxy-bootstrap.js';
|
|
19
|
+
import { ensureRenewal } from './renewal.js';
|
|
20
|
+
import { openJournal } from './journal.js';
|
|
21
|
+
import { bootstrapProxyRoot, certificateStatus, describeProxyRuntime, installVhost, issueCertificate, resolveRecordedProxyRuntime, } from './proxy.js';
|
|
22
|
+
import { checkoutHead, ensureCheckout, resolveRepoTarget, resolveRepoUrl } from './repo.js';
|
|
23
|
+
import { explainComposeFailure } from './compose-hints.js';
|
|
24
|
+
import { freshComposeProject, listComposeContainers } from './compose-containers.js';
|
|
25
|
+
import { isLoopbackPortFree } from './checks/types.js';
|
|
26
|
+
import { describePick, foreignContainers, isPort, pickFreePort, planPortValues, readComposeFileTexts } from './free-ports.js';
|
|
27
|
+
import { detectComposeProject, reconcileComposeProject } from './compose-project.js';
|
|
28
|
+
import { DEPLOY_STATE_VERSION, appendHistory, readState, writeState, } from './state.js';
|
|
29
|
+
import { assertStackPortsFree, STACK_PORTS_STEP_ID } from './stack-ports-gate.js';
|
|
30
|
+
import { runPipeline } from './steps/pipeline.js';
|
|
31
|
+
import { appStepContext } from './steps/app-step-context.js';
|
|
32
|
+
import { withRegisteredSteps } from './steps/registry.js';
|
|
33
|
+
import { checkoutPathFor, publishVersion, runVersionStep, stampAppVersion, } from './version-step.js';
|
|
34
|
+
import { writeDeployInfo } from './deploy-info.js';
|
|
35
|
+
import { collectHostFacts } from './host-facts.js';
|
|
36
|
+
import { observeProxy, proxyInfoOf } from './run-record.js';
|
|
37
|
+
import { metadataFor } from './env-metadata.js';
|
|
38
|
+
/**
|
|
39
|
+
* The environment this run acts on: the wizard's, or -- on a resumed run that
|
|
40
|
+
* skipped the `environment` step -- the file on disk.
|
|
41
|
+
*/
|
|
42
|
+
function environmentOf(context) {
|
|
43
|
+
if (context.env !== undefined)
|
|
44
|
+
return context.env;
|
|
45
|
+
const path = envFilePath(context.options.deployRoot);
|
|
46
|
+
return existsSync(path) ? parseEnvFile(readFileSync(path, 'utf8')) : undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `existing` plus a free port for every published-port variable of the
|
|
50
|
+
* template that has no value in it (#1027).
|
|
51
|
+
*
|
|
52
|
+
* "No value" is the rule that keeps an existing deployment safe: an `.env`
|
|
53
|
+
* that already holds `GREPTIME_BIND_PG_PORT` keeps it even when something else
|
|
54
|
+
* took the port since (an SSH tunnel may depend on it; `stack-ports-free`
|
|
55
|
+
* reports the clash with the fix), and so does an operator's answer. A variable
|
|
56
|
+
* the `.env` lacks (a reinstall over an environment from before the key
|
|
57
|
+
* existed) is decided like a fresh install's.
|
|
58
|
+
*
|
|
59
|
+
* `APP_BIND_PORT` is not decided here: `settleBindPort` chose it before the
|
|
60
|
+
* pipeline ran, and the step writes it from `options.bindPort`.
|
|
61
|
+
*/
|
|
62
|
+
async function withFreePorts(context, specs, existing) {
|
|
63
|
+
const project = context.composeProject ?? freshComposeProject(context.options.deployRoot);
|
|
64
|
+
const decisions = await planPortValues({
|
|
65
|
+
files: readComposeFileTexts(context.options.deployRoot, context.options.groups),
|
|
66
|
+
eligible: new Set(specs.map((spec) => spec.key)),
|
|
67
|
+
given: existing ?? new Map(),
|
|
68
|
+
defaults: new Map(specs.map((spec) => [spec.key, spec.defaultValue])),
|
|
69
|
+
exclude: new Set(['APP_BIND_PORT']),
|
|
70
|
+
taken: [context.options.bindPort],
|
|
71
|
+
containers: foreignContainers(await listComposeContainers(context.runCommand), project),
|
|
72
|
+
probe: context.options.portFree,
|
|
73
|
+
});
|
|
74
|
+
if (decisions.length === 0)
|
|
75
|
+
return existing;
|
|
76
|
+
const planned = new Map(existing ?? []);
|
|
77
|
+
for (const decision of decisions) {
|
|
78
|
+
planned.set(decision.variable, String(decision.port));
|
|
79
|
+
if (decision.message !== undefined) {
|
|
80
|
+
context.journal.line(`Picked a free host port: ${decision.message}`);
|
|
81
|
+
context.hooks?.onProgress?.(`Picked a free host port: ${decision.message}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return planned;
|
|
85
|
+
}
|
|
86
|
+
/** The question the proxy-bootstrap gate asks. */
|
|
87
|
+
function bootstrapQuestion(proxyRoot, container) {
|
|
88
|
+
return (`This server has no shared reverse proxy. Create one in ${proxyRoot} ` +
|
|
89
|
+
`(nginx container "${container}" on ports 80/443, serving every application on this host)?`);
|
|
90
|
+
}
|
|
91
|
+
/** The refusal when the proxy is absent and nobody consented to create it. */
|
|
92
|
+
function bootstrapRefusal(outcome, proxyRoot) {
|
|
93
|
+
return new PreconditionError((outcome === 'declined'
|
|
94
|
+
? 'Creating the shared proxy was declined.'
|
|
95
|
+
: 'This server has no shared reverse proxy, and nothing could be asked in this mode.') +
|
|
96
|
+
` Re-run with --bootstrap-proxy to have install create it in ${proxyRoot}, ` +
|
|
97
|
+
`bring up an existing one (cd ${proxyRoot} && docker compose up -d), or pass --skip-proxy.`);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The proxy runtime this run acts under, resolved ONCE and then reused, so the
|
|
101
|
+
* preflight, the certificate and the vhost can never disagree about it.
|
|
102
|
+
*/
|
|
103
|
+
async function proxyRuntimeOf(context) {
|
|
104
|
+
if (context.proxyRuntime !== undefined)
|
|
105
|
+
return context.proxyRuntime;
|
|
106
|
+
const runtime = await resolveRecordedProxyRuntime({
|
|
107
|
+
proxyRoot: context.options.proxyRoot,
|
|
108
|
+
flags: { mode: context.options.proxyMode, container: context.options.proxyContainer },
|
|
109
|
+
recorded: context.recordedProxy,
|
|
110
|
+
runCommand: context.runCommand,
|
|
111
|
+
});
|
|
112
|
+
context.proxyRuntime = runtime;
|
|
113
|
+
context.journal.line(describeProxyRuntime(runtime));
|
|
114
|
+
return runtime;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The host facts for this run, collected ONCE on first use and then reused, so
|
|
118
|
+
* the health-gate info.json and the final state/info.json agree. Lazy rather
|
|
119
|
+
* than up front: by the health gate Docker is demonstrably there to answer.
|
|
120
|
+
*/
|
|
121
|
+
async function hostFactsOf(context) {
|
|
122
|
+
context.hostFacts ??= await collectHostFacts({ runCommand: context.runCommand });
|
|
123
|
+
return context.hostFacts;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The info.json input for this run, as known at `at`.
|
|
127
|
+
*
|
|
128
|
+
* One builder for both writes -- the health gate and the end of a successful
|
|
129
|
+
* run -- so the second can only ADD what the run learned since (the new
|
|
130
|
+
* history entry, the certificate), never describe the deployment differently.
|
|
131
|
+
*/
|
|
132
|
+
function installDeployInfo(context, at) {
|
|
133
|
+
const existing = context.existingState;
|
|
134
|
+
const runtime = recordedRuntime(context);
|
|
135
|
+
const domain = context.options.domain;
|
|
136
|
+
return {
|
|
137
|
+
name: basename(context.options.deployRoot),
|
|
138
|
+
...(context.version?.version === undefined ? {} : { version: context.version.version }),
|
|
139
|
+
...(context.commitSha === undefined ? {} : { commitSha: context.commitSha }),
|
|
140
|
+
...(context.target?.ref === undefined ? {} : { ref: context.target.ref }),
|
|
141
|
+
// The first install is `at`; a --reinstall keeps the original.
|
|
142
|
+
installedAt: existing?.installedAt ?? at,
|
|
143
|
+
updatedAt: at,
|
|
144
|
+
cliVersion: cliVersion(),
|
|
145
|
+
...(domain === undefined ? {} : { domain }),
|
|
146
|
+
// What THIS run has finished so far -- not the resume set, which is what a
|
|
147
|
+
// PREVIOUS run finished.
|
|
148
|
+
completed: [...(context.progress ?? [])],
|
|
149
|
+
lastCommand: 'install',
|
|
150
|
+
bindPort: context.options.bindPort,
|
|
151
|
+
// Before `publish` the certificate is whatever a previous run observed for
|
|
152
|
+
// the SAME domain; the end-of-run rewrite replaces it with a fresh read.
|
|
153
|
+
proxy: proxyInfoOf(domain === undefined
|
|
154
|
+
? undefined
|
|
155
|
+
: {
|
|
156
|
+
domain,
|
|
157
|
+
bindPort: context.options.bindPort,
|
|
158
|
+
mode: runtime.proxyMode ?? null,
|
|
159
|
+
container: runtime.proxyContainer ?? null,
|
|
160
|
+
certificateExpiresAt: existing?.proxy?.domain === domain ? existing.proxy.certificateExpiresAt : null,
|
|
161
|
+
}),
|
|
162
|
+
...(context.hostFacts === undefined ? {} : { host: context.hostFacts }),
|
|
163
|
+
// Success-only: THIS run is not in it until it has succeeded.
|
|
164
|
+
history: existing?.history ?? [],
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/** The state fields that record the runtime, when one was resolved. */
|
|
168
|
+
function recordedRuntime(context) {
|
|
169
|
+
const runtime = context.proxyRuntime;
|
|
170
|
+
// A run that never touched the proxy keeps whatever was recorded before.
|
|
171
|
+
if (runtime === undefined)
|
|
172
|
+
return context.recordedProxy ?? {};
|
|
173
|
+
return { proxyMode: runtime.mode, proxyContainer: runtime.container };
|
|
174
|
+
}
|
|
175
|
+
// composeCwd and composeArgv live in compose-command.ts (a leaf, so a deploy check can
|
|
176
|
+
// build the same argv without importing this pipeline); re-exported here.
|
|
177
|
+
export { composeArgv, composeCwd };
|
|
178
|
+
/**
|
|
179
|
+
* The compose project name for a deployment.
|
|
180
|
+
*
|
|
181
|
+
* ⚠ THIS IS AN OUTAGE WAITING TO HAPPEN IF GOT WRONG, so read before changing.
|
|
182
|
+
*
|
|
183
|
+
* Without `-p`, Compose derives the project name from the compose file's
|
|
184
|
+
* DIRECTORY, which is `compose` for every deployment on the host -- so two
|
|
185
|
+
* applications collide on one project and each `up -d` fights the other. That
|
|
186
|
+
* is the bug this fixes.
|
|
187
|
+
*
|
|
188
|
+
* But naming an EXISTING deployment's project renames it, and Compose then
|
|
189
|
+
* sees no existing containers: it builds a parallel stack that collides with
|
|
190
|
+
* the old one still holding the bind port. A bookkeeping change would have
|
|
191
|
+
* caused an outage.
|
|
192
|
+
*
|
|
193
|
+
* So the name is RECORDED, never derived at the call site. A deployment that
|
|
194
|
+
* was installed before this existed stays on `compose` for ever; only a fresh
|
|
195
|
+
* install gets its own name. `state.composeProject` is the record, and the
|
|
196
|
+
* absence of it means `compose` -- which is exactly what every deployment in
|
|
197
|
+
* the field has.
|
|
198
|
+
*/
|
|
199
|
+
export const LEGACY_COMPOSE_PROJECT = 'compose';
|
|
200
|
+
export function composeProjectFor(state) {
|
|
201
|
+
return state?.composeProject ?? LEGACY_COMPOSE_PROJECT;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Creates every directory compose bind-mounts from, before compose runs.
|
|
205
|
+
*
|
|
206
|
+
* =============================================================================
|
|
207
|
+
* ⚠ CALLED BEFORE **EVERY** COMPOSE INVOCATION, NOT JUST BEFORE `up`
|
|
208
|
+
* =============================================================================
|
|
209
|
+
*
|
|
210
|
+
* Docker creates a missing bind SOURCE itself, as `root:root`, the moment it
|
|
211
|
+
* instantiates the service that mounts it -- and
|
|
212
|
+
* `compose run --rm --no-deps api` instantiates the api service just as thoroughly as `up` does. So
|
|
213
|
+
* `migrate`, two steps before `start`, was already creating
|
|
214
|
+
* `<deployRoot>/deploy-info` owned by root; the `mkdirSync` at `start` then
|
|
215
|
+
* no-opped on a directory that already existed, and the `deploy-info` step
|
|
216
|
+
* later got EACCES writing into it.
|
|
217
|
+
*
|
|
218
|
+
* Every step reported green. The deployment was up, healthy and serving; only
|
|
219
|
+
* the About page was permanently empty, and the one line saying why was a
|
|
220
|
+
* warning in a journal nobody reads on a successful run.
|
|
221
|
+
*
|
|
222
|
+
* Guarding the ORDER was the original fix and it was the wrong shape: it left
|
|
223
|
+
* the invariant depending on which step happens to come first, so adding a
|
|
224
|
+
* compose call earlier in the pipeline silently reintroduces the bug. Guarding
|
|
225
|
+
* the CALL makes that unrepresentable. `mkdirSync` with `recursive` is a no-op
|
|
226
|
+
* when the directory is already there, so the cost is one syscall.
|
|
227
|
+
*/
|
|
228
|
+
function ensureBindSources(deployRoot) {
|
|
229
|
+
mkdirSync(join(deployRoot, 'deploy-info'), { recursive: true });
|
|
230
|
+
}
|
|
231
|
+
function envFilePath(deployRoot) {
|
|
232
|
+
return join(composeCwd(deployRoot), '.env');
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* What the wizard will start from: the `.env` on disk, with the caller's
|
|
236
|
+
* non-blank answers over it. Shared by the `environment` step and preflight's
|
|
237
|
+
* database gate (#396), so the gate probes the settings the run will write.
|
|
238
|
+
*/
|
|
239
|
+
function plannedEnvironment(options) {
|
|
240
|
+
const path = envFilePath(options.deployRoot);
|
|
241
|
+
const onDisk = existsSync(path) ? parseEnvFile(readFileSync(path, 'utf8')) : undefined;
|
|
242
|
+
// Answers supplied by a caller win over what is on disk: they are the
|
|
243
|
+
// more recent statement of intent.
|
|
244
|
+
//
|
|
245
|
+
// A BLANK ANSWER IS NOT AN ANSWER, though, and this is the guard that
|
|
246
|
+
// says so. The TUI collects every essential key into a form and hands
|
|
247
|
+
// the whole map over, so a field the operator left alone arrives as
|
|
248
|
+
// `''`. Letting that beat the on-disk value means a re-install over a
|
|
249
|
+
// live deployment overwrites the secrets it did not ask about - and for
|
|
250
|
+
// `SECRETS_ENCRYPTION_KEY` that makes every credential encrypted under
|
|
251
|
+
// the old key permanently undecryptable, with no visible symptom.
|
|
252
|
+
//
|
|
253
|
+
// Dropping blanks here means "leave it as it is" survives the round
|
|
254
|
+
// trip, which is what an untouched field means in every UI anyone has
|
|
255
|
+
// ever used.
|
|
256
|
+
if (options.answers === undefined)
|
|
257
|
+
return onDisk;
|
|
258
|
+
const supplied = [...options.answers].filter(([, value]) => value !== '');
|
|
259
|
+
return new Map([...(onDisk ?? new Map()), ...supplied]);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The POSTGRES_* keys that must all be known, non-blank, before checkout for
|
|
263
|
+
* preflight to probe the database (#396). POSTGRES_SSL is left out: absent
|
|
264
|
+
* means `false` both here and in the template.
|
|
265
|
+
*/
|
|
266
|
+
const PRE_CHECKOUT_DATABASE_KEYS = [
|
|
267
|
+
'POSTGRES_HOST',
|
|
268
|
+
'POSTGRES_PORT',
|
|
269
|
+
'POSTGRES_USER',
|
|
270
|
+
'POSTGRES_PASSWORD',
|
|
271
|
+
'POSTGRES_DB',
|
|
272
|
+
];
|
|
273
|
+
/**
|
|
274
|
+
* The environment preflight may probe the database with, or undefined when
|
|
275
|
+
* the settings are not knowable until the wizard has run -- a first install
|
|
276
|
+
* whose answers leave a POSTGRES_* key to the template, which is not on disk
|
|
277
|
+
* until `checkout`. A template default is never guessed at here: probing a
|
|
278
|
+
* database the run will not use could refuse an install that would work.
|
|
279
|
+
*/
|
|
280
|
+
function preCheckoutDatabaseEnvironment(options) {
|
|
281
|
+
const env = plannedEnvironment(options);
|
|
282
|
+
if (env === undefined)
|
|
283
|
+
return undefined;
|
|
284
|
+
return PRE_CHECKOUT_DATABASE_KEYS.every((key) => (env.get(key) ?? '') !== '') ? env : undefined;
|
|
285
|
+
}
|
|
286
|
+
/** Secrets for the journal's redactor, from the metadata rather than a guess. */
|
|
287
|
+
export function secretsFrom(env) {
|
|
288
|
+
return [...env.entries()]
|
|
289
|
+
.filter(([key]) => metadataFor(key).secret === true)
|
|
290
|
+
.map(([key, value]) => ({ key, value }));
|
|
291
|
+
}
|
|
292
|
+
async function compose(context, extra, options) {
|
|
293
|
+
ensureBindSources(context.options.deployRoot);
|
|
294
|
+
await ensureStackNetworks(context, extra, context.options.groups);
|
|
295
|
+
const argv = composeArgv(extra, context.composeProject, context.options.groups, composeCwd(context.options.deployRoot));
|
|
296
|
+
let result;
|
|
297
|
+
try {
|
|
298
|
+
result = await context.runCommand(argv, {
|
|
299
|
+
cwd: composeCwd(context.options.deployRoot),
|
|
300
|
+
timeoutMs: options?.timeoutMs ?? 30 * 60_000,
|
|
301
|
+
redact: context.journal.redact,
|
|
302
|
+
...(context.hooks?.onLog === undefined
|
|
303
|
+
? {}
|
|
304
|
+
: { onLine: (line) => context.hooks?.onLog?.(line) }),
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
// See compose-hints.ts: a required compose variable with no value.
|
|
309
|
+
throw explainComposeFailure(error, join(composeCwd(context.options.deployRoot), '.env'));
|
|
310
|
+
}
|
|
311
|
+
context.journal.command(result);
|
|
312
|
+
}
|
|
313
|
+
/** Compose subcommands that instantiate services, and so need their networks. */
|
|
314
|
+
const INSTANTIATING = new Set(['up', 'run', 'create', 'start', 'restart']);
|
|
315
|
+
/**
|
|
316
|
+
* Ensures the stack's external networks exist before the FIRST compose call
|
|
317
|
+
* that instantiates a service -- `migrate`'s `compose run`, before `start`'s
|
|
318
|
+
* `up`. Once per run (`networksEnsured`), and guarded on the CALL for the same
|
|
319
|
+
* reason `ensureBindSources` is: an earlier compose step added later cannot
|
|
320
|
+
* reintroduce the fresh-box failure. Shared with update.
|
|
321
|
+
*/
|
|
322
|
+
export async function ensureStackNetworks(context, extra, groups) {
|
|
323
|
+
if (context.networksEnsured === true || !INSTANTIATING.has(extra[0] ?? ''))
|
|
324
|
+
return;
|
|
325
|
+
const composeDir = composeCwd(context.options.deployRoot);
|
|
326
|
+
await ensureExternalNetworks({
|
|
327
|
+
// The same files the compose call itself will use; see compose-files.ts.
|
|
328
|
+
composeFiles: composeFilesFor(groups, composeDir).map((file) => join(composeDir, file)),
|
|
329
|
+
runCommand: context.runCommand,
|
|
330
|
+
onLine: (line) => context.journal.line(line),
|
|
331
|
+
});
|
|
332
|
+
context.networksEnsured = true;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Preflight's database gate (#396): the refusal `ensure-database` is certain
|
|
336
|
+
* to give, or undefined. Asks nothing and creates nothing; see the call site.
|
|
337
|
+
*/
|
|
338
|
+
async function preflightDatabaseRefusal(context) {
|
|
339
|
+
if (canObtainConsent(consentOptions(context, context.options.createDatabase)))
|
|
340
|
+
return undefined;
|
|
341
|
+
const env = preCheckoutDatabaseEnvironment(context.options);
|
|
342
|
+
if (env === undefined) {
|
|
343
|
+
context.journal.line('Database settings are not known until the environment is configured; ensure-database will check.');
|
|
344
|
+
return undefined;
|
|
345
|
+
}
|
|
346
|
+
// The existence checks carry the password in PGPASSWORD; a fresh journal
|
|
347
|
+
// has not seen it yet, and a psql error must not put it in the log.
|
|
348
|
+
context.journal.addSecrets?.(secretsFrom(env));
|
|
349
|
+
return await unattendedDatabaseRefusal({
|
|
350
|
+
env,
|
|
351
|
+
runCommand: context.runCommand,
|
|
352
|
+
envPath: envFilePath(context.options.deployRoot),
|
|
353
|
+
onLine: (line) => context.journal.line(line),
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
export function buildInstallSteps() {
|
|
357
|
+
return [
|
|
358
|
+
{
|
|
359
|
+
id: 'preflight',
|
|
360
|
+
title: 'Check prerequisites',
|
|
361
|
+
skip: (context) => context.options.skipDoctor === true
|
|
362
|
+
? 'skipped with --skip-doctor'
|
|
363
|
+
: undefined,
|
|
364
|
+
async run(context) {
|
|
365
|
+
// Create the shared proxy's directory layout BEFORE the checks that
|
|
366
|
+
// look for it. Both the spec and the runbook promise install does this;
|
|
367
|
+
// until now the checks simply failed instead, so an operator following
|
|
368
|
+
// the documentation on a fresh VPS hit a refusal it told them would not
|
|
369
|
+
// happen. Directories only -- the proxy itself is shared infrastructure
|
|
370
|
+
// this deployment is a tenant of, not an owner of.
|
|
371
|
+
if (context.options.skipProxy !== true) {
|
|
372
|
+
const { created } = bootstrapProxyRoot(context.options.proxyRoot, context.hooks);
|
|
373
|
+
for (const path of created)
|
|
374
|
+
context.journal.line(`Created ${path}`);
|
|
375
|
+
}
|
|
376
|
+
// The repository `checkout` will clone, by the same precedence, and
|
|
377
|
+
// whether git can already read it. Probed ONCE here because it decides
|
|
378
|
+
// whether gh-installed/gh-authenticated are required (#390): an HTTPS
|
|
379
|
+
// GitHub URL git cannot read would otherwise stop the clone at an
|
|
380
|
+
// authentication prompt, after this preflight said it was fine.
|
|
381
|
+
const repoUrl = await resolveRepoUrl({
|
|
382
|
+
cwd: context.options.cwd ?? process.cwd(),
|
|
383
|
+
runCommand: context.runCommand,
|
|
384
|
+
...(context.options.repo === undefined ? {} : { repoFlag: context.options.repo }),
|
|
385
|
+
});
|
|
386
|
+
const gitCredentialed = await gitCredentialStateFor(repoUrl, context.runCommand);
|
|
387
|
+
// #391: a box with no proxy at all is bootstrappable -- ask NOW, with
|
|
388
|
+
// the other questions, rather than after a four-minute build. Consent
|
|
389
|
+
// lets the proxy-container check stand down; the `proxy-bootstrap`
|
|
390
|
+
// step does the work later, just before `publish`.
|
|
391
|
+
const runtime = await proxyRuntimeOf(context);
|
|
392
|
+
if (context.options.skipProxy !== true &&
|
|
393
|
+
context.options.domain !== undefined &&
|
|
394
|
+
runtime.mode === 'container') {
|
|
395
|
+
const presence = await inspectProxy({
|
|
396
|
+
proxyRoot: context.options.proxyRoot,
|
|
397
|
+
runtime,
|
|
398
|
+
runCommand: context.runCommand,
|
|
399
|
+
});
|
|
400
|
+
if (presence.state === 'absent') {
|
|
401
|
+
context.proxyBootstrapConsent = await obtainConsent(bootstrapQuestion(context.options.proxyRoot, runtime.container), consentOptions(context, context.options.bootstrapProxy));
|
|
402
|
+
context.journal.line(`Shared proxy absent; bootstrap consent: ${context.proxyBootstrapConsent}`);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const checkContext = {
|
|
406
|
+
runCommand: context.runCommand,
|
|
407
|
+
deployRoot: context.options.deployRoot,
|
|
408
|
+
bindPort: context.options.bindPort,
|
|
409
|
+
// What this install will record, so install and doctor agree.
|
|
410
|
+
composeProject: context.composeProject,
|
|
411
|
+
// The files `up -d` will use, which `stack-ports-free` renders.
|
|
412
|
+
groups: context.options.groups,
|
|
413
|
+
// This preflight runs before the `environment` step has written the
|
|
414
|
+
// `.env`; the `stack-ports` step asks again with the final one.
|
|
415
|
+
environmentPending: true,
|
|
416
|
+
...(context.options.portFree === undefined ? {} : { portFree: context.options.portFree }),
|
|
417
|
+
proxyRoot: context.options.proxyRoot,
|
|
418
|
+
// Resolved before the checks, because it decides which of them are
|
|
419
|
+
// required: certbot-installed only on the host, renewal-path hygiene
|
|
420
|
+
// only in a container.
|
|
421
|
+
proxyRuntime: runtime,
|
|
422
|
+
...(context.options.domain === undefined
|
|
423
|
+
? {}
|
|
424
|
+
: { domain: context.options.domain }),
|
|
425
|
+
...(repoUrl === undefined ? {} : { repoUrl }),
|
|
426
|
+
...(gitCredentialed === undefined ? {} : { gitCredentialed }),
|
|
427
|
+
...(context.options.skipProxy === true ? { skipProxy: true } : {}),
|
|
428
|
+
...(context.proxyBootstrapConsent !== undefined && consented(context.proxyBootstrapConsent)
|
|
429
|
+
? { proxyBootstrap: true }
|
|
430
|
+
: {}),
|
|
431
|
+
};
|
|
432
|
+
const results = await runChecks(requiredChecks(allChecks(), checkContext), checkContext);
|
|
433
|
+
for (const result of results) {
|
|
434
|
+
context.journal.line(`${result.status} ${result.id}: ${result.detail}`);
|
|
435
|
+
}
|
|
436
|
+
// #396: a missing database is a QUESTION, and `ensure-database` asks
|
|
437
|
+
// it -- after `validate-environment`, with the settings the wizard
|
|
438
|
+
// actually wrote. The one case decided HERE is the one whose answer is
|
|
439
|
+
// already certain: nobody can be asked (--non-interactive, no
|
|
440
|
+
// terminal) and --create-database was not given, so the install is
|
|
441
|
+
// bound to stop at `ensure-database` -- and stopping now spares the
|
|
442
|
+
// clone. Only when the settings are knowable before checkout (a
|
|
443
|
+
// re-install's `.env`, or answers naming every POSTGRES_* key); on a
|
|
444
|
+
// first install that leaves one to the template, the refusal still
|
|
445
|
+
// comes from `ensure-database`, before anything is built or migrated.
|
|
446
|
+
// Never prompts: an interactive run is asked later, once.
|
|
447
|
+
const databaseRefusal = await preflightDatabaseRefusal(context);
|
|
448
|
+
if (!checksPassed(results) || databaseRefusal !== undefined) {
|
|
449
|
+
const failed = results.filter((result) => result.status === 'fail');
|
|
450
|
+
// Aborts BEFORE anything is cloned or written.
|
|
451
|
+
throw new PreconditionError(`Prerequisites not met:\n` +
|
|
452
|
+
[
|
|
453
|
+
...failed.map((result) => ` - ${result.id}: ${result.detail}\n ${result.remedy ?? ''}`),
|
|
454
|
+
...(databaseRefusal === undefined
|
|
455
|
+
? []
|
|
456
|
+
: [` - database-exists: ${databaseRefusal.message.split('\n').join('\n ')}`]),
|
|
457
|
+
].join('\n') +
|
|
458
|
+
`\nRun \`${cliName()} deploy doctor\` for the full report.`);
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
id: 'checkout',
|
|
464
|
+
title: 'Fetch the application',
|
|
465
|
+
async run(context) {
|
|
466
|
+
const target = await resolveRepoTarget({
|
|
467
|
+
cwd: context.options.cwd ?? process.cwd(),
|
|
468
|
+
runCommand: context.runCommand,
|
|
469
|
+
...(context.options.repo === undefined ? {} : { repoFlag: context.options.repo }),
|
|
470
|
+
...(context.options.ref === undefined ? {} : { refFlag: context.options.ref }),
|
|
471
|
+
});
|
|
472
|
+
context.journal.line(`Deploying ${target.url} @ ${target.ref} (${target.source})`);
|
|
473
|
+
const checkout = await ensureCheckout(target, {
|
|
474
|
+
deployRoot: context.options.deployRoot,
|
|
475
|
+
runCommand: context.runCommand,
|
|
476
|
+
...(context.hooks === undefined ? {} : { hooks: context.hooks }),
|
|
477
|
+
...(context.options.force === undefined ? {} : { force: context.options.force }),
|
|
478
|
+
});
|
|
479
|
+
context.target = target;
|
|
480
|
+
context.checkoutPath = checkout.path;
|
|
481
|
+
context.commitSha = checkout.sha;
|
|
482
|
+
context.journal.line(`Checked out ${checkout.sha}`);
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
id: 'environment',
|
|
487
|
+
title: 'Configure the environment',
|
|
488
|
+
async run(context) {
|
|
489
|
+
const templatePath = join(context.options.deployRoot, 'repo', 'infra', 'compose', '.env.example');
|
|
490
|
+
const specs = parseEnvExample(readFileSync(templatePath, 'utf8'));
|
|
491
|
+
const path = envFilePath(context.options.deployRoot);
|
|
492
|
+
// On disk, with the caller's non-blank answers over it -- see
|
|
493
|
+
// plannedEnvironment for why a blank answer is not an answer.
|
|
494
|
+
const existing = plannedEnvironment(context.options);
|
|
495
|
+
const domain = context.options.domain;
|
|
496
|
+
if (domain === undefined && context.options.skipProxy !== true) {
|
|
497
|
+
throw new UsageError('A domain is required so APP_URL and the OAuth callback can be derived. Pass --domain.');
|
|
498
|
+
}
|
|
499
|
+
// #980: an explicitly named administrative login (--admin-user) is the
|
|
500
|
+
// one that provisions; POSTGRES_USER / POSTGRES_PASSWORD are then the
|
|
501
|
+
// APPLICATION's, decided below, and not asked.
|
|
502
|
+
const admin = await resolveAdminLogin(context.options, {
|
|
503
|
+
promptContext: context.options.promptContext,
|
|
504
|
+
nonInteractive: context.options.nonInteractive,
|
|
505
|
+
});
|
|
506
|
+
const onDisk = existsSync(path) ? parseEnvFile(readFileSync(path, 'utf8')) : undefined;
|
|
507
|
+
// #1027: a free host port for every published-port variable nobody gave a
|
|
508
|
+
// value (the default may be another app's). Decided BEFORE the wizard so
|
|
509
|
+
// `--all` shows the pick as the default to accept or change, and an
|
|
510
|
+
// answer or an existing `.env` value is never overridden.
|
|
511
|
+
const withPorts = await withFreePorts(context, specs, existing);
|
|
512
|
+
const { values } = await runEnvWizard({
|
|
513
|
+
specs,
|
|
514
|
+
// With --skip-proxy and no --domain there is no public hostname to
|
|
515
|
+
// derive from, and localhost is the honest stand-in: APP_URL and the
|
|
516
|
+
// OAuth callback then point where the stack actually answers.
|
|
517
|
+
domain: domain ?? 'localhost',
|
|
518
|
+
...(admin === undefined || context.options.skipRoleProvisioning === true
|
|
519
|
+
? context.options.skipRoleProvisioning === true
|
|
520
|
+
? {}
|
|
521
|
+
: { metadata: loginHelpMetadata }
|
|
522
|
+
: {
|
|
523
|
+
metadata: provisioningMetadata(plannedRoleName({
|
|
524
|
+
flag: context.options.appDbUser,
|
|
525
|
+
recordedUser: onDisk?.get('POSTGRES_USER'),
|
|
526
|
+
adminUser: admin.user,
|
|
527
|
+
})),
|
|
528
|
+
}),
|
|
529
|
+
...(withPorts === undefined ? {} : { existing: withPorts }),
|
|
530
|
+
...(context.options.all === undefined ? {} : { all: context.options.all }),
|
|
531
|
+
...(context.options.nonInteractive === undefined
|
|
532
|
+
? {}
|
|
533
|
+
: { nonInteractive: context.options.nonInteractive }),
|
|
534
|
+
...(context.options.groups === undefined ? {} : { groups: context.options.groups }),
|
|
535
|
+
...(context.options.promptContext === undefined
|
|
536
|
+
? {}
|
|
537
|
+
: { ctx: context.options.promptContext }),
|
|
538
|
+
});
|
|
539
|
+
values.set('APP_BIND_PORT', String(context.options.bindPort));
|
|
540
|
+
// ⚠ THE CLI'S OWN KEY, AND THE BIND MOUNT DOES NOT WORK WITHOUT IT.
|
|
541
|
+
//
|
|
542
|
+
// `DEPLOY_ROOT` was READ in three places and written in none:
|
|
543
|
+
//
|
|
544
|
+
// - `vps.compose.yml` interpolates it for the deploy-info bind mount
|
|
545
|
+
// source. Unset, it falls back to `./.deploy/deploy-info` --
|
|
546
|
+
// relative to the compose directory -- so the api container mounts
|
|
547
|
+
// an empty directory Docker created, and the About page reports
|
|
548
|
+
// `absent` for ever. Every step still reports green, because the
|
|
549
|
+
// stack is up and the fallback path is perfectly valid.
|
|
550
|
+
// - `layout.ts` uses it as the marker identifying an `.env` THIS CLI
|
|
551
|
+
// wrote, so `deploy list` and the ambiguity refusal labelled every
|
|
552
|
+
// deployment we had written as unmarked.
|
|
553
|
+
// - `version-step.ts`'s comment describes it as already being there.
|
|
554
|
+
//
|
|
555
|
+
// It is deliberately absent from `.env.example` -- that is what makes
|
|
556
|
+
// it a usable marker, since a stranger's file cannot have it -- so it
|
|
557
|
+
// lands under the serializer's own `# Not in .env.example` banner.
|
|
558
|
+
//
|
|
559
|
+
// ⚠ `COMPOSE_PROJECT_NAME` is deliberately NOT written here. The
|
|
560
|
+
// project name reaches compose through `-p` on every invocation this
|
|
561
|
+
// CLI makes, and writing it into an EXISTING deployment's `.env`
|
|
562
|
+
// renames the project: compose then sees no existing containers,
|
|
563
|
+
// builds a parallel stack, and collides with the old one on the bind
|
|
564
|
+
// port. That is an outage caused by a bookkeeping change, and `-p`
|
|
565
|
+
// already solves the problem it would solve.
|
|
566
|
+
values.set('DEPLOY_ROOT', context.options.deployRoot);
|
|
567
|
+
// ⚠ BEFORE ANYTHING USES THEM, and BEFORE the provisioning below replaces
|
|
568
|
+
// the login the operator typed: the redactor learns the entered password
|
|
569
|
+
// (it may be an administrator's) and the administrative one, so no line
|
|
570
|
+
// of this run can carry either.
|
|
571
|
+
context.journal.addSecrets([
|
|
572
|
+
...secretsFrom(values),
|
|
573
|
+
...(admin === undefined ? [] : [{ key: 'DB_ADMIN_PASSWORD', value: admin.password }]),
|
|
574
|
+
]);
|
|
575
|
+
// #980: the API must not run as the operator's (often superuser) login.
|
|
576
|
+
// Detect a privileged one, offer a dedicated role, provision it with the
|
|
577
|
+
// login used ONCE and held in memory, and write the role's generated
|
|
578
|
+
// credentials instead. The administrator never reaches `.env`.
|
|
579
|
+
//
|
|
580
|
+
// ⚠ THE STORE IS WRITTEN BEFORE THE SERVER'S PASSWORD CHANGES, and put
|
|
581
|
+
// back if that fails: `values` is complete here (APP_BIND_PORT and
|
|
582
|
+
// DEPLOY_ROOT are set above), so what lands on disk first is a whole
|
|
583
|
+
// `.env`, not a fragment.
|
|
584
|
+
const previousEnvironment = existsSync(path) ? readFileSync(path, 'utf8') : undefined;
|
|
585
|
+
const role = await ensureApplicationRole({
|
|
586
|
+
env: values,
|
|
587
|
+
...(onDisk === undefined ? {} : { recordedEnv: onDisk }),
|
|
588
|
+
runCommand: context.runCommand,
|
|
589
|
+
onLine: (line) => context.journal.line(line),
|
|
590
|
+
onSecrets: (secrets) => context.journal.addSecrets(secrets),
|
|
591
|
+
store: {
|
|
592
|
+
write: (credentials) => {
|
|
593
|
+
values.set('POSTGRES_USER', credentials.user);
|
|
594
|
+
values.set('POSTGRES_PASSWORD', credentials.password);
|
|
595
|
+
mkdirSync(composeCwd(context.options.deployRoot), { recursive: true });
|
|
596
|
+
writeEnvFile(path, values, specs);
|
|
597
|
+
},
|
|
598
|
+
restore: () => {
|
|
599
|
+
if (previousEnvironment === undefined)
|
|
600
|
+
rmSync(path, { force: true });
|
|
601
|
+
else
|
|
602
|
+
writeEnvContents(path, previousEnvironment);
|
|
603
|
+
},
|
|
604
|
+
},
|
|
605
|
+
whenNotConsented: 'refuse',
|
|
606
|
+
...roleOptionsFrom(context.options, admin),
|
|
607
|
+
});
|
|
608
|
+
context.journal.line(`Database role: ${role.outcome}: ${role.detail}`);
|
|
609
|
+
if (role.outcome === 'superuser-allowed') {
|
|
610
|
+
const warning = `warning: --allow-superuser: ${values.get('POSTGRES_USER') ?? 'the database login'} bypasses row-level security. Tenant isolation is OFF.`;
|
|
611
|
+
context.journal.line(warning);
|
|
612
|
+
context.hooks?.onProgress?.(warning);
|
|
613
|
+
context.superuserKept = values.get('POSTGRES_USER');
|
|
614
|
+
}
|
|
615
|
+
if (role.credentials !== undefined) {
|
|
616
|
+
values.set('POSTGRES_USER', role.credentials.user);
|
|
617
|
+
values.set('POSTGRES_PASSWORD', role.credentials.password);
|
|
618
|
+
context.appCredentials = role.credentials;
|
|
619
|
+
context.hooks?.onProgress?.(`Database role "${role.credentials.user}" is ready; its generated password is saved to .env only.`);
|
|
620
|
+
}
|
|
621
|
+
mkdirSync(composeCwd(context.options.deployRoot), { recursive: true });
|
|
622
|
+
writeEnvFile(path, values, specs);
|
|
623
|
+
context.env = values;
|
|
624
|
+
// ⚠ BEFORE ANYTHING USES THEM. A fresh install's journal was opened
|
|
625
|
+
// with no secrets (there was no .env to seed it from); the OAuth probe
|
|
626
|
+
// in the next step sends GOOGLE_CLIENT_SECRET over the network, and an
|
|
627
|
+
// error quoting the request must not put it in the log.
|
|
628
|
+
context.journal.addSecrets(secretsFrom(values));
|
|
629
|
+
context.journal.line(`Wrote ${path} (${values.size} variables)`);
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
id: 'validate-environment',
|
|
634
|
+
title: 'Validate the environment',
|
|
635
|
+
async run(context) {
|
|
636
|
+
if (context.env === undefined)
|
|
637
|
+
return;
|
|
638
|
+
const results = await runChecks(allChecks().filter((check) => check.id.startsWith('database-')), {
|
|
639
|
+
runCommand: context.runCommand,
|
|
640
|
+
deployRoot: context.options.deployRoot,
|
|
641
|
+
bindPort: context.options.bindPort,
|
|
642
|
+
composeProject: context.composeProject,
|
|
643
|
+
proxyRoot: context.options.proxyRoot,
|
|
644
|
+
env: context.env,
|
|
645
|
+
...(context.options.allowSuperuser === true ? { allowSuperuser: true } : {}),
|
|
646
|
+
});
|
|
647
|
+
for (const result of results) {
|
|
648
|
+
context.journal.line(`${result.status} ${result.id}: ${result.detail}`);
|
|
649
|
+
// A warned `database-role-ordinary` is --allow-superuser: say it on screen too.
|
|
650
|
+
if (result.id === 'database-role-ordinary' && result.status === 'warn') {
|
|
651
|
+
context.hooks?.onProgress?.(`warning: ${result.detail}`);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
if (checksPassed(results)) {
|
|
655
|
+
context.database = 'exists';
|
|
656
|
+
}
|
|
657
|
+
else if (onlyDatabaseMissing(results)) {
|
|
658
|
+
// #391: the ONE failure `ensure-database` may act on -- reachable,
|
|
659
|
+
// authenticated, and only the database itself absent. Deferred, not
|
|
660
|
+
// thrown; every other failure still stops the install right here.
|
|
661
|
+
context.database = 'missing';
|
|
662
|
+
context.journal.line('The database does not exist yet; ensure-database decides what to do about it.');
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
throw new PreconditionError(`The database is not usable with these settings:\n` +
|
|
666
|
+
results
|
|
667
|
+
.filter((result) => result.status === 'fail')
|
|
668
|
+
.map((result) => ` - ${result.detail}\n ${result.remedy ?? ''}`)
|
|
669
|
+
.join('\n'));
|
|
670
|
+
}
|
|
671
|
+
// #391: the OAuth credentials, BEFORE the build -- a wrong secret was
|
|
672
|
+
// otherwise found by the first user to sign in, after everything.
|
|
673
|
+
const oauth = await runOAuthCheck({
|
|
674
|
+
env: context.env,
|
|
675
|
+
...(context.options.domain === undefined ? {} : { domain: context.options.domain }),
|
|
676
|
+
skipLiveProbe: context.options.skipOAuthCheck === true,
|
|
677
|
+
...(context.options.fetch === undefined ? {} : { fetch: context.options.fetch }),
|
|
678
|
+
});
|
|
679
|
+
for (const finding of oauth.findings) {
|
|
680
|
+
context.journal.line(`${finding.status} ${finding.id}: ${finding.detail}`);
|
|
681
|
+
if (finding.status === 'warn') {
|
|
682
|
+
context.hooks?.onProgress?.(`warning: ${finding.detail}`);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
if (!oauth.ok) {
|
|
686
|
+
throw new PreconditionError('The Google OAuth settings would fail every sign-in:\n' +
|
|
687
|
+
oauth.findings
|
|
688
|
+
.filter((finding) => finding.status === 'fail')
|
|
689
|
+
.map((finding) => ` - ${finding.detail}\n ${finding.remedy ?? ''}`)
|
|
690
|
+
.join('\n') +
|
|
691
|
+
'\nFix them in the environment file (or pass --skip-oauth-check for placeholder credentials), then re-run with --resume.');
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
// ⚠ NOT SKIPPABLE: --skip-doctor skips the preflight, and a resumed run
|
|
697
|
+
// skips every step the last one finished; neither may let a clashing host
|
|
698
|
+
// port through to `start`, whose `up -d` would recreate a running
|
|
699
|
+
// reinstall and then die on the port. The preflight above could not
|
|
700
|
+
// render the stack (no checkout, no `.env` yet); this step can. (#1024)
|
|
701
|
+
id: STACK_PORTS_STEP_ID,
|
|
702
|
+
title: 'Check the ports the stack publishes',
|
|
703
|
+
async run(context) {
|
|
704
|
+
await assertStackPortsFree({
|
|
705
|
+
context: {
|
|
706
|
+
runCommand: context.runCommand,
|
|
707
|
+
deployRoot: context.options.deployRoot,
|
|
708
|
+
bindPort: context.options.bindPort,
|
|
709
|
+
composeProject: context.composeProject,
|
|
710
|
+
groups: context.options.groups,
|
|
711
|
+
proxyRoot: context.options.proxyRoot,
|
|
712
|
+
...(context.options.portFree === undefined ? {} : { portFree: context.options.portFree }),
|
|
713
|
+
},
|
|
714
|
+
line: (text) => context.journal.line(text),
|
|
715
|
+
warn: (text) => context.hooks?.onProgress?.(text),
|
|
716
|
+
});
|
|
717
|
+
},
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
id: 'ensure-database',
|
|
721
|
+
title: 'Make sure the database exists',
|
|
722
|
+
async run(context) {
|
|
723
|
+
// Already known to exist: no second round of psql containers.
|
|
724
|
+
if (context.database === 'exists')
|
|
725
|
+
return;
|
|
726
|
+
const env = environmentOf(context);
|
|
727
|
+
if (env === undefined) {
|
|
728
|
+
context.journal.line('No environment file; nothing to check.');
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
// #396: the one "offer, create, re-verify" implementation -- see
|
|
732
|
+
// ensureDatabase's own comment.
|
|
733
|
+
const result = await ensureDatabase({
|
|
734
|
+
env,
|
|
735
|
+
runCommand: context.runCommand,
|
|
736
|
+
createDatabase: context.options.createDatabase,
|
|
737
|
+
...(context.options.allowSuperuser === true ? { allowSuperuser: true } : {}),
|
|
738
|
+
...consentOptions(context),
|
|
739
|
+
envPath: envFilePath(context.options.deployRoot),
|
|
740
|
+
onLine: (line) => context.journal.line(line),
|
|
741
|
+
});
|
|
742
|
+
context.database = 'exists';
|
|
743
|
+
context.journal.line(result.detail);
|
|
744
|
+
if (result.outcome === 'created')
|
|
745
|
+
context.hooks?.onProgress?.(result.detail);
|
|
746
|
+
},
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
id: 'version',
|
|
750
|
+
title: 'Choose the release version',
|
|
751
|
+
// ⚠ NO `skip` FOR --no-version-bump. The flag means "do not bump", not
|
|
752
|
+
// "do not stamp": the step still writes the clone's CURRENT version into
|
|
753
|
+
// the `.env`, because skipping it entirely would leave the container
|
|
754
|
+
// reporting whatever APP_VERSION the last deploy happened to set.
|
|
755
|
+
async run(context) {
|
|
756
|
+
// ⚠ IMMEDIATELY BEFORE `build`, AND IT COMMITS. The checkout step
|
|
757
|
+
// refuses a dirty tree, so leaving manifests dirty across a
|
|
758
|
+
// four-minute build would wedge the NEXT update behind a refusal about
|
|
759
|
+
// files the operator never touched. See version-step.ts's header.
|
|
760
|
+
const result = await runVersionStep({
|
|
761
|
+
checkoutPath: checkoutPathFor(context.options.deployRoot),
|
|
762
|
+
...(context.options.appVersion === undefined
|
|
763
|
+
? {}
|
|
764
|
+
: { requested: context.options.appVersion }),
|
|
765
|
+
...(context.options.noVersionBump === undefined
|
|
766
|
+
? {}
|
|
767
|
+
: { disabled: context.options.noVersionBump }),
|
|
768
|
+
runCommand: context.runCommand,
|
|
769
|
+
});
|
|
770
|
+
context.version = result;
|
|
771
|
+
context.journal.line(`Version: ${result.detail}`);
|
|
772
|
+
// ⚠ The DEPLOYED COMMIT IS THE BUMP COMMIT. Recording the pre-bump one
|
|
773
|
+
// leaves every server reporting itself a commit behind for ever,
|
|
774
|
+
// rebuilding identical code and bumping again on every update. It is
|
|
775
|
+
// also more accurate: the commit happens before `build`, so the images
|
|
776
|
+
// really were built with HEAD here.
|
|
777
|
+
if (result.commitSha !== undefined)
|
|
778
|
+
context.commitSha = result.commitSha;
|
|
779
|
+
// ⚠ STAMPED ON DISK, NOT JUST IN MEMORY. `context.env` is the wizard's
|
|
780
|
+
// map and nothing writes it again after the `environment` step, so an
|
|
781
|
+
// in-memory set alone would leave the running container on whatever
|
|
782
|
+
// APP_VERSION the last deploy wrote. The disk write is what the build
|
|
783
|
+
// and the api container actually read.
|
|
784
|
+
const stamped = stampAppVersion(envFilePath(context.options.deployRoot), join(composeCwd(context.options.deployRoot), '.env.example'), result.version);
|
|
785
|
+
context.env?.set('APP_VERSION', result.version);
|
|
786
|
+
if (!stamped) {
|
|
787
|
+
context.journal.line('APP_VERSION was not stamped: no .env on disk yet.');
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
id: 'build',
|
|
793
|
+
title: 'Build images',
|
|
794
|
+
async run(context) {
|
|
795
|
+
await compose(context, [
|
|
796
|
+
'build',
|
|
797
|
+
...(context.options.noCache === true ? ['--no-cache'] : []),
|
|
798
|
+
]);
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
id: 'migrate',
|
|
803
|
+
title: 'Apply migrations',
|
|
804
|
+
async run(context) {
|
|
805
|
+
// `run --rm` rather than `exec`: the stack is not up yet, and this must
|
|
806
|
+
// not depend on the api container already running.
|
|
807
|
+
await compose(context, [
|
|
808
|
+
'run', '--rm', '--no-deps', 'api',
|
|
809
|
+
'npm', 'run', 'prisma:migrate',
|
|
810
|
+
], { timeoutMs: 10 * 60_000 });
|
|
811
|
+
},
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
id: 'seed',
|
|
815
|
+
title: 'Seed roles and permissions',
|
|
816
|
+
skip: (context) => context.options.skipSeed === true ? 'skipped with --skip-seed' : undefined,
|
|
817
|
+
async run(context) {
|
|
818
|
+
await compose(context, [
|
|
819
|
+
'run', '--rm', '--no-deps', 'api',
|
|
820
|
+
'npm', 'run', 'prisma:seed',
|
|
821
|
+
], { timeoutMs: 10 * 60_000 });
|
|
822
|
+
},
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
id: 'start',
|
|
826
|
+
title: 'Start the stack',
|
|
827
|
+
async run(context) {
|
|
828
|
+
// The bind sources are created by `ensureBindSources`, which runs
|
|
829
|
+
// before EVERY compose invocation -- see its header for why doing it
|
|
830
|
+
// here, one step before `up`, was not enough.
|
|
831
|
+
await compose(context, ['up', '-d']);
|
|
832
|
+
},
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
id: 'health',
|
|
836
|
+
title: 'Wait for the API',
|
|
837
|
+
async run(context) {
|
|
838
|
+
const probe = await waitForHealthy({
|
|
839
|
+
runCommand: context.runCommand,
|
|
840
|
+
deployRoot: context.options.deployRoot,
|
|
841
|
+
bindPort: context.options.bindPort,
|
|
842
|
+
...(context.composeProject === undefined
|
|
843
|
+
? {}
|
|
844
|
+
: { composeProject: context.composeProject }),
|
|
845
|
+
...(context.hooks === undefined ? {} : { hooks: context.hooks }),
|
|
846
|
+
});
|
|
847
|
+
if (!probe.ok) {
|
|
848
|
+
throw new Error(`The API did not become ready: ${probe.error ?? `HTTP ${probe.status ?? '?'}`}`);
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
id: 'deploy-info',
|
|
854
|
+
title: 'Record what was deployed',
|
|
855
|
+
async run(context) {
|
|
856
|
+
// ⚠ IMMEDIATELY AFTER `health`, NOT AT THE END. If the API is
|
|
857
|
+
// answering, the application demonstrably IS deployed and the About
|
|
858
|
+
// page should say so. Written at the end, a failure in `publish` --
|
|
859
|
+
// which runs between here and there -- would leave that page reporting
|
|
860
|
+
// nothing at all about a deployment that is up and serving, which is
|
|
861
|
+
// exactly when somebody is looking at it.
|
|
862
|
+
//
|
|
863
|
+
// ⚠ AND REWRITTEN AT THE END of a successful run (see `runInstall`),
|
|
864
|
+
// which is the only point at which this run's history entry and a
|
|
865
|
+
// freshly read certificate expiry exist. This write describes what is
|
|
866
|
+
// answering NOW; that one supersedes it with the finished run.
|
|
867
|
+
await hostFactsOf(context);
|
|
868
|
+
const result = writeDeployInfo(context.options.deployRoot, installDeployInfo(context, new Date().toISOString()));
|
|
869
|
+
// ⚠ BOOKKEEPING, NOT THE DEPLOYMENT. By this point the stack is up and
|
|
870
|
+
// answering; a file this CLI could not write is a warning, never a
|
|
871
|
+
// failure that undoes a successful deploy.
|
|
872
|
+
context.journal.line(result.written
|
|
873
|
+
? `Wrote ${result.path}`
|
|
874
|
+
: `warning: could not write ${result.path}: ${result.error ?? 'unknown'}`);
|
|
875
|
+
if (!result.written) {
|
|
876
|
+
context.hooks?.onProgress?.(`warning: deployment record not written (${result.error ?? 'unknown'})`);
|
|
877
|
+
}
|
|
878
|
+
},
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
id: 'proxy-bootstrap',
|
|
882
|
+
title: 'Make sure the shared proxy is running',
|
|
883
|
+
skip: (context) => {
|
|
884
|
+
if (context.options.skipProxy === true)
|
|
885
|
+
return 'skipped with --skip-proxy';
|
|
886
|
+
if (context.options.domain === undefined)
|
|
887
|
+
return 'no --domain given';
|
|
888
|
+
return undefined;
|
|
889
|
+
},
|
|
890
|
+
async run(context) {
|
|
891
|
+
const runtime = await proxyRuntimeOf(context);
|
|
892
|
+
if (runtime.mode !== 'container') {
|
|
893
|
+
context.journal.line('The proxy runs on the host; it is the host\'s to run, and nothing is bootstrapped.');
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
const proxyRoot = context.options.proxyRoot;
|
|
897
|
+
const presence = await inspectProxy({
|
|
898
|
+
proxyRoot,
|
|
899
|
+
runtime,
|
|
900
|
+
runCommand: context.runCommand,
|
|
901
|
+
});
|
|
902
|
+
context.journal.line(presence.detail);
|
|
903
|
+
switch (presence.state) {
|
|
904
|
+
case 'running':
|
|
905
|
+
// The ordinary case on every deployment after a box's first.
|
|
906
|
+
return;
|
|
907
|
+
case 'stopped':
|
|
908
|
+
// ⚠ NOT STARTED FOR THEM. It is shared, and somebody stopped it --
|
|
909
|
+
// possibly on purpose. Say so and let them decide.
|
|
910
|
+
throw new PreconditionError(`The shared proxy container ${runtime.container} exists but is stopped. It is shared infrastructure, so ` +
|
|
911
|
+
`this install will not start it. Start it: docker start ${runtime.container} (or: cd ${proxyRoot} && docker compose up -d), then re-run with --resume.`);
|
|
912
|
+
case 'configured':
|
|
913
|
+
throw new PreconditionError(`${presence.detail}. That proxy belongs to whatever created it, so this install will not touch it. ` +
|
|
914
|
+
`Start it: cd ${proxyRoot} && docker compose up -d -- or, if its container has another name, pass --proxy-container <name>. Then re-run with --resume.`);
|
|
915
|
+
case 'unknown':
|
|
916
|
+
throw new PreconditionError(`${presence.detail}. Check it by hand: docker inspect ${runtime.container}`);
|
|
917
|
+
case 'absent':
|
|
918
|
+
break;
|
|
919
|
+
}
|
|
920
|
+
// Asked once: preflight's answer, when it asked; otherwise now (a
|
|
921
|
+
// resumed run, or --skip-doctor). A "no" is not asked twice.
|
|
922
|
+
const consent = context.proxyBootstrapConsent ??
|
|
923
|
+
(await obtainConsent(bootstrapQuestion(proxyRoot, runtime.container), consentOptions(context, context.options.bootstrapProxy)));
|
|
924
|
+
if (!consented(consent))
|
|
925
|
+
throw bootstrapRefusal(consent, proxyRoot);
|
|
926
|
+
const composeDir = composeCwd(context.options.deployRoot);
|
|
927
|
+
const result = await bootstrapProxy({
|
|
928
|
+
proxyRoot,
|
|
929
|
+
runtime,
|
|
930
|
+
runCommand: context.runCommand,
|
|
931
|
+
hooks: context.hooks,
|
|
932
|
+
// The networks the APPLICATION's compose files declare external,
|
|
933
|
+
// read from the checkout -- never a name this CLI makes up.
|
|
934
|
+
networks: externalNetworksIn(composeFilesFor(context.options.groups, composeDir).map((file) => join(composeDir, file))),
|
|
935
|
+
onLine: (line) => context.journal.line(line),
|
|
936
|
+
});
|
|
937
|
+
context.hooks?.onProgress?.(`Created the shared proxy in ${proxyRoot} (${result.created.length} file(s)/directories)`);
|
|
938
|
+
},
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
id: 'publish',
|
|
942
|
+
title: 'Publish over HTTPS',
|
|
943
|
+
skip: (context) => {
|
|
944
|
+
if (context.options.skipProxy === true)
|
|
945
|
+
return 'skipped with --skip-proxy';
|
|
946
|
+
if (context.options.domain === undefined)
|
|
947
|
+
return 'no --domain given';
|
|
948
|
+
return undefined;
|
|
949
|
+
},
|
|
950
|
+
async run(context) {
|
|
951
|
+
const target = {
|
|
952
|
+
domain: context.options.domain,
|
|
953
|
+
bindPort: context.options.bindPort,
|
|
954
|
+
proxyRoot: context.options.proxyRoot,
|
|
955
|
+
};
|
|
956
|
+
const email = context.options.email ?? context.env?.get('INITIAL_ADMIN_EMAIL') ?? '';
|
|
957
|
+
if (email === '') {
|
|
958
|
+
throw new UsageError('A registration email is required for the certificate. Pass --email, or set INITIAL_ADMIN_EMAIL.');
|
|
959
|
+
}
|
|
960
|
+
const runtime = await proxyRuntimeOf(context);
|
|
961
|
+
// Certificate FIRST. See rule 4 in the header.
|
|
962
|
+
const cert = await issueCertificate(target, {
|
|
963
|
+
runCommand: context.runCommand,
|
|
964
|
+
runtime,
|
|
965
|
+
email,
|
|
966
|
+
...(context.options.staging === undefined ? {} : { staging: context.options.staging }),
|
|
967
|
+
...(context.hooks === undefined ? {} : { hooks: context.hooks }),
|
|
968
|
+
});
|
|
969
|
+
await installVhost(target, {
|
|
970
|
+
runCommand: context.runCommand,
|
|
971
|
+
// Paths in the vhost, and where `nginx -t` / the reload run, both
|
|
972
|
+
// come from here. Omitting it is the host-binary assumption.
|
|
973
|
+
runtime,
|
|
974
|
+
...(context.hooks === undefined ? {} : { hooks: context.hooks }),
|
|
975
|
+
...(context.env?.get('MAX_FILE_SIZE') === undefined
|
|
976
|
+
? {}
|
|
977
|
+
: { maxBodyBytes: Number(context.env.get('MAX_FILE_SIZE')) }),
|
|
978
|
+
// A (re)issued certificate never changes the vhost TEXT -- same
|
|
979
|
+
// domain, same path -- so the ordinary "already current" fast path
|
|
980
|
+
// would never reload nginx and the new certificate would sit on
|
|
981
|
+
// disk, unserved, forever (issue #640).
|
|
982
|
+
forceReload: cert.issued,
|
|
983
|
+
});
|
|
984
|
+
},
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
id: 'renewal',
|
|
988
|
+
title: 'Schedule certificate renewal',
|
|
989
|
+
skip: (context) => {
|
|
990
|
+
if (context.options.skipRenewal === true)
|
|
991
|
+
return 'skipped with --skip-renewal';
|
|
992
|
+
if (context.options.skipProxy === true)
|
|
993
|
+
return 'skipped with --skip-proxy';
|
|
994
|
+
if (context.options.domain === undefined)
|
|
995
|
+
return 'no --domain given';
|
|
996
|
+
return undefined;
|
|
997
|
+
},
|
|
998
|
+
async run(context) {
|
|
999
|
+
const proxyRoot = context.options.proxyRoot;
|
|
1000
|
+
const status = certificateStatus({
|
|
1001
|
+
domain: context.options.domain,
|
|
1002
|
+
bindPort: context.options.bindPort,
|
|
1003
|
+
proxyRoot,
|
|
1004
|
+
});
|
|
1005
|
+
if (!status.exists) {
|
|
1006
|
+
context.journal.line(`No certificate at ${status.path}; nothing to renew yet.`);
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
await scheduleRenewal(context, proxyRoot, await proxyRuntimeOf(context));
|
|
1010
|
+
},
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
id: 'verify',
|
|
1014
|
+
title: 'Verify the deployment',
|
|
1015
|
+
async run(context) {
|
|
1016
|
+
const report = await collectHealth({
|
|
1017
|
+
runCommand: context.runCommand,
|
|
1018
|
+
deployRoot: context.options.deployRoot,
|
|
1019
|
+
bindPort: context.options.bindPort,
|
|
1020
|
+
...(context.composeProject === undefined
|
|
1021
|
+
? {}
|
|
1022
|
+
: { composeProject: context.composeProject }),
|
|
1023
|
+
...(context.options.domain === undefined || context.options.skipProxy === true
|
|
1024
|
+
? {}
|
|
1025
|
+
: { domain: context.options.domain }),
|
|
1026
|
+
...(context.options.fetch === undefined ? {} : { fetch: context.options.fetch }),
|
|
1027
|
+
...oauthSmokeTarget(context.options.skipOAuthCheck, environmentOf(context)),
|
|
1028
|
+
...(context.options.groups === undefined ? {} : { groups: context.options.groups }),
|
|
1029
|
+
});
|
|
1030
|
+
context.journal.line(`containers=${report.containers.length} ready=${report.local.ready.ok} frontend=${report.local.frontend.ok} migrations=${report.migrations.known ? report.migrations.pending.length : 'unknown'}`);
|
|
1031
|
+
if (!isHealthy(report)) {
|
|
1032
|
+
// The external HTTPS probe is the one check that can fail for a
|
|
1033
|
+
// reason `deploy status` does not specifically diagnose: the proxy
|
|
1034
|
+
// serving a different certificate than the one on disk (#640,
|
|
1035
|
+
// #642) -- `deploy certs` is the command that actually compares
|
|
1036
|
+
// them and names the exact remedy for this deployment's runtime.
|
|
1037
|
+
const certHint = report.external !== undefined && !report.external.probe.ok
|
|
1038
|
+
? ` If the domain shows a certificate/SSL error in a browser, run \`${cliName()} deploy certs --domain ${context.options.domain}\` to check whether the proxy needs reloading.`
|
|
1039
|
+
: '';
|
|
1040
|
+
throw new Error('The stack is up but not healthy. Run `' +
|
|
1041
|
+
cliName() +
|
|
1042
|
+
' deploy status` for the detail.' +
|
|
1043
|
+
certHint);
|
|
1044
|
+
}
|
|
1045
|
+
reportOAuthSmoke(context, report.oauth);
|
|
1046
|
+
},
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
id: 'publish-version',
|
|
1050
|
+
title: 'Publish the release version',
|
|
1051
|
+
skip: (context) => context.version?.bumped === true ? undefined : 'no version was bumped',
|
|
1052
|
+
async run(context) {
|
|
1053
|
+
// ⚠ PUSH LAST, AFTER VERIFY -- not at the health gate. Pushing to a
|
|
1054
|
+
// shared repository is irreversible and externally visible: a version
|
|
1055
|
+
// not pushed is re-derived next run, while a version pushed for a
|
|
1056
|
+
// deploy that did not finish is a commit someone has to reason about.
|
|
1057
|
+
const result = await publishVersion({
|
|
1058
|
+
checkoutPath: checkoutPathFor(context.options.deployRoot),
|
|
1059
|
+
ref: context.target?.ref ?? 'main',
|
|
1060
|
+
result: context.version,
|
|
1061
|
+
runCommand: context.runCommand,
|
|
1062
|
+
});
|
|
1063
|
+
// ⚠ A FAILED PUSH IS A WARNING, NEVER A FAILURE. By this point the app
|
|
1064
|
+
// is built, migrated, started, answering and verified. The rollback
|
|
1065
|
+
// keeps the clone level with origin; the deployment keeps the version.
|
|
1066
|
+
context.journal.line(`Publish: ${result.detail}`);
|
|
1067
|
+
if (!result.pushed)
|
|
1068
|
+
context.hooks?.onProgress?.(`warning: ${result.detail}`);
|
|
1069
|
+
},
|
|
1070
|
+
},
|
|
1071
|
+
];
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* The consent options every gate in this pipeline shares. `flag` is the one
|
|
1075
|
+
* gate-specific part.
|
|
1076
|
+
*/
|
|
1077
|
+
export function consentOptions(context, flag) {
|
|
1078
|
+
return {
|
|
1079
|
+
flag,
|
|
1080
|
+
nonInteractive: context.options.nonInteractive,
|
|
1081
|
+
promptContext: context.options.promptContext,
|
|
1082
|
+
ask: context.options.ask,
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* What the post-deploy OAuth smoke checks against, or nothing when it is
|
|
1087
|
+
* skipped or the environment names no Google client. Shared with update.
|
|
1088
|
+
*/
|
|
1089
|
+
export function oauthSmokeTarget(skip, env) {
|
|
1090
|
+
if (skip === true || env === undefined)
|
|
1091
|
+
return {};
|
|
1092
|
+
const clientId = env.get('GOOGLE_CLIENT_ID') ?? '';
|
|
1093
|
+
const callbackUrl = env.get('GOOGLE_CALLBACK_URL') ?? '';
|
|
1094
|
+
if (clientId === '' || callbackUrl === '')
|
|
1095
|
+
return {};
|
|
1096
|
+
return { oauth: { clientId, callbackUrl } };
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* What a smoke result means for a deploy (#391): `fail` fails `verify` -- the
|
|
1100
|
+
* API answered, and what it said means nobody can sign in; `warn` (the API
|
|
1101
|
+
* could not be asked) is reported and does not, since the health probes above
|
|
1102
|
+
* already judged reachability.
|
|
1103
|
+
*/
|
|
1104
|
+
export function reportOAuthSmoke(context, smoke) {
|
|
1105
|
+
if (smoke === undefined)
|
|
1106
|
+
return;
|
|
1107
|
+
context.journal.line(`${smoke.status} oauth-smoke: ${smoke.detail}`);
|
|
1108
|
+
if (smoke.status === 'warn') {
|
|
1109
|
+
context.hooks?.onProgress?.(`warning: OAuth smoke: ${smoke.detail}`);
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
if (smoke.status === 'fail') {
|
|
1113
|
+
throw new Error(`Sign-in is broken: ${smoke.detail}${smoke.remedy === undefined ? '' : `\n${smoke.remedy}`}`);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Acts on the renewal-ownership answer and reports it. Shared with update.
|
|
1118
|
+
*
|
|
1119
|
+
* ⚠ NEVER FAILS THE DEPLOY. Renewal is not the deployment: a file that could
|
|
1120
|
+
* not be written is a loud warning carrying the exact content to install.
|
|
1121
|
+
*/
|
|
1122
|
+
export async function scheduleRenewal(context, proxyRoot, runtime) {
|
|
1123
|
+
const result = await ensureRenewal({ proxyRoot, runtime, runCommand: context.runCommand });
|
|
1124
|
+
context.journal.line(`renewal ${result.action}: ${result.detail}`);
|
|
1125
|
+
if (result.action === 'not-writable') {
|
|
1126
|
+
context.journal.line(result.remedy ?? '');
|
|
1127
|
+
context.hooks?.onProgress?.(`warning: ${result.detail}`);
|
|
1128
|
+
context.hooks?.onProgress?.(result.remedy ?? '');
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
if (result.warning !== undefined) {
|
|
1132
|
+
context.hooks?.onProgress?.(`warning: ${result.warning}. ${result.remedy ?? ''}`);
|
|
1133
|
+
}
|
|
1134
|
+
context.hooks?.onProgress?.(result.detail);
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Settles `options.bindPort` BEFORE anything reads it (#1027).
|
|
1138
|
+
*
|
|
1139
|
+
* When `--port` was not passed (`bindPortIsDefault`), the default is a starting
|
|
1140
|
+
* point, not a promise: a deployment that already wrote `APP_BIND_PORT` keeps
|
|
1141
|
+
* it (a re-run must never move a port a proxy vhost and a tunnel point at), and
|
|
1142
|
+
* a fresh one walks up from the default past any port another app holds. The
|
|
1143
|
+
* result is written back into `options`, the one object every step, the
|
|
1144
|
+
* preflight, the state, the vhost, the health probe and the final summary read,
|
|
1145
|
+
* so none of them can see the default after this ran.
|
|
1146
|
+
*
|
|
1147
|
+
* Only the `.env` counts as a record here: the state's `bindPort` of a run that
|
|
1148
|
+
* failed before the environment step is a choice that was never written, and is
|
|
1149
|
+
* made again (it lands on the same port unless something took it since).
|
|
1150
|
+
*/
|
|
1151
|
+
async function settleBindPort(options, input) {
|
|
1152
|
+
if (options.bindPortIsDefault !== true)
|
|
1153
|
+
return;
|
|
1154
|
+
const path = envFilePath(options.deployRoot);
|
|
1155
|
+
const recorded = existsSync(path) ? Number(parseEnvFile(readFileSync(path, 'utf8')).get('APP_BIND_PORT')) : Number.NaN;
|
|
1156
|
+
if (isPort(recorded)) {
|
|
1157
|
+
if (recorded !== options.bindPort) {
|
|
1158
|
+
input.journal.line(`Keeping APP_BIND_PORT=${recorded} from the existing environment file (the default ${options.bindPort} was not asked for).`);
|
|
1159
|
+
options.bindPort = recorded;
|
|
1160
|
+
}
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
const containers = foreignContainers(await listComposeContainers(input.runCommand), input.project);
|
|
1164
|
+
// Any address: `bind-port-owner` counts a container that publishes the port anywhere.
|
|
1165
|
+
const pick = await pickFreePort({
|
|
1166
|
+
preferred: options.bindPort,
|
|
1167
|
+
hostIp: '',
|
|
1168
|
+
protocol: 'tcp',
|
|
1169
|
+
containers: containers ?? [],
|
|
1170
|
+
probe: options.portFree ?? isLoopbackPortFree,
|
|
1171
|
+
label: 'APP_BIND_PORT',
|
|
1172
|
+
});
|
|
1173
|
+
const message = describePick('APP_BIND_PORT', pick, options.bindPort);
|
|
1174
|
+
options.bindPort = pick.port;
|
|
1175
|
+
if (message !== undefined) {
|
|
1176
|
+
input.journal.line(`Picked a free host port: ${message}`);
|
|
1177
|
+
options.hooks?.onProgress?.(`Picked a free host port: ${message}`);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
export async function runInstall(requested) {
|
|
1181
|
+
// Every step reads `options.groups`, so widening it once here is what puts
|
|
1182
|
+
// the always-on groups (#567) into the wizard, the compose file list, the
|
|
1183
|
+
// health gate and the recorded state alike.
|
|
1184
|
+
const options = { ...requested, groups: effectiveGroups(requested.groups) };
|
|
1185
|
+
// The duration a history entry records is the whole run, precondition
|
|
1186
|
+
// checks included -- what the operator actually waited.
|
|
1187
|
+
const startedAt = Date.now();
|
|
1188
|
+
const loadedState = readState(options.deployRoot);
|
|
1189
|
+
// The mirror of the defect `update` had, and the same wrong question asked
|
|
1190
|
+
// from the other side. Guarding on the RECORD means a deployment whose state
|
|
1191
|
+
// file was lost -- containers running, certificate issued, site serving -- is
|
|
1192
|
+
// not recognised here either, so `install` proceeds and clobbers it: a fresh
|
|
1193
|
+
// checkout over the live one, a re-run wizard over the live `.env`.
|
|
1194
|
+
//
|
|
1195
|
+
// The guard is EVIDENCE OR RECORD. Either is enough to say something is
|
|
1196
|
+
// already here; requiring both would reintroduce the same gap.
|
|
1197
|
+
const alreadyDeployed = loadedState !== undefined || isDeployment(options.deployRoot);
|
|
1198
|
+
if (alreadyDeployed && options.reinstall !== true && options.resume !== true) {
|
|
1199
|
+
const at = loadedState === undefined
|
|
1200
|
+
? 'it has a checkout and an environment file, but no deployment record'
|
|
1201
|
+
: `${loadedState.commitSha.slice(0, 12)}`;
|
|
1202
|
+
throw new UsageError(`A deployment already exists at ${options.deployRoot} (${at}). Use \`${cliName()} deploy update\` to bring it up to date, or --reinstall to start over.`);
|
|
1203
|
+
}
|
|
1204
|
+
mkdirSync(options.deployRoot, { recursive: true });
|
|
1205
|
+
const journal = openJournal({
|
|
1206
|
+
deployRoot: options.deployRoot,
|
|
1207
|
+
command: 'install',
|
|
1208
|
+
// Seeded from an existing .env so a resumed run redacts from the first
|
|
1209
|
+
// line, before the wizard has run again.
|
|
1210
|
+
secrets: existsSync(envFilePath(options.deployRoot))
|
|
1211
|
+
? secretsFrom(parseEnvFile(readFileSync(envFilePath(options.deployRoot), 'utf8')))
|
|
1212
|
+
: [],
|
|
1213
|
+
});
|
|
1214
|
+
// Announced at once, so a screen can show where the log is while it runs.
|
|
1215
|
+
options.hooks?.onJournal?.(journal.path);
|
|
1216
|
+
// A FRESH install gets its own compose project; anything already here keeps
|
|
1217
|
+
// the one it is running under. See composeProjectFor for why renaming an
|
|
1218
|
+
// existing deployment's project is an outage rather than a tidy-up.
|
|
1219
|
+
const freshProject = loadedState === undefined && !isDeployment(options.deployRoot);
|
|
1220
|
+
let existingState = loadedState;
|
|
1221
|
+
let composeProject = freshProject ? freshComposeProject(options.deployRoot) : composeProjectFor(existingState);
|
|
1222
|
+
// ⚠ BEFORE ANY READER OF `options.bindPort`, the project detection below
|
|
1223
|
+
// included: see settleBindPort (#1027).
|
|
1224
|
+
await settleBindPort(options, {
|
|
1225
|
+
project: composeProject,
|
|
1226
|
+
runCommand: options.runCommand ?? defaultRunCommand,
|
|
1227
|
+
journal,
|
|
1228
|
+
});
|
|
1229
|
+
// True when the project below came from Docker for a deployment with NO
|
|
1230
|
+
// record: evidence, so the failure path may record it like a fresh name.
|
|
1231
|
+
let projectFromDocker = false;
|
|
1232
|
+
// ⚠ AN EXISTING DEPLOYMENT RUNS UNDER THE PROJECT DOCKER SAYS, NOT THE ONE
|
|
1233
|
+
// ASSUMED (#1020). `--resume` and `--reinstall` run compose calls and the
|
|
1234
|
+
// preflight below; with the legacy `compose` assumed for a stack that really
|
|
1235
|
+
// runs under an app-named project they would start a second stack on the
|
|
1236
|
+
// bind port, exactly the outage `update` reconciles away. Never fails the
|
|
1237
|
+
// install; a fresh install keeps its own name.
|
|
1238
|
+
if (!freshProject) {
|
|
1239
|
+
const asked = options.runCommand ?? defaultRunCommand;
|
|
1240
|
+
if (loadedState !== undefined) {
|
|
1241
|
+
const reconciled = await reconcileComposeProject({ deployRoot: options.deployRoot, state: loadedState, runCommand: asked });
|
|
1242
|
+
existingState = reconciled.state ?? loadedState;
|
|
1243
|
+
composeProject = composeProjectFor(existingState);
|
|
1244
|
+
if (reconciled.message !== undefined) {
|
|
1245
|
+
journal.line(reconciled.message);
|
|
1246
|
+
options.hooks?.onProgress?.(reconciled.message);
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
else {
|
|
1250
|
+
// A checkout and an environment file, but no record: nothing to rewrite,
|
|
1251
|
+
// so the detected project is carried in memory and recorded on success.
|
|
1252
|
+
const detection = await detectComposeProject(options.deployRoot, asked, { bindPort: options.bindPort });
|
|
1253
|
+
if (detection.kind === 'found' && detection.project !== LEGACY_COMPOSE_PROJECT) {
|
|
1254
|
+
composeProject = detection.project;
|
|
1255
|
+
projectFromDocker = true;
|
|
1256
|
+
journal.line(`note: compose project ${detection.project} for ${options.deployRoot} (its containers run under it; no deployment record).`);
|
|
1257
|
+
}
|
|
1258
|
+
else if (detection.kind === 'ambiguous') {
|
|
1259
|
+
const warning = `warning: containers of ${options.deployRoot} run under several compose projects (${detection.projects.join(', ')}) ` +
|
|
1260
|
+
`and no deployment record says which; using ${composeProject}.`;
|
|
1261
|
+
journal.line(warning);
|
|
1262
|
+
options.hooks?.onProgress?.(warning);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
const context = {
|
|
1267
|
+
options,
|
|
1268
|
+
runCommand: options.runCommand ?? defaultRunCommand,
|
|
1269
|
+
journal,
|
|
1270
|
+
hooks: options.hooks,
|
|
1271
|
+
composeProject,
|
|
1272
|
+
existingState,
|
|
1273
|
+
...(existingState === undefined
|
|
1274
|
+
? {}
|
|
1275
|
+
: {
|
|
1276
|
+
recordedProxy: {
|
|
1277
|
+
...(existingState.proxyMode === undefined ? {} : { proxyMode: existingState.proxyMode }),
|
|
1278
|
+
...(existingState.proxyContainer === undefined
|
|
1279
|
+
? {}
|
|
1280
|
+
: { proxyContainer: existingState.proxyContainer }),
|
|
1281
|
+
},
|
|
1282
|
+
}),
|
|
1283
|
+
completed: options.resume === true && existingState !== undefined
|
|
1284
|
+
? // The port gate is asked on every run: a port can be taken between a failed run and its resume.
|
|
1285
|
+
new Set((existingState.completedSteps ?? []).filter((id) => id !== STACK_PORTS_STEP_ID))
|
|
1286
|
+
: new Set(),
|
|
1287
|
+
// Appended by `runPipeline` as each step finishes; read by `deploy-info`.
|
|
1288
|
+
progress: [],
|
|
1289
|
+
};
|
|
1290
|
+
// The app's steps (`registerDeployStep`, #715) go in after the built-in
|
|
1291
|
+
// step each one names; they see a narrow context, never this one.
|
|
1292
|
+
const steps = withRegisteredSteps('install', buildInstallSteps(), (step) => appStepContext('install', step, () => environmentOf(step)));
|
|
1293
|
+
const result = await runPipeline(steps, context);
|
|
1294
|
+
if (result.failed !== undefined) {
|
|
1295
|
+
journal.finish('failure', `${result.failed.id}: ${result.failed.detail ?? ''}`);
|
|
1296
|
+
// ⚠ THE FAILURE PATH RECORDS WHAT COMPLETED, AND WITHOUT THIS `--resume`
|
|
1297
|
+
// RESUMES NOTHING. `completedSteps` was written only on the SUCCESS path
|
|
1298
|
+
// below, so the one run that needs resuming -- a failed one -- left no
|
|
1299
|
+
// record of its progress, and the flag the error message recommends in the
|
|
1300
|
+
// very next line skipped zero steps and rebuilt everything. The message
|
|
1301
|
+
// was true about intent and false about behaviour.
|
|
1302
|
+
//
|
|
1303
|
+
// The record is marked `lastOutcome: 'failure'` so nothing downstream
|
|
1304
|
+
// mistakes a half-applied attempt for a deployment: `commitSha` is
|
|
1305
|
+
// whatever the checkout reached, which may be nothing.
|
|
1306
|
+
const attemptedAt = new Date().toISOString();
|
|
1307
|
+
try {
|
|
1308
|
+
writeState({
|
|
1309
|
+
...(existingState ?? {}),
|
|
1310
|
+
version: DEPLOY_STATE_VERSION,
|
|
1311
|
+
repoUrl: context.target?.url ?? existingState?.repoUrl ?? '',
|
|
1312
|
+
ref: context.target?.ref ?? existingState?.ref ?? '',
|
|
1313
|
+
commitSha: context.commitSha ?? existingState?.commitSha ?? '',
|
|
1314
|
+
bindPort: options.bindPort,
|
|
1315
|
+
deployRoot: options.deployRoot,
|
|
1316
|
+
installedAt: existingState?.installedAt ?? '',
|
|
1317
|
+
lastDeployedAt: existingState?.lastDeployedAt ?? '',
|
|
1318
|
+
lastCommand: 'install',
|
|
1319
|
+
appctlVersion: cliVersion(),
|
|
1320
|
+
// ⚠ ONLY A NAME THIS RUN CHOSE IS A RECORD. For a deployment that was
|
|
1321
|
+
// already here, `composeProject` above is the legacy `compose` assumed
|
|
1322
|
+
// for an absent value, and writing it back from a FAILED attempt made
|
|
1323
|
+
// a guess look recorded: later runs then could not tell "the operator
|
|
1324
|
+
// pinned compose" from "nothing was ever recorded", and a server
|
|
1325
|
+
// running under an app-named project kept being driven as `compose`.
|
|
1326
|
+
// The spread of `existingState` above already keeps a real record.
|
|
1327
|
+
...(freshProject || projectFromDocker ? { composeProject } : {}),
|
|
1328
|
+
...(options.domain === undefined ? {} : { domain: options.domain }),
|
|
1329
|
+
...(options.proxyRoot === undefined ? {} : { proxyRoot: options.proxyRoot }),
|
|
1330
|
+
...recordedRuntime(context),
|
|
1331
|
+
completedSteps: result.completed,
|
|
1332
|
+
...allowSuperuserRecord(context, existingState),
|
|
1333
|
+
lastOutcome: 'failure',
|
|
1334
|
+
lastFailedStep: result.failed.id,
|
|
1335
|
+
lastAttemptAt: attemptedAt,
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
catch {
|
|
1339
|
+
// ⚠ BOOKKEEPING, NEVER THE FAILURE ITSELF. The deploy has already failed
|
|
1340
|
+
// and the operator needs THAT reason, not a second one about a file the
|
|
1341
|
+
// CLI could not write while reporting the first.
|
|
1342
|
+
}
|
|
1343
|
+
throw new Error(`${result.failed.title} failed: ${result.failed.detail ?? 'unknown error'}\n` +
|
|
1344
|
+
`The full log is at ${journal.path}\n` +
|
|
1345
|
+
`Fix the cause and re-run with --resume to continue from this step.`);
|
|
1346
|
+
}
|
|
1347
|
+
const now = new Date().toISOString();
|
|
1348
|
+
// ⚠ ONLY THE SUCCESS PATH APPENDS HISTORY. The failure path above spreads
|
|
1349
|
+
// the existing record, so a failed run keeps every prior entry and adds none.
|
|
1350
|
+
const host = await hostFactsOf(context);
|
|
1351
|
+
const runtime = recordedRuntime(context);
|
|
1352
|
+
const proxy = await observeProxy({
|
|
1353
|
+
domain: options.domain,
|
|
1354
|
+
bindPort: options.bindPort,
|
|
1355
|
+
proxyRoot: options.proxyRoot,
|
|
1356
|
+
mode: runtime.proxyMode,
|
|
1357
|
+
container: runtime.proxyContainer,
|
|
1358
|
+
runCommand: context.runCommand,
|
|
1359
|
+
});
|
|
1360
|
+
const history = appendHistory(existingState?.history, {
|
|
1361
|
+
at: now,
|
|
1362
|
+
command: 'install',
|
|
1363
|
+
commitSha: context.commitSha || null,
|
|
1364
|
+
previousCommitSha: previousDeployedCommit(existingState),
|
|
1365
|
+
ref: context.target?.ref ?? null,
|
|
1366
|
+
durationMs: Date.now() - startedAt,
|
|
1367
|
+
cliVersion: cliVersion(),
|
|
1368
|
+
outcome: 'success',
|
|
1369
|
+
});
|
|
1370
|
+
const installedAt = existingState?.installedAt ?? now;
|
|
1371
|
+
// The marker `update` compares the checkout against; see DeployState.deployedHead.
|
|
1372
|
+
const deployedHead = await checkoutHead(options.deployRoot, context.runCommand);
|
|
1373
|
+
writeState({
|
|
1374
|
+
version: DEPLOY_STATE_VERSION,
|
|
1375
|
+
repoUrl: context.target?.url ?? '',
|
|
1376
|
+
ref: context.target?.ref ?? '',
|
|
1377
|
+
commitSha: context.commitSha ?? '',
|
|
1378
|
+
...(deployedHead === undefined ? {} : { deployedHead }),
|
|
1379
|
+
...(options.domain === undefined ? {} : { domain: options.domain }),
|
|
1380
|
+
bindPort: options.bindPort,
|
|
1381
|
+
deployRoot: options.deployRoot,
|
|
1382
|
+
installedAt,
|
|
1383
|
+
lastDeployedAt: now,
|
|
1384
|
+
lastCommand: 'install',
|
|
1385
|
+
appctlVersion: cliVersion(),
|
|
1386
|
+
// Recorded, never re-derived: see composeProjectFor.
|
|
1387
|
+
composeProject,
|
|
1388
|
+
// Recorded so update writes the vhost where install put it, rather than
|
|
1389
|
+
// re-deriving a path that ignores a non-default --proxy-root.
|
|
1390
|
+
...(options.proxyRoot === undefined ? {} : { proxyRoot: options.proxyRoot }),
|
|
1391
|
+
// Recorded so update, certs and uninstall act under the runtime this
|
|
1392
|
+
// install actually used, rather than re-detecting it.
|
|
1393
|
+
...recordedRuntime(context),
|
|
1394
|
+
// Recorded so a later `update` knows which groups this deployment uses.
|
|
1395
|
+
// It cannot be re-derived from the `.env`: a group's keys look identical
|
|
1396
|
+
// whether the feature is on or off. Always includes the always-on groups
|
|
1397
|
+
// (`effectiveGroups`, #567), so the record says what actually runs.
|
|
1398
|
+
groups: effectiveGroups(options.groups),
|
|
1399
|
+
completedSteps: result.completed,
|
|
1400
|
+
...allowSuperuserRecord(context, existingState),
|
|
1401
|
+
// Stated explicitly rather than left absent, so a later reader never has
|
|
1402
|
+
// to infer success from the shape of the record.
|
|
1403
|
+
lastOutcome: 'success',
|
|
1404
|
+
lastAttemptAt: now,
|
|
1405
|
+
host,
|
|
1406
|
+
history,
|
|
1407
|
+
proxy,
|
|
1408
|
+
});
|
|
1409
|
+
// The end-of-run rewrite of info.json: the same document the health gate
|
|
1410
|
+
// wrote, now carrying this run's history entry, every completed step and the
|
|
1411
|
+
// certificate `publish` just issued. Never throws; see writeDeployInfo.
|
|
1412
|
+
const info = writeDeployInfo(options.deployRoot, {
|
|
1413
|
+
...installDeployInfo(context, now),
|
|
1414
|
+
installedAt,
|
|
1415
|
+
proxy: proxyInfoOf(proxy),
|
|
1416
|
+
host,
|
|
1417
|
+
history,
|
|
1418
|
+
});
|
|
1419
|
+
journal.line(info.written
|
|
1420
|
+
? `Wrote ${info.path}`
|
|
1421
|
+
: `warning: could not write ${info.path}: ${info.error ?? 'unknown'}`);
|
|
1422
|
+
journal.finish('success');
|
|
1423
|
+
const admin = context.env?.get('INITIAL_ADMIN_EMAIL') ?? 'the admin address';
|
|
1424
|
+
const url = options.domain === undefined
|
|
1425
|
+
? `http://127.0.0.1:${options.bindPort}`
|
|
1426
|
+
: `https://${options.domain}`;
|
|
1427
|
+
return {
|
|
1428
|
+
deployRoot: options.deployRoot,
|
|
1429
|
+
commitSha: context.commitSha ?? '',
|
|
1430
|
+
journalPath: journal.path,
|
|
1431
|
+
...(options.domain === undefined ? {} : { domain: options.domain }),
|
|
1432
|
+
// The seed writes the ALLOWLIST row, not a user account. Nobody is an
|
|
1433
|
+
// admin until this login happens, and an install that does not say so
|
|
1434
|
+
// looks broken.
|
|
1435
|
+
nextStep: `Log in at ${url} as ${admin} to claim the Admin role.`,
|
|
1436
|
+
...(options.showCredentials === true && context.appCredentials !== undefined
|
|
1437
|
+
? { credentials: context.appCredentials }
|
|
1438
|
+
: {}),
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* `allowSuperuser` as the state records it (#980): the login `--allow-superuser`
|
|
1443
|
+
* kept in THIS run, or the one a previous run recorded while `.env` still holds
|
|
1444
|
+
* that same login. Anything else records nothing, so a choice never outlives the
|
|
1445
|
+
* login it was made for -- once POSTGRES_USER is an ordinary role the flag is
|
|
1446
|
+
* gone, and a later superuser fails `deploy doctor` instead of being waved through.
|
|
1447
|
+
*/
|
|
1448
|
+
function allowSuperuserRecord(context, existing) {
|
|
1449
|
+
return superuserRecord(context.superuserKept, existing, environmentOf(context)?.get('POSTGRES_USER'));
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* The commit a fresh install replaces, for its history entry.
|
|
1453
|
+
*
|
|
1454
|
+
* The last SUCCESSFUL run's commit when there is history. Without it, a record
|
|
1455
|
+
* that did not end in failure still names a deployed commit (a v1 record, an
|
|
1456
|
+
* adopted one); a failed first install names only the checkout it reached,
|
|
1457
|
+
* which was never deployed, so it answers null.
|
|
1458
|
+
*/
|
|
1459
|
+
function previousDeployedCommit(existing) {
|
|
1460
|
+
if (existing === undefined)
|
|
1461
|
+
return null;
|
|
1462
|
+
const last = existing.history?.[0];
|
|
1463
|
+
if (last !== undefined)
|
|
1464
|
+
return last.commitSha;
|
|
1465
|
+
if (existing.lastOutcome === 'failure')
|
|
1466
|
+
return null;
|
|
1467
|
+
return existing.commitSha || null;
|
|
1468
|
+
}
|
|
1469
|
+
/** Slug used for the default deploy root, from the repository name. */
|
|
1470
|
+
export function defaultRootFor(repoUrl, base) {
|
|
1471
|
+
const name = basename(repoUrl).replace(/\.git$/, '') || 'app';
|
|
1472
|
+
return join(base, name.toLowerCase());
|
|
1473
|
+
}
|
|
1474
|
+
//# sourceMappingURL=install.js.map
|