@marinoscar/platform-cli 0.0.0-stage → 0.1.0-next.11
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 +157 -0
- package/LICENSE +21 -0
- package/README.md +182 -2
- 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 +60 -0
- package/dist/core/command-registry.d.ts.map +1 -0
- package/dist/core/command-registry.js +114 -0
- package/dist/core/command-registry.js.map +1 -0
- 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 +133 -0
- package/dist/core/env-spec-registry.d.ts.map +1 -0
- package/dist/core/env-spec-registry.js +103 -0
- package/dist/core/env-spec-registry.js.map +1 -0
- package/dist/core/env-values.d.ts +76 -0
- package/dist/core/env-values.d.ts.map +1 -0
- package/dist/core/env-values.js +125 -0
- package/dist/core/env-values.js.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +10 -0
- package/dist/core/index.js.map +1 -0
- 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 +243 -0
- package/dist/engine/commands/deploy.d.ts.map +1 -0
- package/dist/engine/commands/deploy.js +1166 -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 +436 -0
- package/dist/engine/commands/node.js.map +1 -0
- package/dist/engine/config.d.ts +246 -0
- package/dist/engine/config.d.ts.map +1 -0
- package/dist/engine/config.js +414 -0
- package/dist/engine/config.js.map +1 -0
- package/dist/engine/conformance.d.ts +187 -0
- package/dist/engine/conformance.d.ts.map +1 -0
- package/dist/engine/conformance.js +227 -0
- package/dist/engine/conformance.js.map +1 -0
- package/dist/engine/create-cli.d.ts +94 -0
- package/dist/engine/create-cli.d.ts.map +1 -0
- package/dist/engine/create-cli.js +60 -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 +47 -0
- package/dist/engine/deploy/app-version.d.ts.map +1 -0
- package/dist/engine/deploy/app-version.js +232 -0
- package/dist/engine/deploy/app-version.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 +33 -0
- package/dist/engine/deploy/checks/index.d.ts.map +1 -0
- package/dist/engine/deploy/checks/index.js +67 -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/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 +186 -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-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/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/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 +233 -0
- package/dist/engine/deploy/install.d.ts.map +1 -0
- package/dist/engine/deploy/install.js +1318 -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 +277 -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/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 +212 -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-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 +365 -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 +112 -0
- package/dist/engine/deploy/update.d.ts.map +1 -0
- package/dist/engine/deploy/update.js +1280 -0
- package/dist/engine/deploy/update.js.map +1 -0
- package/dist/engine/deploy/version-step.d.ts +65 -0
- package/dist/engine/deploy/version-step.d.ts.map +1 -0
- package/dist/engine/deploy/version-step.js +176 -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/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 +104 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +126 -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 +238 -0
- package/dist/engine/node/capabilities.d.ts.map +1 -0
- package/dist/engine/node/capabilities.js +316 -0
- package/dist/engine/node/capabilities.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 +227 -0
- package/dist/engine/node/daemon.js.map +1 -0
- package/dist/engine/node/doctor.d.ts +58 -0
- package/dist/engine/node/doctor.d.ts.map +1 -0
- package/dist/engine/node/doctor.js +394 -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 +189 -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 +168 -0
- package/dist/engine/node/executors/index.d.ts.map +1 -0
- package/dist/engine/node/executors/index.js +44 -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 +92 -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/install-deps.d.ts +73 -0
- package/dist/engine/node/install-deps.d.ts.map +1 -0
- package/dist/engine/node/install-deps.js +150 -0
- package/dist/engine/node/install-deps.js.map +1 -0
- package/dist/engine/node/ipc-protocol.d.ts +67 -0
- package/dist/engine/node/ipc-protocol.d.ts.map +1 -0
- package/dist/engine/node/ipc-protocol.js +83 -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 +259 -0
- package/dist/engine/node/lifecycle.js.map +1 -0
- package/dist/engine/node/logger.d.ts +82 -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 +78 -0
- package/dist/engine/node/memory-watchdog.d.ts.map +1 -0
- package/dist/engine/node/memory-watchdog.js +224 -0
- package/dist/engine/node/memory-watchdog.js.map +1 -0
- package/dist/engine/node/node-api.d.ts +391 -0
- package/dist/engine/node/node-api.d.ts.map +1 -0
- package/dist/engine/node/node-api.js +123 -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 +56 -0
- package/dist/engine/node/node-dashboard-source.d.ts.map +1 -0
- package/dist/engine/node/node-dashboard-source.js +213 -0
- package/dist/engine/node/node-dashboard-source.js.map +1 -0
- package/dist/engine/node/node-engine.d.ts +229 -0
- package/dist/engine/node/node-engine.d.ts.map +1 -0
- package/dist/engine/node/node-engine.js +723 -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.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/runtime-tuning.d.ts +65 -0
- package/dist/engine/node/runtime-tuning.d.ts.map +1 -0
- package/dist/engine/node/runtime-tuning.js +198 -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 +211 -0
- package/dist/engine/node/service.js.map +1 -0
- package/dist/engine/node/start.d.ts +62 -0
- package/dist/engine/node/start.d.ts.map +1 -0
- package/dist/engine/node/start.js +245 -0
- package/dist/engine/node/start.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 +97 -0
- package/dist/engine/node/worker-env-table.js.map +1 -0
- package/dist/engine/node/worker-env.d.ts +50 -0
- package/dist/engine/node/worker-env.d.ts.map +1 -0
- package/dist/engine/node/worker-env.js +101 -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 +50 -0
- package/dist/engine/program.d.ts.map +1 -0
- package/dist/engine/program.js +197 -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 +52 -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/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.d.ts +3 -0
- package/dist/engine/tui/app.d.ts.map +1 -0
- package/dist/engine/tui/app.js +100 -0
- package/dist/engine/tui/app.js.map +1 -0
- package/dist/engine/tui/builtin-screens.d.ts +6 -0
- package/dist/engine/tui/builtin-screens.d.ts.map +1 -0
- package/dist/engine/tui/builtin-screens.js +54 -0
- package/dist/engine/tui/builtin-screens.js.map +1 -0
- package/dist/engine/tui/index.d.ts +23 -0
- package/dist/engine/tui/index.d.ts.map +1 -0
- package/dist/engine/tui/index.js +71 -0
- package/dist/engine/tui/index.js.map +1 -0
- package/dist/engine/tui/layout.d.ts +132 -0
- package/dist/engine/tui/layout.d.ts.map +1 -0
- package/dist/engine/tui/layout.js +200 -0
- package/dist/engine/tui/layout.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 +100 -0
- package/dist/engine/tui/screen-registry.d.ts.map +1 -0
- package/dist/engine/tui/screen-registry.js +96 -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 +155 -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 +361 -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 +193 -0
- package/dist/engine/tui/screens/invoke.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 +255 -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 +142 -0
- package/dist/engine/tui/screens/logout.js.map +1 -0
- package/dist/engine/tui/screens/menu.d.ts +22 -0
- package/dist/engine/tui/screens/menu.d.ts.map +1 -0
- package/dist/engine/tui/screens/menu.js +84 -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 +228 -0
- package/dist/engine/tui/screens/node.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 +134 -0
- package/dist/engine/tui/screens/status.js.map +1 -0
- package/dist/engine/tui/scroll-box.d.ts +27 -0
- package/dist/engine/tui/scroll-box.d.ts.map +1 -0
- package/dist/engine/tui/scroll-box.js +52 -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/tty.d.ts +49 -0
- package/dist/engine/tui/tty.d.ts.map +1 -0
- package/dist/engine/tui/tty.js +139 -0
- package/dist/engine/tui/tty.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- 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/env-fragment.d.ts +47 -0
- package/dist/telemetry/env-fragment.d.ts.map +1 -0
- package/dist/telemetry/env-fragment.js +73 -0
- package/dist/telemetry/env-fragment.js.map +1 -0
- package/dist/telemetry/index.d.ts +7 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +7 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/node-span-relay.d.ts +107 -0
- package/dist/telemetry/node-span-relay.d.ts.map +1 -0
- package/dist/telemetry/node-span-relay.js +314 -0
- package/dist/telemetry/node-span-relay.js.map +1 -0
- package/dist/telemetry/node-span.d.ts +92 -0
- package/dist/telemetry/node-span.d.ts.map +1 -0
- package/dist/telemetry/node-span.js +28 -0
- package/dist/telemetry/node-span.js.map +1 -0
- 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 +5 -0
- package/dist/tui/index.js.map +1 -0
- package/package.json +102 -4
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
import { X509Certificate } from 'node:crypto';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join, posix } from 'node:path';
|
|
4
|
+
import { UsageError } from '../errors.js';
|
|
5
|
+
import { renderExtraLocation, resolveExtraLocations } from './proxy-streams.js';
|
|
6
|
+
export const PROXY_MODES = ['container', 'host'];
|
|
7
|
+
/** The container name the shared-proxy model uses unless told otherwise. */
|
|
8
|
+
export const DEFAULT_PROXY_CONTAINER = 'proxy-nginx';
|
|
9
|
+
/** Mount points inside the proxy container (and the dockerised certbot). */
|
|
10
|
+
export const CONTAINER_CERT_ROOT = '/etc/letsencrypt';
|
|
11
|
+
export const CONTAINER_WEBROOT = '/var/www/certbot';
|
|
12
|
+
/** The dockerised certbot used in container mode. */
|
|
13
|
+
export const CERTBOT_IMAGE = 'certbot/certbot:latest';
|
|
14
|
+
/** Docker's own container-name grammar; also keeps a leading `-` out of argv. */
|
|
15
|
+
const CONTAINER_NAME = /^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/;
|
|
16
|
+
export function assertValidContainerName(name) {
|
|
17
|
+
if (!CONTAINER_NAME.test(name)) {
|
|
18
|
+
throw new UsageError(`"${name}" is not a valid container name, so it will not be passed to docker.`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Parses a `--proxy-mode` value, refusing anything else. */
|
|
22
|
+
export function parseProxyMode(value) {
|
|
23
|
+
if (PROXY_MODES.includes(value))
|
|
24
|
+
return value;
|
|
25
|
+
throw new UsageError(`--proxy-mode must be one of ${PROXY_MODES.join(', ')}, not "${value}".`);
|
|
26
|
+
}
|
|
27
|
+
/** The runtime for a known mode. Pure; the test seam. */
|
|
28
|
+
export function proxyRuntimeFor(mode, proxyRoot, container = DEFAULT_PROXY_CONTAINER) {
|
|
29
|
+
return mode === 'container'
|
|
30
|
+
? { mode, container, certRoot: CONTAINER_CERT_ROOT, webroot: CONTAINER_WEBROOT }
|
|
31
|
+
: {
|
|
32
|
+
mode,
|
|
33
|
+
container,
|
|
34
|
+
certRoot: join(proxyRoot, 'letsencrypt'),
|
|
35
|
+
webroot: join(proxyRoot, 'webroot'),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Runs a probe purely for its exit status. Never throws. */
|
|
39
|
+
async function succeeds(run, argv) {
|
|
40
|
+
try {
|
|
41
|
+
await run(argv, { cwd: process.cwd(), timeoutMs: 20_000 });
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Decides how the shared proxy runs.
|
|
50
|
+
*
|
|
51
|
+
* In order: an explicit mode wins outright; otherwise a container with the
|
|
52
|
+
* expected name (`docker inspect`) means container mode; otherwise a host
|
|
53
|
+
* `nginx` binary means host mode; otherwise container mode, because that is
|
|
54
|
+
* the documented target architecture and the one a fresh server is being
|
|
55
|
+
* prepared for.
|
|
56
|
+
*
|
|
57
|
+
* Read-only -- `docker inspect` and `nginx -v` change nothing -- so doctor can
|
|
58
|
+
* call it. Never throws on a failed probe; it does throw a UsageError on an
|
|
59
|
+
* invalid container name, before anything reaches an argv.
|
|
60
|
+
*/
|
|
61
|
+
export async function resolveProxyRuntime(options) {
|
|
62
|
+
const container = options.container ?? DEFAULT_PROXY_CONTAINER;
|
|
63
|
+
assertValidContainerName(container);
|
|
64
|
+
if (options.mode !== undefined) {
|
|
65
|
+
return { ...proxyRuntimeFor(options.mode, options.proxyRoot, container), source: 'explicit' };
|
|
66
|
+
}
|
|
67
|
+
if (await succeeds(options.runCommand, ['docker', 'inspect', '--type', 'container', '--format', '{{.Name}}', container])) {
|
|
68
|
+
return { ...proxyRuntimeFor('container', options.proxyRoot, container), source: 'detected' };
|
|
69
|
+
}
|
|
70
|
+
if (await succeeds(options.runCommand, ['nginx', '-v'])) {
|
|
71
|
+
return { ...proxyRuntimeFor('host', options.proxyRoot, container), source: 'detected' };
|
|
72
|
+
}
|
|
73
|
+
return { ...proxyRuntimeFor('container', options.proxyRoot, container), source: 'default' };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The runtime a command should act under, from what it was told and what the
|
|
77
|
+
* deployment recorded: an explicit flag wins, then the record, then detection.
|
|
78
|
+
*
|
|
79
|
+
* A recorded container name is reused even when only the mode is overridden,
|
|
80
|
+
* and vice versa -- each half falls back independently.
|
|
81
|
+
*/
|
|
82
|
+
export async function resolveRecordedProxyRuntime(options) {
|
|
83
|
+
const mode = options.flags.mode ?? options.recorded?.proxyMode;
|
|
84
|
+
const container = options.flags.container ?? options.recorded?.proxyContainer;
|
|
85
|
+
return await resolveProxyRuntime({
|
|
86
|
+
proxyRoot: options.proxyRoot,
|
|
87
|
+
runCommand: options.runCommand,
|
|
88
|
+
...(mode === undefined ? {} : { mode }),
|
|
89
|
+
...(container === undefined ? {} : { container }),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** A one-line description for the journal and for progress output. */
|
|
93
|
+
export function describeProxyRuntime(runtime) {
|
|
94
|
+
const where = runtime.mode === 'container' ? `container ${runtime.container}` : 'host nginx';
|
|
95
|
+
return `Proxy runtime: ${where} (${runtime.source})`;
|
|
96
|
+
}
|
|
97
|
+
/** A hostname, and nothing that could break out of a config or a command. */
|
|
98
|
+
const HOSTNAME = /^(?=.{1,253}$)(?!-)[a-z0-9-]{1,63}(?<!-)(\.(?!-)[a-z0-9-]{1,63}(?<!-))*$/i;
|
|
99
|
+
export function assertValidDomain(domain) {
|
|
100
|
+
// Validated before it reaches a config file OR an argv. Neither is a shell,
|
|
101
|
+
// but a newline in a domain would let a vhost be extended with arbitrary
|
|
102
|
+
// directives, which is the same class of problem.
|
|
103
|
+
if (!HOSTNAME.test(domain)) {
|
|
104
|
+
throw new UsageError(`"${domain}" is not a valid hostname, so it will not be written into the proxy configuration.`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export function vhostPath(target) {
|
|
108
|
+
return join(target.proxyRoot, 'nginx', 'conf.d', `${target.domain}.conf`);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* A certificate file's HOST path: what this process stats and openssl reads.
|
|
112
|
+
*
|
|
113
|
+
* ⚠ Never write this into an nginx config -- use `configLivePath`. See the
|
|
114
|
+
* module header.
|
|
115
|
+
*/
|
|
116
|
+
export function livePath(target, file) {
|
|
117
|
+
return join(target.proxyRoot, 'letsencrypt', 'live', target.domain, file);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A certificate file's path AS NGINX SEES IT: what goes into the vhost.
|
|
121
|
+
*
|
|
122
|
+
* Equal to `livePath` in host mode; `/etc/letsencrypt/live/...` in container
|
|
123
|
+
* mode. Built with posix joins, since it names a path inside nginx's world.
|
|
124
|
+
*/
|
|
125
|
+
export function configLivePath(runtime, domain, file) {
|
|
126
|
+
return posix.join(runtime.certRoot, 'live', domain, file);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The runtime a low-level helper acts under when its caller gave none.
|
|
130
|
+
*
|
|
131
|
+
* Preserves the helpers' historical behaviour: host paths, and container mode
|
|
132
|
+
* only when a `proxyContainer` alone was passed.
|
|
133
|
+
*/
|
|
134
|
+
export function effectiveRuntime(target, options) {
|
|
135
|
+
if (options.runtime !== undefined)
|
|
136
|
+
return options.runtime;
|
|
137
|
+
return options.proxyContainer === undefined
|
|
138
|
+
? proxyRuntimeFor('host', target.proxyRoot)
|
|
139
|
+
: proxyRuntimeFor('container', target.proxyRoot, options.proxyContainer);
|
|
140
|
+
}
|
|
141
|
+
/** The container `nginx` runs in, or undefined for a host binary. */
|
|
142
|
+
function proxyContainerOf(options) {
|
|
143
|
+
if (options.runtime !== undefined) {
|
|
144
|
+
return options.runtime.mode === 'container' ? options.runtime.container : undefined;
|
|
145
|
+
}
|
|
146
|
+
return options.proxyContainer;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The first line of every vhost this CLI writes, and the prefix it checks
|
|
150
|
+
* before it removes one. FIXED, whatever the CLI identity: it is written AND
|
|
151
|
+
* parsed on live servers, so a renamed CLI must still recognise the vhosts an
|
|
152
|
+
* `appctl` deploy wrote (#715). `identity.test.ts` pins the value.
|
|
153
|
+
*
|
|
154
|
+
* @stability stable
|
|
155
|
+
*/
|
|
156
|
+
export const PROXY_MANAGED_SENTINEL = '# Managed by appctl deploy';
|
|
157
|
+
/**
|
|
158
|
+
* Renders the vhost.
|
|
159
|
+
*
|
|
160
|
+
* Deterministic: the same input produces byte-identical output, so re-running
|
|
161
|
+
* an install produces no spurious diff and no needless reload.
|
|
162
|
+
*
|
|
163
|
+
* WHAT IS DELIBERATELY ABSENT: security headers. infra/nginx/nginx.conf
|
|
164
|
+
* already sets HSTS, the CSP, X-Frame-Options and the rest, and nginx's
|
|
165
|
+
* add_header REPLACES the inherited set rather than merging with it - so
|
|
166
|
+
* adding any header here would silently delete the application's CSP.
|
|
167
|
+
*/
|
|
168
|
+
export function renderVhost(target, runtime, options) {
|
|
169
|
+
assertValidDomain(target.domain);
|
|
170
|
+
// App stream routes, validated and deduplicated. Empty for an app that
|
|
171
|
+
// declares none, which leaves the vhost byte-identical to the platform's own.
|
|
172
|
+
const appLocations = resolveExtraLocations(target)
|
|
173
|
+
.map((location) => `\n\n${renderExtraLocation(location, target.bindPort)}`)
|
|
174
|
+
.join('');
|
|
175
|
+
const maxBody = options?.maxBodyBytes;
|
|
176
|
+
const clientMaxBody = maxBody === undefined ? '100m' : `${Math.ceil(maxBody / (1024 * 1024))}m`;
|
|
177
|
+
return `${PROXY_MANAGED_SENTINEL}. Edits will be overwritten.
|
|
178
|
+
# Application: ${target.domain}
|
|
179
|
+
|
|
180
|
+
server {
|
|
181
|
+
listen 80;
|
|
182
|
+
listen [::]:80;
|
|
183
|
+
server_name ${target.domain};
|
|
184
|
+
|
|
185
|
+
# Left served over HTTP on purpose: renewal uses the same webroot
|
|
186
|
+
# challenge, and redirecting it to HTTPS breaks every future renewal.
|
|
187
|
+
location /.well-known/acme-challenge/ {
|
|
188
|
+
root ${runtime.webroot};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
location / {
|
|
192
|
+
return 301 https://$host$request_uri;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
server {
|
|
197
|
+
listen 443 ssl;
|
|
198
|
+
listen [::]:443 ssl;
|
|
199
|
+
http2 on;
|
|
200
|
+
server_name ${target.domain};
|
|
201
|
+
|
|
202
|
+
ssl_certificate ${configLivePath(runtime, target.domain, 'fullchain.pem')};
|
|
203
|
+
ssl_certificate_key ${configLivePath(runtime, target.domain, 'privkey.pem')};
|
|
204
|
+
ssl_protocols TLSv1.2 TLSv1.3;
|
|
205
|
+
ssl_prefer_server_ciphers off;
|
|
206
|
+
ssl_session_cache shared:SSL:10m;
|
|
207
|
+
ssl_session_timeout 1d;
|
|
208
|
+
|
|
209
|
+
# Matched to MAX_FILE_SIZE. Without this an upload fails at the edge with
|
|
210
|
+
# a bare 413 that never reaches the application's own limits.
|
|
211
|
+
client_max_body_size ${clientMaxBody};
|
|
212
|
+
|
|
213
|
+
# No response headers are set here, deliberately. The application's own
|
|
214
|
+
# nginx already sets HSTS, the CSP and the rest, and nginx REPLACES an
|
|
215
|
+
# inherited header set rather than merging with it - so adding even one
|
|
216
|
+
# here would silently delete all of them.
|
|
217
|
+
|
|
218
|
+
location / {
|
|
219
|
+
proxy_pass http://127.0.0.1:${target.bindPort};
|
|
220
|
+
proxy_http_version 1.1;
|
|
221
|
+
|
|
222
|
+
proxy_set_header Host $host;
|
|
223
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
224
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
225
|
+
# The application forwards $scheme onward, so THIS is the value it
|
|
226
|
+
# ultimately sees. Get it wrong and OAuth callbacks build http:// URLs
|
|
227
|
+
# and the login redirect loops.
|
|
228
|
+
proxy_set_header X-Forwarded-Proto https;
|
|
229
|
+
proxy_set_header X-Forwarded-Host $host;
|
|
230
|
+
|
|
231
|
+
proxy_connect_timeout 60s;
|
|
232
|
+
proxy_send_timeout 60s;
|
|
233
|
+
proxy_read_timeout 60s;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
# Server-sent events. The application's nginx already disables buffering
|
|
237
|
+
# for this path; without the same treatment at the edge, that care is
|
|
238
|
+
# undone one hop upstream and events arrive in batches or not at all.
|
|
239
|
+
location /api/notifications/stream {
|
|
240
|
+
proxy_pass http://127.0.0.1:${target.bindPort};
|
|
241
|
+
proxy_http_version 1.1;
|
|
242
|
+
|
|
243
|
+
proxy_set_header Host $host;
|
|
244
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
245
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
246
|
+
proxy_set_header X-Forwarded-Proto https;
|
|
247
|
+
proxy_set_header Connection '';
|
|
248
|
+
|
|
249
|
+
proxy_buffering off;
|
|
250
|
+
proxy_cache off;
|
|
251
|
+
chunked_transfer_encoding off;
|
|
252
|
+
proxy_read_timeout 1h;
|
|
253
|
+
proxy_send_timeout 1h;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
# AI response streaming (SSE, issue #433). Same reasoning as above: the
|
|
257
|
+
# application's nginx forwards it unbuffered, and this hop must too, or
|
|
258
|
+
# tokens arrive in batches. One answer rather than a feed, so ten minutes
|
|
259
|
+
# (the application's own bound) instead of an hour; the API heartbeats
|
|
260
|
+
# every 15s.
|
|
261
|
+
location /api/ai/responses/stream {
|
|
262
|
+
proxy_pass http://127.0.0.1:${target.bindPort};
|
|
263
|
+
proxy_http_version 1.1;
|
|
264
|
+
|
|
265
|
+
proxy_set_header Host $host;
|
|
266
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
267
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
268
|
+
proxy_set_header X-Forwarded-Proto https;
|
|
269
|
+
proxy_set_header Connection '';
|
|
270
|
+
|
|
271
|
+
proxy_buffering off;
|
|
272
|
+
proxy_cache off;
|
|
273
|
+
chunked_transfer_encoding off;
|
|
274
|
+
proxy_read_timeout 600s;
|
|
275
|
+
proxy_send_timeout 600s;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
# Telemetry AI assistant streaming (SSE, issue #536): the same needs as
|
|
279
|
+
# the AI response stream above — one turn of tool steps and an answer.
|
|
280
|
+
location /api/admin/telemetry/assistant/stream {
|
|
281
|
+
proxy_pass http://127.0.0.1:${target.bindPort};
|
|
282
|
+
proxy_http_version 1.1;
|
|
283
|
+
|
|
284
|
+
proxy_set_header Host $host;
|
|
285
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
286
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
287
|
+
proxy_set_header X-Forwarded-Proto https;
|
|
288
|
+
proxy_set_header Connection '';
|
|
289
|
+
|
|
290
|
+
proxy_buffering off;
|
|
291
|
+
proxy_cache off;
|
|
292
|
+
chunked_transfer_encoding off;
|
|
293
|
+
proxy_read_timeout 600s;
|
|
294
|
+
proxy_send_timeout 600s;
|
|
295
|
+
}${appLocations}
|
|
296
|
+
}
|
|
297
|
+
`;
|
|
298
|
+
}
|
|
299
|
+
export function certificateStatus(target) {
|
|
300
|
+
const path = livePath(target, 'fullchain.pem');
|
|
301
|
+
return { exists: existsSync(path), path };
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* certbot's own renewal config always records which ACME directory issued
|
|
305
|
+
* the certificate (issue #637). Staging's is the only one containing
|
|
306
|
+
* "acme-staging"; production's does not, whether it names the default
|
|
307
|
+
* directory explicitly or omits `server` entirely.
|
|
308
|
+
*/
|
|
309
|
+
function isStagingCertificate(target) {
|
|
310
|
+
const path = join(target.proxyRoot, 'letsencrypt', 'renewal', `${target.domain}.conf`);
|
|
311
|
+
if (!existsSync(path))
|
|
312
|
+
return false;
|
|
313
|
+
try {
|
|
314
|
+
return /acme-staging/i.test(readFileSync(path, 'utf8'));
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
// Unreadable is not "staging" -- the existing cert is used as before,
|
|
318
|
+
// which is what happened before this check existed.
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Issues a certificate, unless a usable one already exists.
|
|
324
|
+
*
|
|
325
|
+
* Skipping when one exists is not an optimisation: re-issuing on every deploy
|
|
326
|
+
* spends the rate limit (50 certificates per registered domain per week) for
|
|
327
|
+
* nothing, and that limit is per DOMAIN, so it is shared with every other
|
|
328
|
+
* subdomain on the same server.
|
|
329
|
+
*
|
|
330
|
+
* ⚠ "EXISTS" IS NOT "TRUSTED" (issue #637). A Let's Encrypt STAGING
|
|
331
|
+
* certificate satisfies `certificateStatus` exactly as well as a production
|
|
332
|
+
* one, but every browser rejects it -- it is signed by a deliberately
|
|
333
|
+
* untrusted root, precisely so testing against it cannot be mistaken for
|
|
334
|
+
* success. An operator who used `--staging` once while working around a rate
|
|
335
|
+
* limit, then re-ran without it, would otherwise have that untrusted
|
|
336
|
+
* certificate served in production forever: nothing here ever looks at it
|
|
337
|
+
* again to ask whether it should be replaced. So a request that is NOT for
|
|
338
|
+
* staging, against an existing certificate that IS staging, forces a fresh
|
|
339
|
+
* issuance instead of skipping. The reverse (an explicit `--staging` request
|
|
340
|
+
* finding an existing production certificate) never downgrades a trusted
|
|
341
|
+
* certificate to an untrusted one -- it keeps the better certificate already
|
|
342
|
+
* there.
|
|
343
|
+
*/
|
|
344
|
+
export async function issueCertificate(target, options) {
|
|
345
|
+
assertValidDomain(target.domain);
|
|
346
|
+
const status = certificateStatus(target);
|
|
347
|
+
const replaceStaging = status.exists && options.staging !== true && isStagingCertificate(target);
|
|
348
|
+
if (status.exists && !replaceStaging) {
|
|
349
|
+
options.hooks?.onProgress?.(`Certificate for ${target.domain} already exists`);
|
|
350
|
+
return { issued: false, path: status.path };
|
|
351
|
+
}
|
|
352
|
+
if (replaceStaging) {
|
|
353
|
+
options.hooks?.onProgress?.(`Certificate for ${target.domain} was issued by Let's Encrypt's STAGING environment, ` +
|
|
354
|
+
`which browsers never trust. Requesting a trusted production certificate to replace it.`);
|
|
355
|
+
}
|
|
356
|
+
const argv = certbotArgv(target, effectiveRuntime(target, options), {
|
|
357
|
+
email: options.email,
|
|
358
|
+
staging: options.staging,
|
|
359
|
+
forceRenewal: replaceStaging,
|
|
360
|
+
});
|
|
361
|
+
options.hooks?.onProgress?.(`Requesting a certificate for ${target.domain}`);
|
|
362
|
+
try {
|
|
363
|
+
await options.runCommand(argv, {
|
|
364
|
+
cwd: target.proxyRoot,
|
|
365
|
+
timeoutMs: 5 * 60_000,
|
|
366
|
+
...(options.hooks?.onLog === undefined
|
|
367
|
+
? {}
|
|
368
|
+
: { onLine: (line) => options.hooks?.onLog?.(line) }),
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
catch (error) {
|
|
372
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
373
|
+
// Rate limiting needs its own remedy: the fix is to WAIT, and retrying is
|
|
374
|
+
// what put the operator there in the first place.
|
|
375
|
+
if (/too many certificates|rateLimited|rate limit/i.test(message)) {
|
|
376
|
+
throw new UsageError(`Let's Encrypt is rate-limiting this domain. Wait before trying again — retrying now makes it worse. Use --staging while working out the rest of the setup.\n${message}`);
|
|
377
|
+
}
|
|
378
|
+
throw error;
|
|
379
|
+
}
|
|
380
|
+
return { issued: true, path: livePath(target, 'fullchain.pem') };
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* The argv that runs `certbot certonly --webroot` for this runtime.
|
|
384
|
+
*
|
|
385
|
+
* CONTAINER MODE runs the dockerised certbot with the proxy's two volumes
|
|
386
|
+
* mounted at the SAME paths the proxy container uses, and deliberately passes
|
|
387
|
+
* no --config-dir/--work-dir/--logs-dir: those flags are exactly what write
|
|
388
|
+
* host paths into `renewal/<domain>.conf`, which a dockerised `certbot renew`
|
|
389
|
+
* then cannot follow. With the defaults, every recorded path is under
|
|
390
|
+
* `/etc/letsencrypt`, which is where every later dockerised renewal looks.
|
|
391
|
+
*
|
|
392
|
+
* HOST MODE keeps the historical argv: a host certbot whose state lives under
|
|
393
|
+
* the proxy root.
|
|
394
|
+
*
|
|
395
|
+
* Exported for its test.
|
|
396
|
+
*/
|
|
397
|
+
export function certbotArgv(target, runtime, options) {
|
|
398
|
+
const common = [
|
|
399
|
+
'-d', target.domain,
|
|
400
|
+
'--non-interactive', '--agree-tos',
|
|
401
|
+
'--email', options.email,
|
|
402
|
+
...(options.forceRenewal === true ? ['--force-renewal'] : []),
|
|
403
|
+
...(options.staging === true ? ['--staging'] : []),
|
|
404
|
+
];
|
|
405
|
+
if (runtime.mode === 'container') {
|
|
406
|
+
return [
|
|
407
|
+
'docker', 'run', '--rm',
|
|
408
|
+
'-v', `${join(target.proxyRoot, 'letsencrypt')}:${CONTAINER_CERT_ROOT}`,
|
|
409
|
+
'-v', `${join(target.proxyRoot, 'webroot')}:${CONTAINER_WEBROOT}`,
|
|
410
|
+
CERTBOT_IMAGE,
|
|
411
|
+
'certonly',
|
|
412
|
+
'--webroot', '-w', CONTAINER_WEBROOT,
|
|
413
|
+
...common,
|
|
414
|
+
];
|
|
415
|
+
}
|
|
416
|
+
return [
|
|
417
|
+
'certbot', 'certonly',
|
|
418
|
+
'--webroot', '--webroot-path', join(target.proxyRoot, 'webroot'),
|
|
419
|
+
...common,
|
|
420
|
+
'--config-dir', join(target.proxyRoot, 'letsencrypt'),
|
|
421
|
+
'--work-dir', join(target.proxyRoot, 'letsencrypt', 'work'),
|
|
422
|
+
'--logs-dir', join(target.proxyRoot, 'letsencrypt', 'logs'),
|
|
423
|
+
];
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Writes, validates and activates the vhost, rolling back on failure.
|
|
427
|
+
*
|
|
428
|
+
* The rollback is the reason this function exists rather than a `writeFileSync`
|
|
429
|
+
* at the call site.
|
|
430
|
+
*/
|
|
431
|
+
export async function installVhost(target, options) {
|
|
432
|
+
assertValidDomain(target.domain);
|
|
433
|
+
const path = vhostPath(target);
|
|
434
|
+
const rendered = renderVhost(target, effectiveRuntime(target, options), {
|
|
435
|
+
...(options.maxBodyBytes === undefined ? {} : { maxBodyBytes: options.maxBodyBytes }),
|
|
436
|
+
});
|
|
437
|
+
const existed = existsSync(path);
|
|
438
|
+
const previous = existed ? readFileSync(path, 'utf8') : undefined;
|
|
439
|
+
if (previous === rendered) {
|
|
440
|
+
if (options.forceReload === true) {
|
|
441
|
+
// The vhost TEXT is unchanged, but what it points at is not: a
|
|
442
|
+
// certificate was just (re)issued to the same path (issue #640).
|
|
443
|
+
// nginx never notices that on its own, so it is told directly.
|
|
444
|
+
await reloadProxy(options);
|
|
445
|
+
options.hooks?.onProgress?.(`Reloaded ${target.domain} to serve the renewed certificate`);
|
|
446
|
+
return { path, changed: false };
|
|
447
|
+
}
|
|
448
|
+
// Byte-identical, so there is nothing to validate and nothing to reload.
|
|
449
|
+
options.hooks?.onProgress?.(`Vhost for ${target.domain} is already current`);
|
|
450
|
+
return { path, changed: false };
|
|
451
|
+
}
|
|
452
|
+
mkdirSync(join(target.proxyRoot, 'nginx', 'conf.d'), { recursive: true });
|
|
453
|
+
writeFileSync(path, rendered, { mode: 0o644 });
|
|
454
|
+
const validation = await validateProxy(options);
|
|
455
|
+
if (!validation.ok) {
|
|
456
|
+
// Put the proxy back EXACTLY as it was found, then confirm that actually
|
|
457
|
+
// worked before reporting - a rollback that leaves nginx broken is worse
|
|
458
|
+
// than the original failure.
|
|
459
|
+
if (previous === undefined) {
|
|
460
|
+
rmSync(path, { force: true });
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
writeFileSync(path, previous, { mode: 0o644 });
|
|
464
|
+
}
|
|
465
|
+
const after = await validateProxy(options);
|
|
466
|
+
const restored = after.ok
|
|
467
|
+
? 'The proxy has been restored and still validates.'
|
|
468
|
+
: 'WARNING: the proxy does not validate even after rolling back; it was already broken before this run.';
|
|
469
|
+
throw new UsageError(`The vhost for ${target.domain} did not pass nginx -t, so it was removed.\n${validation.output}\n${restored}`);
|
|
470
|
+
}
|
|
471
|
+
await reloadProxy(options);
|
|
472
|
+
options.hooks?.onProgress?.(`Published ${target.domain}`);
|
|
473
|
+
return { path, changed: true };
|
|
474
|
+
}
|
|
475
|
+
/** Runs `nginx -t`, in the container when the proxy is containerised. */
|
|
476
|
+
export async function validateProxy(options) {
|
|
477
|
+
const container = proxyContainerOf(options);
|
|
478
|
+
const argv = container === undefined ? ['nginx', '-t'] : ['docker', 'exec', container, 'nginx', '-t'];
|
|
479
|
+
try {
|
|
480
|
+
const result = await options.runCommand(argv, { cwd: process.cwd(), timeoutMs: 60_000 });
|
|
481
|
+
return { ok: true, output: `${result.stdout}${result.stderr}`.trim() };
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
const failure = error;
|
|
485
|
+
return {
|
|
486
|
+
ok: false,
|
|
487
|
+
output: `${failure.result?.stdout ?? ''}${failure.result?.stderr ?? ''}`.trim() ||
|
|
488
|
+
(error instanceof Error ? error.message : String(error)),
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
/** Reloads, never restarts: a restart drops every other site's connections. */
|
|
493
|
+
export async function reloadProxy(options) {
|
|
494
|
+
const container = proxyContainerOf(options);
|
|
495
|
+
const argv = reloadArgv(container);
|
|
496
|
+
await options.runCommand(argv, { cwd: process.cwd(), timeoutMs: 60_000 });
|
|
497
|
+
}
|
|
498
|
+
function reloadArgv(container) {
|
|
499
|
+
return container === undefined
|
|
500
|
+
? ['nginx', '-s', 'reload']
|
|
501
|
+
: ['docker', 'exec', container, 'nginx', '-s', 'reload'];
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The exact remedy command an OPERATOR should run by hand, for THIS
|
|
505
|
+
* deployment's actual configured runtime (issue #642, #640) -- never a
|
|
506
|
+
* hardcoded container name. This repository is a template: a fork's proxy
|
|
507
|
+
* container can be named anything, or run on the host with none at all, and
|
|
508
|
+
* a remedy naming the wrong one sends an operator to fix someone else's site.
|
|
509
|
+
*/
|
|
510
|
+
export function describeReloadCommand(runtime) {
|
|
511
|
+
const container = runtime.mode === 'container' ? runtime.container : undefined;
|
|
512
|
+
return `sudo ${reloadArgv(container).join(' ')}`;
|
|
513
|
+
}
|
|
514
|
+
/** Removes a vhost this tool wrote. Used only to undo a failed install. */
|
|
515
|
+
export async function removeVhost(target, options) {
|
|
516
|
+
const path = vhostPath(target);
|
|
517
|
+
if (!existsSync(path))
|
|
518
|
+
return;
|
|
519
|
+
// Only ever a file this tool wrote: the header is the marker, and a vhost
|
|
520
|
+
// without it belongs to somebody else.
|
|
521
|
+
const contents = readFileSync(path, 'utf8');
|
|
522
|
+
if (!contents.startsWith(PROXY_MANAGED_SENTINEL)) {
|
|
523
|
+
throw new UsageError(`${path} was not written by appctl, so it will not be removed. Remove it by hand if that is really what you want.`);
|
|
524
|
+
}
|
|
525
|
+
rmSync(path, { force: true });
|
|
526
|
+
const validation = await validateProxy(options);
|
|
527
|
+
if (validation.ok)
|
|
528
|
+
await reloadProxy(options);
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Creates the shared proxy's directory layout if it is not there.
|
|
532
|
+
*
|
|
533
|
+
* Both the design spec and the operator runbook state that install bootstraps
|
|
534
|
+
* `/opt/infra/proxy` when absent. It did not: `proxy-root`, `proxy-conf-writable`
|
|
535
|
+
* and `acme-webroot` were `required` preflight checks that simply failed, so an
|
|
536
|
+
* operator following the runbook on a fresh VPS hit a refusal the documentation
|
|
537
|
+
* told them would not happen. This is that promise, kept.
|
|
538
|
+
*
|
|
539
|
+
* It creates DIRECTORIES only. It does not write an nginx configuration, start
|
|
540
|
+
* a container, or touch a certificate: those are the shared infrastructure this
|
|
541
|
+
* CLI is a tenant of, not an owner of, and bringing them up is the host's job.
|
|
542
|
+
* What is created is exactly the three paths this deployment will write into.
|
|
543
|
+
*
|
|
544
|
+
* Idempotent, and deliberately silent when everything already exists -- the
|
|
545
|
+
* ordinary case on every host after the first deployment.
|
|
546
|
+
*/
|
|
547
|
+
export function bootstrapProxyRoot(proxyRoot, hooks) {
|
|
548
|
+
const needed = [
|
|
549
|
+
join(proxyRoot, 'nginx', 'conf.d'),
|
|
550
|
+
join(proxyRoot, 'letsencrypt'),
|
|
551
|
+
join(proxyRoot, 'webroot'),
|
|
552
|
+
];
|
|
553
|
+
const created = [];
|
|
554
|
+
for (const path of needed) {
|
|
555
|
+
if (existsSync(path))
|
|
556
|
+
continue;
|
|
557
|
+
mkdirSync(path, { recursive: true });
|
|
558
|
+
created.push(path);
|
|
559
|
+
}
|
|
560
|
+
if (created.length > 0) {
|
|
561
|
+
hooks?.onProgress?.(`Created the shared proxy layout under ${proxyRoot}`);
|
|
562
|
+
}
|
|
563
|
+
return { created };
|
|
564
|
+
}
|
|
565
|
+
/** Days before expiry at which a certificate is considered due for renewal. */
|
|
566
|
+
export const RENEW_WITHIN_DAYS = 30;
|
|
567
|
+
/**
|
|
568
|
+
* Reads a certificate's expiry with openssl.
|
|
569
|
+
*
|
|
570
|
+
* ⚠ AN UNREADABLE EXPIRY IS NOT "NOT DUE". `dueForRenewal` is false in that
|
|
571
|
+
* case, but `problem` is set and the caller must surface it -- silently
|
|
572
|
+
* treating an unparseable certificate as healthy is how one quietly expires.
|
|
573
|
+
* The same reasoning as `certificate-validity` in the doctor registry, which is
|
|
574
|
+
* why both parse the same `notAfter=` line.
|
|
575
|
+
*/
|
|
576
|
+
export async function certificateExpiry(target, options) {
|
|
577
|
+
const status = certificateStatus(target);
|
|
578
|
+
if (!status.exists) {
|
|
579
|
+
return { exists: false, path: status.path, notAfter: null, daysRemaining: null, dueForRenewal: false };
|
|
580
|
+
}
|
|
581
|
+
let output;
|
|
582
|
+
try {
|
|
583
|
+
const result = await options.runCommand(['openssl', 'x509', '-enddate', '-noout', '-in', status.path], { cwd: target.proxyRoot, timeoutMs: 15_000 });
|
|
584
|
+
output = result.stdout;
|
|
585
|
+
}
|
|
586
|
+
catch (error) {
|
|
587
|
+
return {
|
|
588
|
+
exists: true,
|
|
589
|
+
path: status.path,
|
|
590
|
+
notAfter: null,
|
|
591
|
+
daysRemaining: null,
|
|
592
|
+
dueForRenewal: false,
|
|
593
|
+
problem: `could not read the expiry: ${error.message}`,
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
const raw = /notAfter=(.+)/.exec(output)?.[1]?.trim();
|
|
597
|
+
const expiry = raw === undefined ? undefined : new Date(raw);
|
|
598
|
+
if (expiry === undefined || Number.isNaN(expiry.getTime())) {
|
|
599
|
+
return {
|
|
600
|
+
exists: true,
|
|
601
|
+
path: status.path,
|
|
602
|
+
notAfter: null,
|
|
603
|
+
daysRemaining: null,
|
|
604
|
+
dueForRenewal: false,
|
|
605
|
+
problem: `unrecognised expiry: ${raw ?? '(absent)'}`,
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
const now = options.now ?? new Date();
|
|
609
|
+
const daysRemaining = Math.floor((expiry.getTime() - now.getTime()) / 86_400_000);
|
|
610
|
+
return {
|
|
611
|
+
exists: true,
|
|
612
|
+
path: status.path,
|
|
613
|
+
notAfter: expiry,
|
|
614
|
+
daysRemaining,
|
|
615
|
+
dueForRenewal: daysRemaining <= RENEW_WITHIN_DAYS,
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Whether the certificate the proxy is ACTUALLY serving over the wire is the
|
|
620
|
+
* one on disk (issue #642).
|
|
621
|
+
*
|
|
622
|
+
* `issueCertificate`/`installVhost` keep disk and the running proxy in sync,
|
|
623
|
+
* but only in the SAME run that replaces a certificate -- nothing else in
|
|
624
|
+
* this CLI ever asks afterwards whether that actually took. And it cannot be
|
|
625
|
+
* inferred from the existing health probes: every loopback check
|
|
626
|
+
* (`/api/health/live`, `/ready`, `/`) talks plain HTTP to 127.0.0.1 and never
|
|
627
|
+
* goes through TLS at all, so a served/disk mismatch is invisible to every
|
|
628
|
+
* OTHER check this CLI runs. This is the one place that actually looks.
|
|
629
|
+
*
|
|
630
|
+
* Compares by fingerprint, not issuer or expiry text: two certificates can
|
|
631
|
+
* share an issuer and even an expiry down to the day while being genuinely
|
|
632
|
+
* different certificates (a reissued one for the same domain, differently
|
|
633
|
+
* keyed). The fingerprint is the one thing that only matches byte-identical
|
|
634
|
+
* DER.
|
|
635
|
+
*/
|
|
636
|
+
export async function certificateServedMatchesDisk(target, options) {
|
|
637
|
+
const status = certificateStatus(target);
|
|
638
|
+
if (!status.exists)
|
|
639
|
+
return { checked: false };
|
|
640
|
+
let disk;
|
|
641
|
+
try {
|
|
642
|
+
disk = new X509Certificate(readFileSync(status.path));
|
|
643
|
+
}
|
|
644
|
+
catch (error) {
|
|
645
|
+
return { checked: false, detail: `could not read ${status.path}: ${error.message}` };
|
|
646
|
+
}
|
|
647
|
+
let output;
|
|
648
|
+
try {
|
|
649
|
+
// stdio's stdin is 'ignore' (executor.ts), which is an immediately-closed
|
|
650
|
+
// /dev/null to the child -- equivalent to the familiar
|
|
651
|
+
// `openssl s_client ... </dev/null`, so this exits right after the
|
|
652
|
+
// handshake instead of hanging in s_client's interactive mode.
|
|
653
|
+
const result = await options.runCommand(['openssl', 's_client', '-connect', `${target.domain}:443`, '-servername', target.domain], { cwd: target.proxyRoot, timeoutMs: options.timeoutMs ?? 15_000 });
|
|
654
|
+
output = result.stdout;
|
|
655
|
+
}
|
|
656
|
+
catch (error) {
|
|
657
|
+
// s_client's own EOF-on-close can exit non-zero even after it already
|
|
658
|
+
// printed the certificate -- the printed chain is what matters, so a
|
|
659
|
+
// failure result is still read for it before being treated as "could not
|
|
660
|
+
// reach this domain at all".
|
|
661
|
+
const partial = error.result?.stdout;
|
|
662
|
+
if (partial === undefined || !/BEGIN CERTIFICATE/.test(partial)) {
|
|
663
|
+
// Its own reasons to fail (refused, DNS, timeout) are the external
|
|
664
|
+
// health probe's job to report; this only compares when it could reach
|
|
665
|
+
// something.
|
|
666
|
+
return { checked: false, detail: `could not reach ${target.domain}:443: ${error.message}` };
|
|
667
|
+
}
|
|
668
|
+
output = partial;
|
|
669
|
+
}
|
|
670
|
+
const pem = /-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/.exec(output)?.[0];
|
|
671
|
+
if (pem === undefined) {
|
|
672
|
+
return { checked: false, detail: `${target.domain}:443 did not present a certificate` };
|
|
673
|
+
}
|
|
674
|
+
let served;
|
|
675
|
+
try {
|
|
676
|
+
served = new X509Certificate(pem);
|
|
677
|
+
}
|
|
678
|
+
catch (error) {
|
|
679
|
+
return { checked: false, detail: `could not parse the served certificate: ${error.message}` };
|
|
680
|
+
}
|
|
681
|
+
return {
|
|
682
|
+
checked: true,
|
|
683
|
+
matches: disk.fingerprint256 === served.fingerprint256,
|
|
684
|
+
diskIssuer: disk.issuer,
|
|
685
|
+
servedIssuer: served.issuer,
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Renews a certificate that is inside the renewal window, then validates and
|
|
690
|
+
* reloads the proxy so the renewed certificate is actually served.
|
|
691
|
+
*
|
|
692
|
+
* ⚠ It renews only when the expiry says so. Let's Encrypt allows 5 DUPLICATE
|
|
693
|
+
* certificates per week, and a command that re-issued on every invocation would
|
|
694
|
+
* exhaust that during a single debugging session -- leaving the deployment
|
|
695
|
+
* unable to get a certificate at the moment it most needs one. `force` exists
|
|
696
|
+
* for an operator who has decided otherwise and is deliberately not the default.
|
|
697
|
+
*/
|
|
698
|
+
export async function renewCertificate(target, options) {
|
|
699
|
+
assertValidDomain(target.domain);
|
|
700
|
+
const expiry = await certificateExpiry(target, {
|
|
701
|
+
runCommand: options.runCommand,
|
|
702
|
+
...(options.now === undefined ? {} : { now: options.now }),
|
|
703
|
+
});
|
|
704
|
+
if (!expiry.exists) {
|
|
705
|
+
return { renewed: false, reloaded: false, reason: 'no certificate is installed for this domain', expiry };
|
|
706
|
+
}
|
|
707
|
+
if (options.force !== true && expiry.problem !== undefined) {
|
|
708
|
+
// Refuses rather than renewing: an unreadable expiry is a question, and
|
|
709
|
+
// spending a rate-limited issuance to answer it is the wrong trade.
|
|
710
|
+
return { renewed: false, reloaded: false, reason: expiry.problem, expiry };
|
|
711
|
+
}
|
|
712
|
+
if (options.force !== true && !expiry.dueForRenewal) {
|
|
713
|
+
return {
|
|
714
|
+
renewed: false,
|
|
715
|
+
reloaded: false,
|
|
716
|
+
reason: `not due: ${String(expiry.daysRemaining)} day(s) remaining, renews within ${RENEW_WITHIN_DAYS}`,
|
|
717
|
+
expiry,
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
const argv = certbotArgv(target, effectiveRuntime(target, options), {
|
|
721
|
+
email: options.email,
|
|
722
|
+
staging: options.staging,
|
|
723
|
+
forceRenewal: true,
|
|
724
|
+
});
|
|
725
|
+
await options.runCommand(argv, { cwd: target.proxyRoot, timeoutMs: 5 * 60_000 });
|
|
726
|
+
const after = await certificateExpiry(target, {
|
|
727
|
+
runCommand: options.runCommand,
|
|
728
|
+
...(options.now === undefined ? {} : { now: options.now }),
|
|
729
|
+
});
|
|
730
|
+
// ⚠ THE RELOAD IS LOAD-BEARING. nginx reads the certificate when it loads
|
|
731
|
+
// its configuration, so a renewed certificate on disk is NOT a served one:
|
|
732
|
+
// until the proxy reloads it keeps serving the old certificate until that
|
|
733
|
+
// expires, on a server whose files all look correct. Validated first, so a
|
|
734
|
+
// neighbour's broken vhost cannot be turned into a failed reload for every
|
|
735
|
+
// site on the box.
|
|
736
|
+
const validation = await validateProxy(options);
|
|
737
|
+
if (!validation.ok) {
|
|
738
|
+
return {
|
|
739
|
+
renewed: true,
|
|
740
|
+
reloaded: false,
|
|
741
|
+
reason: `renewed, but the proxy was NOT reloaded because nginx -t failed: ${validation.output}`,
|
|
742
|
+
expiry: after,
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
try {
|
|
746
|
+
await reloadProxy(options);
|
|
747
|
+
}
|
|
748
|
+
catch (error) {
|
|
749
|
+
return {
|
|
750
|
+
renewed: true,
|
|
751
|
+
reloaded: false,
|
|
752
|
+
reason: `renewed, but the proxy reload failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
753
|
+
expiry: after,
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
return { renewed: true, reloaded: true, reason: 'renewed and the proxy reloaded', expiry: after };
|
|
757
|
+
}
|
|
758
|
+
//# sourceMappingURL=proxy.js.map
|