@supatype/cli 0.9.1 → 0.10.0
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 +499 -91
- package/bin/node-version.js +28 -0
- package/bin/supatype.js +8 -4
- package/dist/api-config-cache.d.ts +22 -8
- package/dist/api-config-cache.d.ts.map +1 -1
- package/dist/api-config-cache.js +82 -19
- package/dist/api-config-cache.js.map +1 -1
- package/dist/api-config-stack.d.ts +23 -0
- package/dist/api-config-stack.d.ts.map +1 -0
- package/dist/api-config-stack.js +63 -0
- package/dist/api-config-stack.js.map +1 -0
- package/dist/api-url.d.ts +12 -0
- package/dist/api-url.d.ts.map +1 -0
- package/dist/api-url.js +17 -0
- package/dist/api-url.js.map +1 -0
- package/dist/app/framework.d.ts +18 -2
- package/dist/app/framework.d.ts.map +1 -1
- package/dist/app/framework.js +26 -3
- package/dist/app/framework.js.map +1 -1
- package/dist/app/port-holder.d.ts +33 -0
- package/dist/app/port-holder.d.ts.map +1 -0
- package/dist/app/port-holder.js +66 -0
- package/dist/app/port-holder.js.map +1 -0
- package/dist/app/proxy-dev-app.d.ts +27 -3
- package/dist/app/proxy-dev-app.d.ts.map +1 -1
- package/dist/app/proxy-dev-app.js +100 -46
- package/dist/app/proxy-dev-app.js.map +1 -1
- package/dist/app/vite-dev-args.d.ts +33 -0
- package/dist/app/vite-dev-args.d.ts.map +1 -0
- package/dist/app/vite-dev-args.js +90 -0
- package/dist/app/vite-dev-args.js.map +1 -0
- package/dist/app-config.d.ts +2 -0
- package/dist/app-config.d.ts.map +1 -1
- package/dist/app-config.js +27 -8
- package/dist/app-config.js.map +1 -1
- package/dist/applied-ast-artifacts.d.ts +7 -2
- package/dist/applied-ast-artifacts.d.ts.map +1 -1
- package/dist/applied-ast-artifacts.js +8 -3
- package/dist/applied-ast-artifacts.js.map +1 -1
- package/dist/archive-extract.d.ts +21 -2
- package/dist/archive-extract.d.ts.map +1 -1
- package/dist/archive-extract.js +30 -11
- package/dist/archive-extract.js.map +1 -1
- package/dist/augmentation-generator.d.ts +9 -0
- package/dist/augmentation-generator.d.ts.map +1 -1
- package/dist/augmentation-generator.js +75 -8
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/auth-answer.d.ts +1 -1
- package/dist/auth-answer.js +1 -1
- package/dist/auth-config-validate.d.ts +3 -0
- package/dist/auth-config-validate.d.ts.map +1 -0
- package/dist/auth-config-validate.js +85 -0
- package/dist/auth-config-validate.js.map +1 -0
- package/dist/auth-groups-env.d.ts +14 -0
- package/dist/auth-groups-env.d.ts.map +1 -0
- package/dist/auth-groups-env.js +53 -0
- package/dist/auth-groups-env.js.map +1 -0
- package/dist/auth-providers.d.ts +6 -14
- package/dist/auth-providers.d.ts.map +1 -1
- package/dist/auth-providers.js +6 -36
- package/dist/auth-providers.js.map +1 -1
- package/dist/auth-settings-push.d.ts +29 -0
- package/dist/auth-settings-push.d.ts.map +1 -0
- package/dist/auth-settings-push.js +176 -0
- package/dist/auth-settings-push.js.map +1 -0
- package/dist/binary-cache.d.ts +4 -1
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +33 -63
- package/dist/binary-cache.js.map +1 -1
- package/dist/binary-download-lock.d.ts.map +1 -1
- package/dist/binary-download-lock.js +2 -10
- package/dist/binary-download-lock.js.map +1 -1
- package/dist/browser-login.d.ts +42 -0
- package/dist/browser-login.d.ts.map +1 -0
- package/dist/browser-login.js +111 -0
- package/dist/browser-login.js.map +1 -0
- package/dist/build-public-env.d.ts +29 -0
- package/dist/build-public-env.d.ts.map +1 -0
- package/dist/build-public-env.js +97 -0
- package/dist/build-public-env.js.map +1 -0
- package/dist/build-refused.d.ts +9 -0
- package/dist/build-refused.d.ts.map +1 -0
- package/dist/build-refused.js +9 -0
- package/dist/build-refused.js.map +1 -0
- package/dist/cache-provider.d.ts +17 -2
- package/dist/cache-provider.d.ts.map +1 -1
- package/dist/cache-provider.js +28 -3
- package/dist/cache-provider.js.map +1 -1
- package/dist/cdn-fetch.d.ts +36 -0
- package/dist/cdn-fetch.d.ts.map +1 -0
- package/dist/cdn-fetch.js +175 -0
- package/dist/cdn-fetch.js.map +1 -0
- package/dist/channel-extractor.d.ts +51 -0
- package/dist/channel-extractor.d.ts.map +1 -0
- package/dist/channel-extractor.js +485 -0
- package/dist/channel-extractor.js.map +1 -0
- package/dist/cli-launcher.d.ts.map +1 -1
- package/dist/cli-launcher.js +3 -2
- package/dist/cli-launcher.js.map +1 -1
- package/dist/cli-release-check.d.ts +34 -0
- package/dist/cli-release-check.d.ts.map +1 -0
- package/dist/cli-release-check.js +79 -0
- package/dist/cli-release-check.js.map +1 -0
- package/dist/cli-standalone.d.ts +16 -0
- package/dist/cli-standalone.d.ts.map +1 -1
- package/dist/cli-standalone.js +92 -47
- package/dist/cli-standalone.js.map +1 -1
- package/dist/cli-version-embedded.d.ts.map +1 -1
- package/dist/cli-version-embedded.js +1 -1
- package/dist/cli-version-embedded.js.map +1 -1
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -1
- package/dist/cli.js.map +1 -1
- package/dist/client-generator.d.ts.map +1 -1
- package/dist/client-generator.js +9 -3
- package/dist/client-generator.js.map +1 -1
- package/dist/cloud-admin.d.ts +55 -0
- package/dist/cloud-admin.d.ts.map +1 -0
- package/dist/cloud-admin.js +99 -0
- package/dist/cloud-admin.js.map +1 -0
- package/dist/cloud-credentials.d.ts +24 -9
- package/dist/cloud-credentials.d.ts.map +1 -1
- package/dist/cloud-credentials.js +57 -47
- package/dist/cloud-credentials.js.map +1 -1
- package/dist/cloud-saml-key.d.ts +9 -0
- package/dist/cloud-saml-key.d.ts.map +1 -0
- package/dist/cloud-saml-key.js +44 -0
- package/dist/cloud-saml-key.js.map +1 -0
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +79 -24
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +22 -2
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/build.d.ts +3 -2
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +10 -13
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +16 -5
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/cloud.d.ts +2 -0
- package/dist/commands/cloud.d.ts.map +1 -1
- package/dist/commands/cloud.js +96 -23
- package/dist/commands/cloud.js.map +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +2 -1
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts +21 -2
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +97 -97
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +31 -4
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +261 -77
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +16 -4
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +163 -54
- package/dist/commands/functions.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +3 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/hooks.d.ts.map +1 -1
- package/dist/commands/hooks.js +40 -9
- package/dist/commands/hooks.js.map +1 -1
- package/dist/commands/init.d.ts +20 -8
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +358 -137
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/keys.d.ts +6 -0
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +17 -10
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/link-helpers.d.ts +4 -1
- package/dist/commands/link-helpers.d.ts.map +1 -1
- package/dist/commands/link-helpers.js +64 -12
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/login.d.ts +3 -2
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +99 -57
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/migrate.d.ts +17 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +22 -4
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/push.d.ts +35 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +117 -21
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/seed.d.ts +31 -45
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +93 -215
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/self-host.d.ts +3 -3
- package/dist/commands/self-host.d.ts.map +1 -1
- package/dist/commands/self-host.js +88 -270
- package/dist/commands/self-host.js.map +1 -1
- package/dist/commands/site.d.ts +42 -0
- package/dist/commands/site.d.ts.map +1 -0
- package/dist/commands/site.js +100 -0
- package/dist/commands/site.js.map +1 -0
- package/dist/commands/sso.d.ts +13 -3
- package/dist/commands/sso.d.ts.map +1 -1
- package/dist/commands/sso.js +58 -16
- package/dist/commands/sso.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +161 -68
- package/dist/commands/update.js.map +1 -1
- package/dist/compose-auth-settings.d.ts +12 -0
- package/dist/compose-auth-settings.d.ts.map +1 -0
- package/dist/compose-auth-settings.js +39 -0
- package/dist/compose-auth-settings.js.map +1 -0
- package/dist/compose-db-roles.d.ts.map +1 -1
- package/dist/compose-db-roles.js +6 -0
- package/dist/compose-db-roles.js.map +1 -1
- package/dist/compose-kong.d.ts +5 -1
- package/dist/compose-kong.d.ts.map +1 -1
- package/dist/compose-kong.js +8 -4
- package/dist/compose-kong.js.map +1 -1
- package/dist/compose-rename.d.ts.map +1 -1
- package/dist/compose-rename.js +5 -0
- package/dist/compose-rename.js.map +1 -1
- package/dist/compose-render-mode.d.ts +8 -3
- package/dist/compose-render-mode.d.ts.map +1 -1
- package/dist/compose-render-mode.js +22 -13
- package/dist/compose-render-mode.js.map +1 -1
- package/dist/compose-services.d.ts.map +1 -1
- package/dist/compose-services.js +3 -2
- package/dist/compose-services.js.map +1 -1
- package/dist/config-mailer-env.d.ts +6 -2
- package/dist/config-mailer-env.d.ts.map +1 -1
- package/dist/config-mailer-env.js +11 -13
- package/dist/config-mailer-env.js.map +1 -1
- package/dist/config-version-pin.d.ts +42 -0
- package/dist/config-version-pin.d.ts.map +1 -0
- package/dist/config-version-pin.js +64 -0
- package/dist/config-version-pin.js.map +1 -0
- package/dist/config.d.ts +5 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -2
- package/dist/config.js.map +1 -1
- package/dist/cors-origins-push.d.ts +16 -0
- package/dist/cors-origins-push.d.ts.map +1 -0
- package/dist/cors-origins-push.js +37 -0
- package/dist/cors-origins-push.js.map +1 -0
- package/dist/database-url-owner.d.ts.map +1 -1
- package/dist/database-url-owner.js +2 -1
- package/dist/database-url-owner.js.map +1 -1
- package/dist/db-port.d.ts +3 -1
- package/dist/db-port.d.ts.map +1 -1
- package/dist/db-port.js +1 -1
- package/dist/db-port.js.map +1 -1
- package/dist/destructive-consent.d.ts.map +1 -1
- package/dist/destructive-consent.js +23 -1
- package/dist/destructive-consent.js.map +1 -1
- package/dist/dev-compose.d.ts +9 -4
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +112 -71
- package/dist/dev-compose.js.map +1 -1
- package/dist/dev-functions-watch.d.ts +25 -4
- package/dist/dev-functions-watch.d.ts.map +1 -1
- package/dist/dev-functions-watch.js +78 -13
- package/dist/dev-functions-watch.js.map +1 -1
- package/dist/dev-initial-push.d.ts.map +1 -1
- package/dist/dev-initial-push.js +6 -0
- package/dist/dev-initial-push.js.map +1 -1
- package/dist/dev-ports.d.ts +7 -2
- package/dist/dev-ports.d.ts.map +1 -1
- package/dist/dev-ports.js +44 -22
- package/dist/dev-ports.js.map +1 -1
- package/dist/dev-ready-panel.d.ts +26 -3
- package/dist/dev-ready-panel.d.ts.map +1 -1
- package/dist/dev-ready-panel.js +37 -5
- package/dist/dev-ready-panel.js.map +1 -1
- package/dist/dev-schema-watch.d.ts +6 -0
- package/dist/dev-schema-watch.d.ts.map +1 -1
- package/dist/dev-schema-watch.js +9 -0
- package/dist/dev-schema-watch.js.map +1 -1
- package/dist/dev-self-start.d.ts +16 -0
- package/dist/dev-self-start.d.ts.map +1 -0
- package/dist/dev-self-start.js +31 -0
- package/dist/dev-self-start.js.map +1 -0
- package/dist/dev-session-lock.d.ts +71 -2
- package/dist/dev-session-lock.d.ts.map +1 -1
- package/dist/dev-session-lock.js +105 -5
- package/dist/dev-session-lock.js.map +1 -1
- package/dist/dev-session.d.ts +6 -1
- package/dist/dev-session.d.ts.map +1 -1
- package/dist/dev-session.js +9 -3
- package/dist/dev-session.js.map +1 -1
- package/dist/dev-shutdown.d.ts +11 -2
- package/dist/dev-shutdown.d.ts.map +1 -1
- package/dist/dev-shutdown.js +23 -9
- package/dist/dev-shutdown.js.map +1 -1
- package/dist/diff-access.d.ts.map +1 -1
- package/dist/diff-access.js +17 -1
- package/dist/diff-access.js.map +1 -1
- package/dist/diff-channels.d.ts +14 -0
- package/dist/diff-channels.d.ts.map +1 -0
- package/dist/diff-channels.js +38 -0
- package/dist/diff-channels.js.map +1 -0
- package/dist/docker-exec.d.ts +25 -4
- package/dist/docker-exec.d.ts.map +1 -1
- package/dist/docker-exec.js +88 -8
- package/dist/docker-exec.js.map +1 -1
- package/dist/docker-postgres.d.ts +11 -0
- package/dist/docker-postgres.d.ts.map +1 -1
- package/dist/docker-postgres.js +9 -1
- package/dist/docker-postgres.js.map +1 -1
- package/dist/docker-runtime.d.ts +31 -7
- package/dist/docker-runtime.d.ts.map +1 -1
- package/dist/docker-runtime.js +104 -36
- package/dist/docker-runtime.js.map +1 -1
- package/dist/engine-answers.d.ts.map +1 -1
- package/dist/engine-answers.js +2 -1
- package/dist/engine-answers.js.map +1 -1
- package/dist/engine-client.d.ts +28 -0
- package/dist/engine-client.d.ts.map +1 -1
- package/dist/engine-client.js +4 -4
- package/dist/engine-client.js.map +1 -1
- package/dist/engine-columns.d.ts +26 -0
- package/dist/engine-columns.d.ts.map +1 -0
- package/dist/engine-columns.js +67 -0
- package/dist/engine-columns.js.map +1 -0
- package/dist/engine-floor.d.ts +35 -0
- package/dist/engine-floor.d.ts.map +1 -1
- package/dist/engine-floor.js +67 -0
- package/dist/engine-floor.js.map +1 -1
- package/dist/engine-ownership-gate.d.ts +11 -1
- package/dist/engine-ownership-gate.d.ts.map +1 -1
- package/dist/engine-ownership-gate.js +32 -0
- package/dist/engine-ownership-gate.js.map +1 -1
- package/dist/engine-push-output.d.ts +12 -4
- package/dist/engine-push-output.d.ts.map +1 -1
- package/dist/engine-push-output.js.map +1 -1
- package/dist/env-file.d.ts +36 -3
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +82 -11
- package/dist/env-file.js.map +1 -1
- package/dist/env-lines.d.ts +5 -2
- package/dist/env-lines.d.ts.map +1 -1
- package/dist/env-lines.js +18 -3
- package/dist/env-lines.js.map +1 -1
- package/dist/env-managed-record.d.ts +20 -0
- package/dist/env-managed-record.d.ts.map +1 -0
- package/dist/env-managed-record.js +56 -0
- package/dist/env-managed-record.js.map +1 -0
- package/dist/error-message.d.ts.map +1 -1
- package/dist/error-message.js +7 -3
- package/dist/error-message.js.map +1 -1
- package/dist/frontend-env.d.ts +3 -2
- package/dist/frontend-env.d.ts.map +1 -1
- package/dist/frontend-env.js +4 -5
- package/dist/frontend-env.js.map +1 -1
- package/dist/frontend-values-linked.d.ts +3 -0
- package/dist/frontend-values-linked.d.ts.map +1 -1
- package/dist/frontend-values-linked.js +3 -2
- package/dist/frontend-values-linked.js.map +1 -1
- package/dist/frontend-values.d.ts +2 -1
- package/dist/frontend-values.d.ts.map +1 -1
- package/dist/frontend-values.js +2 -1
- package/dist/frontend-values.js.map +1 -1
- package/dist/functions-context-refresh.d.ts.map +1 -1
- package/dist/functions-context-refresh.js +5 -2
- package/dist/functions-context-refresh.js.map +1 -1
- package/dist/functions-deno-types.d.ts +6 -0
- package/dist/functions-deno-types.d.ts.map +1 -1
- package/dist/functions-deno-types.js +43 -35
- package/dist/functions-deno-types.js.map +1 -1
- package/dist/functions-env-local.d.ts +7 -2
- package/dist/functions-env-local.d.ts.map +1 -1
- package/dist/functions-env-local.js +8 -3
- package/dist/functions-env-local.js.map +1 -1
- package/dist/functions-worker-files.d.ts.map +1 -1
- package/dist/functions-worker-files.js +2 -13
- package/dist/functions-worker-files.js.map +1 -1
- package/dist/generated/functions-worker-source.d.ts.map +1 -1
- package/dist/generated/functions-worker-source.js +6 -3
- package/dist/generated/functions-worker-source.js.map +1 -1
- package/dist/generated/release-images.d.ts +6 -6
- package/dist/generated/release-images.js +3 -3
- package/dist/generated-files-engine.d.ts +9 -0
- package/dist/generated-files-engine.d.ts.map +1 -1
- package/dist/generated-files-engine.js +23 -0
- package/dist/generated-files-engine.js.map +1 -1
- package/dist/gitignore.d.ts +29 -2
- package/dist/gitignore.d.ts.map +1 -1
- package/dist/gitignore.js +86 -21
- package/dist/gitignore.js.map +1 -1
- package/dist/hooks-generator.d.ts.map +1 -1
- package/dist/hooks-generator.js +32 -10
- package/dist/hooks-generator.js.map +1 -1
- package/dist/hooks-worker-reload.d.ts +18 -0
- package/dist/hooks-worker-reload.d.ts.map +1 -0
- package/dist/hooks-worker-reload.js +19 -0
- package/dist/hooks-worker-reload.js.map +1 -0
- package/dist/host-database.d.ts +6 -2
- package/dist/host-database.d.ts.map +1 -1
- package/dist/host-database.js +10 -2
- package/dist/host-database.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/init-dependency-versions.d.ts +2 -3
- package/dist/init-dependency-versions.d.ts.map +1 -1
- package/dist/init-dependency-versions.js +12 -9
- package/dist/init-dependency-versions.js.map +1 -1
- package/dist/init-example.d.ts.map +1 -1
- package/dist/init-example.js +13 -1
- package/dist/init-example.js.map +1 -1
- package/dist/init-expo-runtime-env.d.ts +25 -0
- package/dist/init-expo-runtime-env.d.ts.map +1 -0
- package/dist/init-expo-runtime-env.js +112 -0
- package/dist/init-expo-runtime-env.js.map +1 -0
- package/dist/init-next-runtime-env.d.ts +14 -1
- package/dist/init-next-runtime-env.d.ts.map +1 -1
- package/dist/init-next-runtime-env.js +116 -35
- package/dist/init-next-runtime-env.js.map +1 -1
- package/dist/init-package-json.d.ts +12 -3
- package/dist/init-package-json.d.ts.map +1 -1
- package/dist/init-package-json.js +35 -15
- package/dist/init-package-json.js.map +1 -1
- package/dist/init-port-registry.d.ts +19 -0
- package/dist/init-port-registry.d.ts.map +1 -0
- package/dist/init-port-registry.js +57 -0
- package/dist/init-port-registry.js.map +1 -0
- package/dist/init-project-detect.d.ts +20 -0
- package/dist/init-project-detect.d.ts.map +1 -1
- package/dist/init-project-detect.js +41 -8
- package/dist/init-project-detect.js.map +1 -1
- package/dist/init-setup-steps.d.ts +32 -4
- package/dist/init-setup-steps.d.ts.map +1 -1
- package/dist/init-setup-steps.js +114 -18
- package/dist/init-setup-steps.js.map +1 -1
- package/dist/init-vite-node.d.ts +21 -0
- package/dist/init-vite-node.d.ts.map +1 -0
- package/dist/init-vite-node.js +75 -0
- package/dist/init-vite-node.js.map +1 -0
- package/dist/jsx-first-child.d.ts +18 -0
- package/dist/jsx-first-child.d.ts.map +1 -0
- package/dist/jsx-first-child.js +53 -0
- package/dist/jsx-first-child.js.map +1 -0
- package/dist/keyspace-password-file.d.ts +46 -0
- package/dist/keyspace-password-file.d.ts.map +1 -0
- package/dist/keyspace-password-file.js +128 -0
- package/dist/keyspace-password-file.js.map +1 -0
- package/dist/keyspace-port.d.ts +14 -0
- package/dist/keyspace-port.d.ts.map +1 -0
- package/dist/keyspace-port.js +35 -0
- package/dist/keyspace-port.js.map +1 -0
- package/dist/kong-config.d.ts +6 -0
- package/dist/kong-config.d.ts.map +1 -1
- package/dist/kong-config.js +119 -20
- package/dist/kong-config.js.map +1 -1
- package/dist/link.d.ts +30 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +70 -16
- package/dist/link.js.map +1 -1
- package/dist/local-gateway.d.ts +11 -3
- package/dist/local-gateway.d.ts.map +1 -1
- package/dist/local-gateway.js +16 -7
- package/dist/local-gateway.js.map +1 -1
- package/dist/local-secrets.d.ts +22 -0
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +29 -0
- package/dist/local-secrets.js.map +1 -1
- package/dist/local-stack-guard.d.ts +8 -0
- package/dist/local-stack-guard.d.ts.map +1 -1
- package/dist/local-stack-guard.js +44 -3
- package/dist/local-stack-guard.js.map +1 -1
- package/dist/local-stack.d.ts +2 -0
- package/dist/local-stack.d.ts.map +1 -1
- package/dist/local-stack.js +14 -8
- package/dist/local-stack.js.map +1 -1
- package/dist/local-storage.d.ts +3 -5
- package/dist/local-storage.d.ts.map +1 -1
- package/dist/local-storage.js +10 -10
- package/dist/local-storage.js.map +1 -1
- package/dist/mailer-autoconfirm.d.ts +29 -24
- package/dist/mailer-autoconfirm.d.ts.map +1 -1
- package/dist/mailer-autoconfirm.js +47 -43
- package/dist/mailer-autoconfirm.js.map +1 -1
- package/dist/mailer-env.d.ts +8 -1
- package/dist/mailer-env.d.ts.map +1 -1
- package/dist/mailer-env.js +52 -8
- package/dist/mailer-env.js.map +1 -1
- package/dist/model-hooks.d.ts +6 -4
- package/dist/model-hooks.d.ts.map +1 -1
- package/dist/model-hooks.js +14 -8
- package/dist/model-hooks.js.map +1 -1
- package/dist/model-versioning.d.ts +6 -0
- package/dist/model-versioning.d.ts.map +1 -1
- package/dist/model-versioning.js +12 -0
- package/dist/model-versioning.js.map +1 -1
- package/dist/native-dev-env.d.ts +38 -3
- package/dist/native-dev-env.d.ts.map +1 -1
- package/dist/native-dev-env.js +98 -7
- package/dist/native-dev-env.js.map +1 -1
- package/dist/native-keyspace.d.ts +31 -6
- package/dist/native-keyspace.d.ts.map +1 -1
- package/dist/native-keyspace.js +70 -20
- package/dist/native-keyspace.js.map +1 -1
- package/dist/native-leftover-postgres.d.ts +23 -0
- package/dist/native-leftover-postgres.d.ts.map +1 -0
- package/dist/native-leftover-postgres.js +55 -0
- package/dist/native-leftover-postgres.js.map +1 -0
- package/dist/native-leftover-services.d.ts +17 -0
- package/dist/native-leftover-services.d.ts.map +1 -0
- package/dist/native-leftover-services.js +93 -0
- package/dist/native-leftover-services.js.map +1 -0
- package/dist/native-pg-auth.d.ts.map +1 -1
- package/dist/native-pg-auth.js +2 -1
- package/dist/native-pg-auth.js.map +1 -1
- package/dist/native-port-lock.d.ts +37 -0
- package/dist/native-port-lock.d.ts.map +1 -0
- package/dist/native-port-lock.js +78 -0
- package/dist/native-port-lock.js.map +1 -0
- package/dist/native-realtime.d.ts +6 -3
- package/dist/native-realtime.d.ts.map +1 -1
- package/dist/native-realtime.js +65 -24
- package/dist/native-realtime.js.map +1 -1
- package/dist/native-roles-sql.d.ts.map +1 -1
- package/dist/native-roles-sql.js +2 -1
- package/dist/native-roles-sql.js.map +1 -1
- package/dist/native-stale-session.d.ts +17 -0
- package/dist/native-stale-session.d.ts.map +1 -0
- package/dist/native-stale-session.js +42 -0
- package/dist/native-stale-session.js.map +1 -0
- package/dist/native-storage-import.d.ts.map +1 -1
- package/dist/native-storage-import.js +6 -5
- package/dist/native-storage-import.js.map +1 -1
- package/dist/native-storage.d.ts +42 -7
- package/dist/native-storage.d.ts.map +1 -1
- package/dist/native-storage.js +196 -50
- package/dist/native-storage.js.map +1 -1
- package/dist/native-worker.d.ts +15 -0
- package/dist/native-worker.d.ts.map +1 -1
- package/dist/native-worker.js +26 -0
- package/dist/native-worker.js.map +1 -1
- package/dist/open-browser.d.ts +7 -0
- package/dist/open-browser.d.ts.map +1 -0
- package/dist/open-browser.js +26 -0
- package/dist/open-browser.js.map +1 -0
- package/dist/parent-watch.d.ts.map +1 -1
- package/dist/parent-watch.js +4 -8
- package/dist/parent-watch.js.map +1 -1
- package/dist/personal-access-token.d.ts +7 -0
- package/dist/personal-access-token.d.ts.map +1 -0
- package/dist/personal-access-token.js +11 -0
- package/dist/personal-access-token.js.map +1 -0
- package/dist/plan-sql.d.ts +30 -0
- package/dist/plan-sql.d.ts.map +1 -0
- package/dist/plan-sql.js +65 -0
- package/dist/plan-sql.js.map +1 -0
- package/dist/platform-settings-push.d.ts +15 -0
- package/dist/platform-settings-push.d.ts.map +1 -0
- package/dist/platform-settings-push.js +100 -0
- package/dist/platform-settings-push.js.map +1 -0
- package/dist/platform-settings.d.ts +81 -0
- package/dist/platform-settings.d.ts.map +1 -0
- package/dist/platform-settings.js +164 -0
- package/dist/platform-settings.js.map +1 -0
- package/dist/postgres-ctl.d.ts +45 -5
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +59 -21
- package/dist/postgres-ctl.js.map +1 -1
- package/dist/postgres-image.d.ts +27 -2
- package/dist/postgres-image.d.ts.map +1 -1
- package/dist/postgres-image.js +58 -13
- package/dist/postgres-image.js.map +1 -1
- package/dist/postgrest-release.d.ts +1 -1
- package/dist/postgrest-release.d.ts.map +1 -1
- package/dist/postgrest-release.js +3 -1
- package/dist/postgrest-release.js.map +1 -1
- package/dist/process-info.d.ts +14 -0
- package/dist/process-info.d.ts.map +1 -0
- package/dist/process-info.js +41 -0
- package/dist/process-info.js.map +1 -0
- package/dist/process-manager.d.ts +78 -4
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +128 -46
- package/dist/process-manager.js.map +1 -1
- package/dist/process-tree.d.ts +48 -0
- package/dist/process-tree.d.ts.map +1 -0
- package/dist/process-tree.js +141 -0
- package/dist/process-tree.js.map +1 -0
- package/dist/project-config.d.ts +121 -10
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +62 -1
- package/dist/project-config.js.map +1 -1
- package/dist/release-images.d.ts +21 -0
- package/dist/release-images.d.ts.map +1 -1
- package/dist/release-images.js +24 -0
- package/dist/release-images.js.map +1 -1
- package/dist/required-host-components.d.ts.map +1 -1
- package/dist/required-host-components.js +3 -5
- package/dist/required-host-components.js.map +1 -1
- package/dist/resolve-target.d.ts +42 -2
- package/dist/resolve-target.d.ts.map +1 -1
- package/dist/resolve-target.js +115 -21
- package/dist/resolve-target.js.map +1 -1
- package/dist/rest-cache-admin.d.ts +13 -0
- package/dist/rest-cache-admin.d.ts.map +1 -1
- package/dist/rest-cache-admin.js +36 -1
- package/dist/rest-cache-admin.js.map +1 -1
- package/dist/rest-ready.d.ts +6 -0
- package/dist/rest-ready.d.ts.map +1 -1
- package/dist/rest-ready.js +18 -2
- package/dist/rest-ready.js.map +1 -1
- package/dist/route-manifest.d.ts +24 -0
- package/dist/route-manifest.d.ts.map +1 -1
- package/dist/route-manifest.js +60 -2
- package/dist/route-manifest.js.map +1 -1
- package/dist/run-captured.d.ts +3 -1
- package/dist/run-captured.d.ts.map +1 -1
- package/dist/run-captured.js.map +1 -1
- package/dist/run-until-stopped.d.ts +3 -0
- package/dist/run-until-stopped.d.ts.map +1 -1
- package/dist/run-until-stopped.js +25 -11
- package/dist/run-until-stopped.js.map +1 -1
- package/dist/runtime-routes.d.ts +5 -0
- package/dist/runtime-routes.d.ts.map +1 -1
- package/dist/runtime-routes.js +10 -5
- package/dist/runtime-routes.js.map +1 -1
- package/dist/schema-ast-v2.d.ts +38 -0
- package/dist/schema-ast-v2.d.ts.map +1 -1
- package/dist/schema-ast-v2.js +2 -0
- package/dist/schema-ast-v2.js.map +1 -1
- package/dist/schema-reset.d.ts.map +1 -1
- package/dist/schema-reset.js +2 -0
- package/dist/schema-reset.js.map +1 -1
- package/dist/secret-sql.d.ts +13 -0
- package/dist/secret-sql.d.ts.map +1 -0
- package/dist/secret-sql.js +13 -0
- package/dist/secret-sql.js.map +1 -0
- package/dist/seed-default-export.d.ts +12 -0
- package/dist/seed-default-export.d.ts.map +1 -0
- package/dist/seed-default-export.js +44 -0
- package/dist/seed-default-export.js.map +1 -0
- package/dist/seed-ir.d.ts +8 -1
- package/dist/seed-ir.d.ts.map +1 -1
- package/dist/seed-ir.js +92 -6
- package/dist/seed-ir.js.map +1 -1
- package/dist/seed-prepare.d.ts +60 -0
- package/dist/seed-prepare.d.ts.map +1 -0
- package/dist/seed-prepare.js +115 -0
- package/dist/seed-prepare.js.map +1 -0
- package/dist/seed-remote.d.ts +22 -0
- package/dist/seed-remote.d.ts.map +1 -0
- package/dist/seed-remote.js +203 -0
- package/dist/seed-remote.js.map +1 -0
- package/dist/seed-report.d.ts +65 -0
- package/dist/seed-report.d.ts.map +1 -0
- package/dist/seed-report.js +98 -0
- package/dist/seed-report.js.map +1 -0
- package/dist/seed.d.ts +15 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/self-host-compose.d.ts +21 -1
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +349 -78
- package/dist/self-host-compose.js.map +1 -1
- package/dist/site-build-env.d.ts +31 -0
- package/dist/site-build-env.d.ts.map +1 -0
- package/dist/site-build-env.js +29 -0
- package/dist/site-build-env.js.map +1 -0
- package/dist/site-deploy.d.ts +52 -0
- package/dist/site-deploy.d.ts.map +1 -0
- package/dist/site-deploy.js +230 -0
- package/dist/site-deploy.js.map +1 -0
- package/dist/site-public-env.d.ts +67 -0
- package/dist/site-public-env.d.ts.map +1 -0
- package/dist/site-public-env.js +124 -0
- package/dist/site-public-env.js.map +1 -0
- package/dist/sso-admin.d.ts +15 -0
- package/dist/sso-admin.d.ts.map +1 -1
- package/dist/sso-admin.js +32 -9
- package/dist/sso-admin.js.map +1 -1
- package/dist/stack-exit-watch.d.ts +15 -0
- package/dist/stack-exit-watch.d.ts.map +1 -1
- package/dist/stack-exit-watch.js +41 -13
- package/dist/stack-exit-watch.js.map +1 -1
- package/dist/stack-folder.d.ts +28 -0
- package/dist/stack-folder.d.ts.map +1 -0
- package/dist/stack-folder.js +123 -0
- package/dist/stack-folder.js.map +1 -0
- package/dist/stack-running.d.ts +13 -0
- package/dist/stack-running.d.ts.map +1 -0
- package/dist/stack-running.js +44 -0
- package/dist/stack-running.js.map +1 -0
- package/dist/stack-setting-warnings.d.ts +8 -1
- package/dist/stack-setting-warnings.d.ts.map +1 -1
- package/dist/stack-setting-warnings.js +21 -1
- package/dist/stack-setting-warnings.js.map +1 -1
- package/dist/storage-provision.d.ts +12 -2
- package/dist/storage-provision.d.ts.map +1 -1
- package/dist/storage-provision.js +36 -11
- package/dist/storage-provision.js.map +1 -1
- package/dist/studio-admin-roles.d.ts +4 -4
- package/dist/studio-admin-roles.d.ts.map +1 -1
- package/dist/studio-admin-roles.js +6 -4
- package/dist/studio-admin-roles.js.map +1 -1
- package/dist/target-client.d.ts +13 -1
- package/dist/target-client.d.ts.map +1 -1
- package/dist/target-client.js +83 -17
- package/dist/target-client.js.map +1 -1
- package/dist/target-request.d.ts +5 -0
- package/dist/target-request.d.ts.map +1 -1
- package/dist/target-request.js +11 -2
- package/dist/target-request.js.map +1 -1
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +102 -10
- package/dist/type-extractor.js.map +1 -1
- package/dist/ui/clack-api.d.ts +2 -1
- package/dist/ui/clack-api.d.ts.map +1 -1
- package/dist/ui/clack-api.js +4 -4
- package/dist/ui/clack-api.js.map +1 -1
- package/dist/ui/clack.d.ts.map +1 -1
- package/dist/ui/clack.js +5 -2
- package/dist/ui/clack.js.map +1 -1
- package/dist/ui/dev/DevReadyPanelView.js +1 -1
- package/dist/ui/dev/DevReadyPanelView.js.map +1 -1
- package/dist/valkey-sidecar.d.ts +34 -13
- package/dist/valkey-sidecar.d.ts.map +1 -1
- package/dist/valkey-sidecar.js +65 -39
- package/dist/valkey-sidecar.js.map +1 -1
- package/dist/windows-processes.d.ts +7 -0
- package/dist/windows-processes.d.ts.map +1 -0
- package/dist/windows-processes.js +31 -0
- package/dist/windows-processes.js.map +1 -0
- package/dist/write-if-changed.d.ts +12 -0
- package/dist/write-if-changed.d.ts.map +1 -0
- package/dist/write-if-changed.js +32 -0
- package/dist/write-if-changed.js.map +1 -0
- package/package.json +7 -5
- package/releases/deno/VERSION +1 -1
- package/dist/commands/deploy-types.d.ts +0 -14
- package/dist/commands/deploy-types.d.ts.map +0 -1
- package/dist/commands/deploy-types.js +0 -38
- package/dist/commands/deploy-types.js.map +0 -1
- package/dist/systemd.d.ts +0 -26
- package/dist/systemd.d.ts.map +0 -1
- package/dist/systemd.js +0 -117
- package/dist/systemd.js.map +0 -1
|
@@ -6,34 +6,40 @@ import { composeHostPath } from "./compose-host-path.js";
|
|
|
6
6
|
export { composeHostPath } from "./compose-host-path.js";
|
|
7
7
|
import { ENGINE_SERVICE } from "./compose-engine-service.js";
|
|
8
8
|
import { requireDockerDaemon, requireDockerDaemonAsync } from "./docker-runtime.js";
|
|
9
|
-
import { askDocker, askDockerSync, NO_DOCKER_LIMIT, spawnDocker } from "./docker-exec.js";
|
|
9
|
+
import { askDocker, askDockerSync, DOCKER_QUERY_TIMEOUT_MS, NO_DOCKER_LIMIT, spawnDocker, } from "./docker-exec.js";
|
|
10
10
|
import { fatalError } from "./ui/fatal.js";
|
|
11
11
|
import { plain } from "./ui/messages.js";
|
|
12
12
|
import { getActiveFlowApi } from "./ui/runtime/flow-session.js";
|
|
13
13
|
import { COMPOSE_DEV_KONG_PORT, defaultAppStaticDir, postgrestSchemaEnv, externalDatabaseUrl, hooksPathFromProject, preferredFunctionsPathFromProject, realtimeEnabled, publicEnvServerEnv, serviceRoleRoutes, selfHostTlsEnabled, usesExternalDatabase, } from "./project-config.js";
|
|
14
14
|
import { hasStudioOverride, pinnedVersion, VERSION_PIN_LOCAL } from "./binary-cache.js";
|
|
15
15
|
import { assertEngineVersionSupported, engineImageVersion } from "./engine-floor.js";
|
|
16
|
-
import { buildKongDeclarative } from "./kong-config.js";
|
|
17
|
-
import { keyspaceInPostgres } from "./cache-provider.js";
|
|
18
|
-
import {
|
|
16
|
+
import { buildKongDeclarative, WORKER_LISTEN_PORT } from "./kong-config.js";
|
|
17
|
+
import { keyspaceInPostgres, keyspacePasswordRequired } from "./cache-provider.js";
|
|
18
|
+
import { checkedKeyspacePasswordFile, KEYSPACE_PASSWORD_CONTAINER_PATH, KEYSPACE_PASSWORD_FILE_ENV, } from "./keyspace-password-file.js";
|
|
19
|
+
import { configuredPostgresImage } from "./postgres-image.js";
|
|
19
20
|
import { STUDIO_DEV_PORT } from "./studio-dev-server.js";
|
|
20
21
|
import { readEnvFile, readEnvValue } from "./env-file.js";
|
|
22
|
+
import { OWN_BUCKET_S3_SETTINGS } from "./local-storage.js";
|
|
21
23
|
import { composeDbPublish, DB_PUBLIC_HOST_ENV, SELF_HOST_BIND } from "./db-port.js";
|
|
22
24
|
import { upKeepingKongCurrent, upKeepingKongCurrentAsync } from "./compose-kong.js";
|
|
23
25
|
import { addressPoolExhaustionHint } from "./docker-address-pool.js";
|
|
24
26
|
import { composeAuthProviderEnv } from "./auth-providers.js";
|
|
27
|
+
import { composeAuthGroupsEnv } from "./auth-groups-env.js";
|
|
25
28
|
import { composeSamlEnv, ensureSamlPrivateKey } from "./saml-config.js";
|
|
26
|
-
import { BUNDLED_DB_USER, CONTROL_PLANE_SECRET_ENV, ENV_FILE_OVER_SHELL, SQL_EDITOR_PASSWORD_ENV, ensureControlPlaneSecret, ensureObjectStoreCredentials, envFileOverridesShell, OBJECT_STORE_ACCESS_KEY_ENV, OBJECT_STORE_SECRET_KEY_ENV, } from "./local-secrets.js";
|
|
29
|
+
import { BUNDLED_DB_USER, CONTROL_PLANE_SECRET_ENV, FORWARDING_SECRET_ENV, ensureForwardingSecret, ENV_FILE_OVER_SHELL, SQL_EDITOR_PASSWORD_ENV, ensureControlPlaneSecret, ensureKeyspacePassword, ensureObjectStoreCredentials, KEYSPACE_PASSWORD_ENV, envFileOverridesShell, OBJECT_STORE_ACCESS_KEY_ENV, OBJECT_STORE_SECRET_KEY_ENV, } from "./local-secrets.js";
|
|
27
30
|
import { fieldMaskingTierFromProject } from "./field-masking-tier.js";
|
|
28
31
|
import { readRecordedTier } from "./recorded-field-masking-tier.js";
|
|
29
32
|
import { projectHasVersionedModels } from "./model-versioning.js";
|
|
30
33
|
import { POSTGREST_IMAGE } from "./postgrest-release.js";
|
|
31
34
|
import { postgrestHookActorEnv } from "./hook-actor.js";
|
|
32
|
-
import { IN_REPO_IMAGE_ENV, RELEASE_IMAGES, unpinnedImagesNote } from "./release-images.js";
|
|
33
|
-
import { configMailerAutoconfirm } from "./mailer-autoconfirm.js";
|
|
34
|
-
import {
|
|
35
|
+
import { IN_REPO_IMAGE_ENV, KONG_IMAGE, RELEASE_IMAGES, unpinnedImagesNote, VALKEY_IMAGE, } from "./release-images.js";
|
|
36
|
+
import { configEmailEnabled, configMailerAutoconfirm, EMAIL_ENABLED_ENV } from "./mailer-autoconfirm.js";
|
|
37
|
+
import { mailerUrlPathsEnv } from "./mailer-env.js";
|
|
38
|
+
import { resolveSpaFallback } from "./app/framework.js";
|
|
39
|
+
import { composeAllowListLine, composeDisableSignupFallback, composeMailerPassthrough, composeSiteUrlFallback, composeSmtpPass, } from "./compose-auth-settings.js";
|
|
35
40
|
import { studioRuntimeJson } from "./studio-auth-config.js";
|
|
36
|
-
import {
|
|
41
|
+
import { realtimeServiceDefaults, serviceSwitchServerEnv } from "./platform-settings.js";
|
|
42
|
+
import { switchServices } from "./route-manifest.js";
|
|
37
43
|
/**
|
|
38
44
|
* The control plane secret as the server and the control plane receive it, and nobody else.
|
|
39
45
|
*
|
|
@@ -41,6 +47,56 @@ import { patchRouteManifest } from "./route-manifest.js";
|
|
|
41
47
|
* refuse to start the stack and say which variable is missing.
|
|
42
48
|
*/
|
|
43
49
|
const CONTROL_PLANE_SECRET_REQUIRED = `${CONTROL_PLANE_SECRET_ENV}: \${${CONTROL_PLANE_SECRET_ENV}:?${CONTROL_PLANE_SECRET_ENV} is missing from .env}`;
|
|
50
|
+
/**
|
|
51
|
+
* The forwarding secret (D14 option 2b), required like the control plane secret: writeSelfHostCompose
|
|
52
|
+
* generates it first. The server believes a forwarded end-user address only on a request carrying it,
|
|
53
|
+
* Kong adds it to requests to the server, and the functions worker adds it to its calls to the stack.
|
|
54
|
+
* `name` is what the receiving service calls it: the server reads it under its own setting name.
|
|
55
|
+
*/
|
|
56
|
+
function forwardingSecretRequired(name = FORWARDING_SECRET_ENV) {
|
|
57
|
+
return `${name}: \${${FORWARDING_SECRET_ENV}:?${FORWARDING_SECRET_ENV} is missing from .env}`;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The keyspace password as the db, the server and Kong receive it, when the keyspace requires one
|
|
61
|
+
* (`keyspacePasswordRequired`). Required rather than defaulted, like the control plane secret:
|
|
62
|
+
* writeSelfHostCompose generates it first, and a stack started without it would refuse the server.
|
|
63
|
+
*/
|
|
64
|
+
const KEYSPACE_PASSWORD_REQUIRED = `${KEYSPACE_PASSWORD_ENV}: \${${KEYSPACE_PASSWORD_ENV}:?${KEYSPACE_PASSWORD_ENV} is missing from .env}`;
|
|
65
|
+
/**
|
|
66
|
+
* The keyspace password line for a service that talks RESP to the keyspace, or nothing when it
|
|
67
|
+
* requires none. Kong is one with TLS on: its ACME plugin keeps certificates there, and kong.yml
|
|
68
|
+
* names this variable through Kong's env vault rather than holding the value. With the password in
|
|
69
|
+
* a file (`passwordFile`, R2-S16), the line names the file where {@link keyspacePasswordMount}
|
|
70
|
+
* puts it; writeSelfHostCompose refuses that beside TLS, since Kong's env vault cannot read a file.
|
|
71
|
+
*/
|
|
72
|
+
function keyspacePasswordEnv(config, passwordFile) {
|
|
73
|
+
if (!keyspacePasswordRequired(config))
|
|
74
|
+
return "";
|
|
75
|
+
if (passwordFile === undefined)
|
|
76
|
+
return ` ${KEYSPACE_PASSWORD_REQUIRED}\n`;
|
|
77
|
+
return ` ${KEYSPACE_PASSWORD_FILE_ENV}: ${KEYSPACE_PASSWORD_CONTAINER_PATH}\n`;
|
|
78
|
+
}
|
|
79
|
+
/** The read-only mount of the project's keyspace password file, for a service the line above names it to. */
|
|
80
|
+
function keyspacePasswordMount(config, passwordFile) {
|
|
81
|
+
if (!keyspacePasswordRequired(config) || passwordFile === undefined)
|
|
82
|
+
return "";
|
|
83
|
+
return `${bindMount(passwordFile, KEYSPACE_PASSWORD_CONTAINER_PATH, true)}\n`;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The server's keyspace lines. Besides the environment compose gives it, the server reads the
|
|
87
|
+
* project's .env and .env.local, and refuses to start when it finds the password beside the file,
|
|
88
|
+
* so with a file the password is set blank here, which no dotenv file overrides.
|
|
89
|
+
*
|
|
90
|
+
* Beside a Valkey sidecar both are set blank for the same reason: `init` still writes the password
|
|
91
|
+
* to `.env`, the server loads it, and it would send AUTH as `supatype` to a Valkey that has no
|
|
92
|
+
* password (WRONGPASS on every cache call).
|
|
93
|
+
*/
|
|
94
|
+
function keyspaceServerEnv(config, passwordFile) {
|
|
95
|
+
if (!keyspaceInPostgres(config))
|
|
96
|
+
return ` ${KEYSPACE_PASSWORD_ENV}: ""\n ${KEYSPACE_PASSWORD_FILE_ENV}: ""\n`;
|
|
97
|
+
const lines = keyspacePasswordEnv(config, passwordFile);
|
|
98
|
+
return lines !== "" && passwordFile !== undefined ? `${lines} ${KEYSPACE_PASSWORD_ENV}: ""\n` : lines;
|
|
99
|
+
}
|
|
44
100
|
/** Env keys written when `versions` pins exist in supatype.config.ts. */
|
|
45
101
|
export const COMPOSE_PINNED_IMAGE_ENV_KEYS = [
|
|
46
102
|
"SUPATYPE_ENGINE_IMAGE",
|
|
@@ -61,6 +117,13 @@ const SEAWEEDFS_IMAGE = "chrislusf/seaweedfs:4.46@sha256:08d516132314207d10c8e37
|
|
|
61
117
|
* durable, and a response-cache key beside them did not.
|
|
62
118
|
*/
|
|
63
119
|
const ACME_KEY_PREFIX = "kong_acme:";
|
|
120
|
+
/**
|
|
121
|
+
* Anonymous sign-in from `.env`, off unless it turns it on (docs/auth/anonymous.mdx). Written only
|
|
122
|
+
* when the config does not set `auth.anonymous.enabled`: then the auth settings carry the key, with
|
|
123
|
+
* the config's value as its default, and a second line would be a duplicate key in the service.
|
|
124
|
+
*/
|
|
125
|
+
const ANONYMOUS_SIGN_IN_FROM_ENV = " # Anonymous sign-in, off unless .env turns it on (docs/auth/anonymous.mdx).\n" +
|
|
126
|
+
" SUPATYPE_EXTERNAL_ANONYMOUS_USERS_ENABLED: ${SUPATYPE_EXTERNAL_ANONYMOUS_USERS_ENABLED:-false}\n";
|
|
64
127
|
/**
|
|
65
128
|
* The project's object store login as compose reads it from `.env` (issue 71: every stack used to
|
|
66
129
|
* share one pair, written into this file). Required, not defaulted: writeSelfHostCompose generates
|
|
@@ -68,12 +131,47 @@ const ACME_KEY_PREFIX = "kong_acme:";
|
|
|
68
131
|
*/
|
|
69
132
|
const OBJECT_STORE_ACCESS_KEY = `\${${OBJECT_STORE_ACCESS_KEY_ENV}:?${OBJECT_STORE_ACCESS_KEY_ENV} is missing from .env}`;
|
|
70
133
|
const OBJECT_STORE_SECRET_KEY = `\${${OBJECT_STORE_SECRET_KEY_ENV}:?${OBJECT_STORE_SECRET_KEY_ENV} is missing from .env}`;
|
|
134
|
+
/**
|
|
135
|
+
* Whether the stack keeps files in the project's own S3 bucket rather than a SeaweedFS of its own:
|
|
136
|
+
* production storage is "s3" (`storage.production`, init's "Production storage?" answer). Never the
|
|
137
|
+
* Docker dev stack, which this generator also writes and which follows the dev setting (0.9.2).
|
|
138
|
+
*/
|
|
139
|
+
function keepsFilesInOwnBucket(config, devLocal) {
|
|
140
|
+
return !devLocal && config.storage?.production === "s3";
|
|
141
|
+
}
|
|
142
|
+
/** The project's S3 settings compose hands the storage service from `.env`, blank when unset. */
|
|
143
|
+
const OPTIONAL_OWN_BUCKET_SETTINGS = OWN_BUCKET_S3_SETTINGS.filter((name) => name !== "S3_BUCKET");
|
|
144
|
+
/**
|
|
145
|
+
* The storage service's S3 settings: the stack's SeaweedFS, every one passed so the service needs
|
|
146
|
+
* no defaults, or the project's own bucket in single-bucket mode, which only S3_BUCKET is required for.
|
|
147
|
+
*/
|
|
148
|
+
function storageS3Env(ownBucket) {
|
|
149
|
+
if (!ownBucket) {
|
|
150
|
+
return ` S3_ENDPOINT: http://seaweedfs:8333
|
|
151
|
+
S3_REGION: us-east-1
|
|
152
|
+
S3_ACCESS_KEY: ${OBJECT_STORE_ACCESS_KEY}
|
|
153
|
+
S3_SECRET_KEY: ${OBJECT_STORE_SECRET_KEY}
|
|
154
|
+
S3_FORCE_PATH_STYLE: "true"
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
return ` # storage.production is "s3": every bucket is a key prefix in the project's own S3 bucket, and
|
|
158
|
+
# the stack runs no SeaweedFS. A blank setting is read as unset (see the storage docs).
|
|
159
|
+
S3_BUCKET: "\${S3_BUCKET:?S3_BUCKET is missing from .env, and storage.production is s3 in supatype.config.ts}"
|
|
160
|
+
${OPTIONAL_OWN_BUCKET_SETTINGS.map((name) => ` ${name}: "\${${name}:-}"`).join("\n")}
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
71
163
|
/**
|
|
72
164
|
* The compose volume key Postgres keeps its data in. Docker names the volume
|
|
73
165
|
* `<compose project>_<key>`, and `supatype dev --reset-db` removes it by that name, so the key is
|
|
74
166
|
* declared once rather than spelled out in the file and again in the code that deletes it.
|
|
75
167
|
*/
|
|
76
168
|
export const DB_VOLUME_KEY = "db-data";
|
|
169
|
+
/**
|
|
170
|
+
* Bring the whole stack up, detached. `--remove-orphans` takes away the container of a service the
|
|
171
|
+
* compose file no longer has, as the valkey one is after `cache.provider` moves to pg_keyspace: it
|
|
172
|
+
* was left running beside the stack that replaced it (S-36). Its volume is data and is kept.
|
|
173
|
+
*/
|
|
174
|
+
export const COMPOSE_UP_DETACHED = ["up", "-d", "--remove-orphans"];
|
|
77
175
|
/**
|
|
78
176
|
* Map a config version pin to a Docker Hub image reference. Postgres is not here: its image and
|
|
79
177
|
* its keyspace capability are one decision, made by `postgresImageFor`.
|
|
@@ -94,7 +192,7 @@ export function dockerImageRef(component, version) {
|
|
|
94
192
|
*/
|
|
95
193
|
export function composeDockerImageEnv(config) {
|
|
96
194
|
const env = {};
|
|
97
|
-
const postgres =
|
|
195
|
+
const postgres = configuredPostgresImage(config).ref;
|
|
98
196
|
if (postgres)
|
|
99
197
|
env.SUPATYPE_POSTGRES_IMAGE = postgres;
|
|
100
198
|
const versions = config.versions;
|
|
@@ -212,6 +310,10 @@ export function selfHostComposePaths(cwd) {
|
|
|
212
310
|
s3ConfigPath: join(dir, "s3.json"),
|
|
213
311
|
};
|
|
214
312
|
}
|
|
313
|
+
/** The project folder a compose file {@link selfHostComposePaths} names lives in. */
|
|
314
|
+
export function projectRootOfComposePath(composePath) {
|
|
315
|
+
return dirname(dirname(dirname(composePath)));
|
|
316
|
+
}
|
|
215
317
|
export function appUpstreamForCompose(config) {
|
|
216
318
|
if (config.app.mode !== "proxy")
|
|
217
319
|
return undefined;
|
|
@@ -236,8 +338,18 @@ function bindMount(source, target, readOnly) {
|
|
|
236
338
|
...(readOnly ? [" read_only: true"] : []),
|
|
237
339
|
].join("\n");
|
|
238
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* The server's writable bind for the functions directory, or undefined when that directory is the
|
|
343
|
+
* project root. The auth server's admin env routes write `.env.local` and `.env.<name>.local` there.
|
|
344
|
+
*/
|
|
345
|
+
function functionsMount(root, functionsHostDir) {
|
|
346
|
+
const rel = relative(root, functionsHostDir);
|
|
347
|
+
if (rel === "")
|
|
348
|
+
return undefined;
|
|
349
|
+
return bindMount(functionsHostDir, `/project/${rel.split(sep).join("/")}`, false);
|
|
350
|
+
}
|
|
239
351
|
/** The bind mounts the generated stack uses, each naming its host path absolutely. */
|
|
240
|
-
function projectMounts(cwd) {
|
|
352
|
+
function projectMounts(cwd, functionsHostDir) {
|
|
241
353
|
const root = resolve(cwd);
|
|
242
354
|
const paths = selfHostComposePaths(cwd);
|
|
243
355
|
return {
|
|
@@ -245,6 +357,9 @@ function projectMounts(cwd) {
|
|
|
245
357
|
projectWritable: bindMount(root, "/project", false),
|
|
246
358
|
engineProject: bindMount(root, ENGINE_SERVICE.projectDir, false),
|
|
247
359
|
projectState: bindMount(join(root, ".supatype"), "/project/.supatype", false),
|
|
360
|
+
// Undefined when the functions are the project root itself: a writable bind there would make the
|
|
361
|
+
// whole project writable, which the read-only mount exists to prevent.
|
|
362
|
+
functionsDir: functionsMount(root, functionsHostDir),
|
|
248
363
|
kong: bindMount(paths.kongPath, "/etc/kong/kong.yml", true),
|
|
249
364
|
seaweed: bindMount(paths.s3ConfigPath, "/etc/seaweedfs/s3.json", true),
|
|
250
365
|
};
|
|
@@ -426,12 +541,26 @@ function publicEnvForCompose(config) {
|
|
|
426
541
|
return "";
|
|
427
542
|
return ` # server.public_env: no /supatype-env.json or /supatype-env.js.\n SUPATYPE_PUBLIC_ENV: "${value}"\n`;
|
|
428
543
|
}
|
|
429
|
-
|
|
544
|
+
/**
|
|
545
|
+
* The server's `SUPATYPE_STORAGE_DISABLED` and `SUPATYPE_GRAPHQL_DISABLED` lines, each ending in a
|
|
546
|
+
* newline, for a service `services` switches off; empty otherwise, leaving the server's default.
|
|
547
|
+
*/
|
|
548
|
+
function serviceSwitchesForCompose(config) {
|
|
549
|
+
return Object.entries(serviceSwitchServerEnv(config))
|
|
550
|
+
.map(([name, value]) => ` # services in supatype.config.ts switches this service off.\n ${name}: "${value}"\n`)
|
|
551
|
+
.join("");
|
|
552
|
+
}
|
|
553
|
+
function serverAppEnvForCompose(config, devLocal, cwd) {
|
|
430
554
|
const mode = config.app.mode ?? "none";
|
|
431
555
|
const lines = [` SUPATYPE_APP_MODE: ${mode}`];
|
|
432
556
|
if (mode === "static") {
|
|
433
557
|
const dir = appStaticDir(config);
|
|
434
558
|
lines.push(` SUPATYPE_APP_STATIC_DIR: /project/${dir.replace(/^\.\//, "")}`);
|
|
559
|
+
// Always the resolved value (`build.spa`, else the framework's default), the one `supatype deploy` sends to
|
|
560
|
+
// Cloud, so the gateway and Cloud agree. The second line lets Studio say the config set it.
|
|
561
|
+
lines.push(` SUPATYPE_APP_SPA_FALLBACK: "${resolveSpaFallback(config.build, cwd)}"`);
|
|
562
|
+
if (config.build?.spa !== undefined)
|
|
563
|
+
lines.push(' SUPATYPE_APP_SPA_FALLBACK_FROM_CONFIG: "true"');
|
|
435
564
|
}
|
|
436
565
|
else if (mode === "proxy" && config.app.upstream?.trim()) {
|
|
437
566
|
lines.push(` SUPATYPE_APP_UPSTREAM: ${proxyUpstreamForCompose(config.app.upstream, devLocal)}`);
|
|
@@ -461,6 +590,40 @@ function networksClause(networks) {
|
|
|
461
590
|
function networksBlock(functionsDb) {
|
|
462
591
|
return `networks:\n ${FUNCTIONS_NETWORK}: {}\n${functionsDb ? ` ${FUNCTIONS_DB_NETWORK}: {}\n` : ""}`;
|
|
463
592
|
}
|
|
593
|
+
/**
|
|
594
|
+
* Every container's log, rotated: 0.9.1 release test RB8.
|
|
595
|
+
*
|
|
596
|
+
* With no `logging:` a container writes to the daemon's default driver, and on a Linux server that
|
|
597
|
+
* is `json-file` with no size limit at all. An idle stack's Postgres wrote about 0.8 GB a day there,
|
|
598
|
+
* so the disk of the server the deploy guide describes filled in weeks and the database stopped.
|
|
599
|
+
* Docker Desktop's `local` default rotates, which is why nobody saw it on a laptop.
|
|
600
|
+
*
|
|
601
|
+
* `json-file` rather than `local` because it is what `docker logs` and every log shipper read
|
|
602
|
+
* without configuration. The sizes come from `.env`, as every other knob in this file does: the file
|
|
603
|
+
* is regenerated on every write, so an edit to it would not last.
|
|
604
|
+
*/
|
|
605
|
+
const LOGGING_ANCHOR = `x-logging: &default-logging
|
|
606
|
+
driver: json-file
|
|
607
|
+
options:
|
|
608
|
+
max-size: "\${SUPATYPE_LOG_MAX_SIZE:-10m}"
|
|
609
|
+
max-file: "\${SUPATYPE_LOG_MAX_FILE:-5}"
|
|
610
|
+
`;
|
|
611
|
+
/** A service's `logging:` line, pointing at {@link LOGGING_ANCHOR}. */
|
|
612
|
+
const LOGGING = " logging: *default-logging";
|
|
613
|
+
/**
|
|
614
|
+
* A long-running service's restart policy: restarted when it fails, five times at most. Never a
|
|
615
|
+
* one-shot tool (`schema-engine`), which is meant to exit.
|
|
616
|
+
*
|
|
617
|
+
* 0.9.2 release test (N-FF11): only the server had one. A storage service that refused its S3
|
|
618
|
+
* settings exited 1 under policy `no` and stayed down, and so did any service that failed on
|
|
619
|
+
* something transient, a store or database still starting. Bounded, as the server's always was,
|
|
620
|
+
* rather than `unless-stopped`: a real misconfiguration ends exited with its reason in its log, which
|
|
621
|
+
* is what the CLI's watch on a starting stack looks for (stack-exit-watch.ts), instead of
|
|
622
|
+
* restarting for ever.
|
|
623
|
+
*/
|
|
624
|
+
const RESTART = " restart: on-failure:5";
|
|
625
|
+
/** A long-running service's {@link LOGGING} and {@link RESTART} lines, which nearly every service has together. */
|
|
626
|
+
const SERVICE_DEFAULTS = `${LOGGING}\n${RESTART}`;
|
|
464
627
|
/** Whether `url` (functions' direct database URL) names the stack's own `db` service. */
|
|
465
628
|
export function namesComposeDatabase(url) {
|
|
466
629
|
try {
|
|
@@ -471,7 +634,16 @@ export function namesComposeDatabase(url) {
|
|
|
471
634
|
}
|
|
472
635
|
}
|
|
473
636
|
export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
474
|
-
const mounts = projectMounts(cwd);
|
|
637
|
+
const mounts = projectMounts(cwd, preferredFunctionsPathFromProject(config, cwd));
|
|
638
|
+
// The server alone gets the functions directory writable (see functionsMount); the worker keeps
|
|
639
|
+
// the read-only project.
|
|
640
|
+
const functionsBind = mounts.functionsDir === undefined
|
|
641
|
+
? ""
|
|
642
|
+
: ` # The functions directory is writable too: setting a function secret makes the auth server write
|
|
643
|
+
# .env.local and .env.<name>.local into it, which failed with "read-only file system" under the
|
|
644
|
+
# project mount above.
|
|
645
|
+
${mounts.functionsDir}
|
|
646
|
+
`;
|
|
475
647
|
const external = usesExternalDatabase(config);
|
|
476
648
|
// Both halves come from the caller because both need the schema loaded, which this renderer does
|
|
477
649
|
// not do. See `SelfHostComposeOptions`. One call, so the exposed schemas and the search path
|
|
@@ -489,6 +661,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
|
489
661
|
const postgrestUrl = postgrestDatabaseUrl(config);
|
|
490
662
|
const sqlEditorUrl = sqlEditorDatabaseUrl(config);
|
|
491
663
|
const devLocal = options?.devLocal === true;
|
|
664
|
+
const ownBucket = keepsFilesInOwnBucket(config, devLocal);
|
|
492
665
|
// An external database is not on any network of this stack.
|
|
493
666
|
const functionsDb = options?.functionsDatabase === true && !external;
|
|
494
667
|
const gatewayNetworks = networksClause(["default", FUNCTIONS_NETWORK]);
|
|
@@ -506,8 +679,10 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
|
506
679
|
const authProviderEnv = composeAuthProviderEnv(config, publicApiUrl);
|
|
507
680
|
// SAML's service provider sits under the same public URL, at /auth/v1 like the OAuth callback.
|
|
508
681
|
const samlEnv = composeSamlEnv(config, publicApiUrl);
|
|
682
|
+
// Hooks, captcha, password, session, MFA, phone and rate limit settings: only what the config states.
|
|
683
|
+
const authGroupsEnv = composeAuthGroupsEnv(config);
|
|
509
684
|
const studioHostDev = devLocal && hasStudioOverride(config);
|
|
510
|
-
const appEnv = serverAppEnvForCompose(config, devLocal);
|
|
685
|
+
const appEnv = serverAppEnvForCompose(config, devLocal, cwd);
|
|
511
686
|
const staticDir = appStaticDir(config);
|
|
512
687
|
// functions.path and the project root, as the containers see them. These were hardcoded to
|
|
513
688
|
// /project/functions and /project/hooks, so a project keeping its functions anywhere else had every
|
|
@@ -521,6 +696,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
|
521
696
|
: `
|
|
522
697
|
studio:
|
|
523
698
|
${studioService}
|
|
699
|
+
${SERVICE_DEFAULTS}
|
|
524
700
|
environment:
|
|
525
701
|
SUPATYPE_CLOUD_JSON: '${studioRuntimeJson(config, publicApiUrl)}'
|
|
526
702
|
expose:
|
|
@@ -568,11 +744,12 @@ ${studioService}
|
|
|
568
744
|
`;
|
|
569
745
|
// One source for the credentials: the server is configured with them and the storage service is
|
|
570
746
|
// handed them, and a mismatch does not fail at start, it fails at the first upload.
|
|
571
|
-
const objectStoreBlock = ` seaweedfs:
|
|
747
|
+
const objectStoreBlock = ownBucket ? "" : ` seaweedfs:
|
|
572
748
|
# Identities come from a config file rather than env vars, and the anonymous identity is
|
|
573
749
|
# deliberately absent: a bucket is public because of its policy, never because the server is
|
|
574
750
|
# open. Written beside this file by the same generator, so the two cannot drift.
|
|
575
751
|
image: \${SUPATYPE_SEAWEEDFS_IMAGE:-${SEAWEEDFS_IMAGE}}
|
|
752
|
+
${SERVICE_DEFAULTS}
|
|
576
753
|
command: server -dir=/data -s3 -s3.port=8333 -s3.config=/etc/seaweedfs/s3.json
|
|
577
754
|
environment:
|
|
578
755
|
# Read by nothing inside. The object store loads s3.json only when it starts, so the login is
|
|
@@ -591,11 +768,19 @@ ${mounts.seaweed}
|
|
|
591
768
|
retries: 20
|
|
592
769
|
start_period: 5s
|
|
593
770
|
${seaweedPorts}`;
|
|
771
|
+
// 0.9.2 release test (N-RB2): the keyspace requires the project's password where the image takes
|
|
772
|
+
// one, and everything that talks RESP to it is handed the same value from .env, or the same file
|
|
773
|
+
// (R2-S16).
|
|
774
|
+
const keyspacePasswordFile = options?.keyspacePasswordFile;
|
|
775
|
+
const keyspaceAuthEnv = keyspacePasswordEnv(config, keyspacePasswordFile);
|
|
776
|
+
const keyspaceMount = keyspacePasswordMount(config, keyspacePasswordFile);
|
|
777
|
+
// The second listener is the functions worker's (kong-config.ts, WORKER_LISTEN_PORT). It is in
|
|
778
|
+
// KONG_PROXY_LISTEN so the worker's forwarding headers survive, and in no `ports:` mapping below.
|
|
779
|
+
const kongListen = ["0.0.0.0:8000", `0.0.0.0:${WORKER_LISTEN_PORT}`, ...(tlsEnabled ? ["0.0.0.0:8443 ssl"] : [])].join(", ");
|
|
594
780
|
const kongTlsEnv = tlsEnabled
|
|
595
|
-
? `
|
|
596
|
-
KONG_LUA_SSL_TRUSTED_CERTIFICATE: system
|
|
781
|
+
? ` KONG_LUA_SSL_TRUSTED_CERTIFICATE: system
|
|
597
782
|
KONG_LUA_SSL_VERIFY_DEPTH: "2"
|
|
598
|
-
`
|
|
783
|
+
${keyspaceAuthEnv}`
|
|
599
784
|
: "";
|
|
600
785
|
const kongPorts = tlsEnabled
|
|
601
786
|
? ` - "80:8000"
|
|
@@ -612,7 +797,8 @@ ${seaweedPorts}`;
|
|
|
612
797
|
`
|
|
613
798
|
: `
|
|
614
799
|
valkey:
|
|
615
|
-
image: \${SUPATYPE_VALKEY_IMAGE
|
|
800
|
+
image: \${SUPATYPE_VALKEY_IMAGE:-${VALKEY_IMAGE}}
|
|
801
|
+
${SERVICE_DEFAULTS}
|
|
616
802
|
command: ["valkey-server", "--appendonly", "yes"]
|
|
617
803
|
expose:
|
|
618
804
|
- "6379"
|
|
@@ -629,9 +815,8 @@ ${seaweedPorts}`;
|
|
|
629
815
|
# then re-run \`supatype self-host compose up -d\`. Kong publishes :80/:443 and provisions certs automatically.
|
|
630
816
|
`;
|
|
631
817
|
// An external database is not ours to declare a volume for.
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
${keyspaceInPg ? "" : " valkey-data:\n"}`;
|
|
818
|
+
const volumes = `${external ? "" : ` ${DB_VOLUME_KEY}:\n`}${ownBucket ? "" : " storage-data:\n"}${keyspaceInPg ? "" : " valkey-data:\n"}`;
|
|
819
|
+
const volumesBlock = volumes === "" ? "" : `volumes:\n${volumes}`;
|
|
635
820
|
// `depends_on` for the services that talk to Postgres. With an external database there is no
|
|
636
821
|
// container to wait on, so the clause disappears entirely and each service retries on connect
|
|
637
822
|
// instead: which is also what covers a database that restarts *after* boot, something no
|
|
@@ -652,7 +837,7 @@ ${keyspaceInPg ? "" : " valkey-data:\n"}`;
|
|
|
652
837
|
//
|
|
653
838
|
// A later push succeeds, which is exactly what made it read as an intermittent mystery. It
|
|
654
839
|
// lands on the first push after a stack comes up, which is the first push a new user ever runs.
|
|
655
|
-
const storageDependency = ` depends_on:
|
|
840
|
+
const storageDependency = ownBucket ? dbDependency : ` depends_on:
|
|
656
841
|
${dbDependencyClause} seaweedfs:
|
|
657
842
|
condition: service_healthy
|
|
658
843
|
`;
|
|
@@ -664,9 +849,12 @@ ${dbDependencyClause} seaweedfs:
|
|
|
664
849
|
// container that can only report that. The server then has no realtime URL, which is what makes
|
|
665
850
|
// subscription requests fail with a clear route error instead of hanging against a dead upstream.
|
|
666
851
|
const realtime = realtimeEnabled(config);
|
|
852
|
+
// realtime.channels and realtime.recheckSeconds in the config, as the defaults a .env value overrides.
|
|
853
|
+
const realtimeDefaults = realtimeServiceDefaults(config);
|
|
667
854
|
const realtimeBlock = realtime
|
|
668
855
|
? ` realtime:
|
|
669
856
|
image: ${inRepoImage("realtime")}
|
|
857
|
+
${SERVICE_DEFAULTS}
|
|
670
858
|
expose:
|
|
671
859
|
- "4000"
|
|
672
860
|
- "4001"
|
|
@@ -685,6 +873,10 @@ ${dbDependencyClause} seaweedfs:
|
|
|
685
873
|
# debug also logs each change a subscriber's access rules withheld; info logs only the
|
|
686
874
|
# changes realtime could not judge. Set REALTIME_LOG_LEVEL in .env to change it.
|
|
687
875
|
REALTIME_LOG_LEVEL: \${REALTIME_LOG_LEVEL:-info}
|
|
876
|
+
# docs/realtime.md: declared can only tighten realtime.channels; the re-check interval in
|
|
877
|
+
# seconds. Empty, the service's own defaults apply.
|
|
878
|
+
REALTIME_CHANNELS: \${REALTIME_CHANNELS:-${realtimeDefaults.REALTIME_CHANNELS ?? ""}}
|
|
879
|
+
REALTIME_CHANNEL_RECHECK_S: \${REALTIME_CHANNEL_RECHECK_S:-${realtimeDefaults.REALTIME_CHANNEL_RECHECK_S ?? ""}}
|
|
688
880
|
${dbDependency}`
|
|
689
881
|
: ` # No \`realtime\` service: database.external.realtime is false. Subscriptions are
|
|
690
882
|
# unavailable; REST, storage, auth and functions are unaffected.
|
|
@@ -767,7 +959,7 @@ ${dbDependency}`
|
|
|
767
959
|
# Named here rather than left to the image because only this file knows both features are in
|
|
768
960
|
# the same stack.
|
|
769
961
|
SUPATYPE_KEYSPACE_OUTPUT_PLUGIN_LIBRARIES: "supacache_keys, wal2json"
|
|
770
|
-
`
|
|
962
|
+
${keyspaceAuthEnv}`
|
|
771
963
|
: "";
|
|
772
964
|
// Not published to the host: the keyspace is reachable to the compose network
|
|
773
965
|
// (server, Kong) and nothing else. A RESP port on a public interface is an
|
|
@@ -783,7 +975,12 @@ ${dbDependency}`
|
|
|
783
975
|
# database still needs (roles, extensions, wal_level for realtime).
|
|
784
976
|
`
|
|
785
977
|
: ` db:
|
|
786
|
-
image: \${SUPATYPE_POSTGRES_IMAGE:-${
|
|
978
|
+
image: \${SUPATYPE_POSTGRES_IMAGE:-${configuredPostgresImage(config).ref ?? RELEASE_IMAGES.postgres}}
|
|
979
|
+
# Docker's tini as PID 1, so postgres is not. PID 1 adopts every orphan in the container, and
|
|
980
|
+
# Postgres 17 restarts the whole server when an adopted child it never forked exits non-0/1,
|
|
981
|
+
# which is what a health check killed on timeout leaves behind (an orphaned pg_isready, exit 2).
|
|
982
|
+
init: true
|
|
983
|
+
${SERVICE_DEFAULTS}
|
|
787
984
|
${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} environment:
|
|
788
985
|
POSTGRES_USER: \${POSTGRES_USER:-supatype_admin}
|
|
789
986
|
POSTGRES_PASSWORD: \${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is missing from .env}
|
|
@@ -794,14 +991,16 @@ ${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} envir
|
|
|
794
991
|
SUPATYPE_SQL_EDITOR_PASSWORD: \${SUPATYPE_SQL_EDITOR_PASSWORD:?SUPATYPE_SQL_EDITOR_PASSWORD is missing from .env}
|
|
795
992
|
${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
|
|
796
993
|
- ${DB_VOLUME_KEY}:/var/lib/postgresql/data
|
|
797
|
-
healthcheck:
|
|
994
|
+
${keyspaceMount} healthcheck:
|
|
798
995
|
# -h 127.0.0.1 forces TCP. Without it \`pg_isready\` uses the Unix socket, which the
|
|
799
996
|
# entrypoint's temporary init server is already listening on while TCP is still refused,
|
|
800
997
|
# so the container reported healthy, \`depends_on: service_healthy\` released, and every
|
|
801
998
|
# service that connects over the network died with ECONNREFUSED on first boot. PostgREST
|
|
802
999
|
# survived only because it retries. Observed on a clean stack: server, storage and
|
|
803
1000
|
# realtime all exited 1 while db said "healthy".
|
|
804
|
-
|
|
1001
|
+
# Exec form, with pg_isready's own -t 2 under the 5s timeout below: shell form forks it under
|
|
1002
|
+
# sh, and when compose times a check out it kills the sh and orphans pg_isready.
|
|
1003
|
+
test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-U", "\${POSTGRES_USER:-supatype_admin}", "-d", "\${POSTGRES_DB:-supatype}", "-t", "2"]
|
|
805
1004
|
interval: 5s
|
|
806
1005
|
timeout: 5s
|
|
807
1006
|
# First boot runs initdb plus every bootstrap migration. Failures inside the start period
|
|
@@ -815,9 +1014,10 @@ ${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
|
|
|
815
1014
|
# Named, so a compose command run by hand reaches this stack instead of starting a second one
|
|
816
1015
|
# under the folder's name. \`supatype self-host compose restart <service>\` saves running one.
|
|
817
1016
|
name: ${composeProject}
|
|
818
|
-
services:
|
|
1017
|
+
${LOGGING_ANCHOR}services:
|
|
819
1018
|
${dbServiceBlock} postgrest:
|
|
820
1019
|
image: ${POSTGREST_IMAGE}
|
|
1020
|
+
${SERVICE_DEFAULTS}
|
|
821
1021
|
expose:
|
|
822
1022
|
- "3000"
|
|
823
1023
|
environment:
|
|
@@ -842,18 +1042,14 @@ ${dbServiceBlock} postgrest:
|
|
|
842
1042
|
${hookActorLines(config)}${dbDependency}
|
|
843
1043
|
storage:
|
|
844
1044
|
image: ${inRepoImage("storage")}
|
|
1045
|
+
${SERVICE_DEFAULTS}
|
|
845
1046
|
expose:
|
|
846
1047
|
- "5000"
|
|
847
1048
|
environment:
|
|
848
1049
|
PORT: 5000
|
|
849
1050
|
DATABASE_URL: "${ownerUrl}"
|
|
850
1051
|
JWT_SECRET: \${JWT_SECRET:?JWT_SECRET is missing from .env}
|
|
851
|
-
|
|
852
|
-
S3_REGION: us-east-1
|
|
853
|
-
S3_ACCESS_KEY: ${OBJECT_STORE_ACCESS_KEY}
|
|
854
|
-
S3_SECRET_KEY: ${OBJECT_STORE_SECRET_KEY}
|
|
855
|
-
S3_FORCE_PATH_STYLE: "true"
|
|
856
|
-
# Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
|
|
1052
|
+
${storageS3Env(ownBucket)} # Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
|
|
857
1053
|
# sets one; the service on its own defaults to the free tier's 1 GiB quota and 50 MB files.
|
|
858
1054
|
PROJECT_TIER: \${PROJECT_TIER:-enterprise}
|
|
859
1055
|
STORAGE_QUOTA: \${STORAGE_QUOTA:--1}
|
|
@@ -862,6 +1058,7 @@ ${hookActorLines(config)}${dbDependency}
|
|
|
862
1058
|
${storageDependency}
|
|
863
1059
|
functions-worker:
|
|
864
1060
|
image: ${inRepoImage("functions-worker")}
|
|
1061
|
+
${SERVICE_DEFAULTS}
|
|
865
1062
|
# An init as PID 1 passes the stop signal on: without one the worker ignored SIGTERM, and every
|
|
866
1063
|
# restart a deploy made waited out the whole stop timeout.
|
|
867
1064
|
init: true
|
|
@@ -894,8 +1091,10 @@ ${mounts.projectReadOnly}
|
|
|
894
1091
|
SUPATYPE_PROJECT_REF: ${JSON.stringify(config.project.name)}
|
|
895
1092
|
PORT: "8001"
|
|
896
1093
|
# In-compose loopback to Kong (not API_EXTERNAL_URL / localhost, unreachable from this container).
|
|
897
|
-
|
|
898
|
-
|
|
1094
|
+
# Kong's worker listener, never published: it keeps the St-Forwarded-For and St-Forwarding-Secret
|
|
1095
|
+
# this worker adds, where port 8000 removes them (kong-config.ts, D14).
|
|
1096
|
+
SUPATYPE_URL: http://kong:${WORKER_LISTEN_PORT}
|
|
1097
|
+
SUPATYPE_INTERNAL_URL: http://kong:${WORKER_LISTEN_PORT}
|
|
899
1098
|
# ctx.publicUrl: the address a browser or an app uses, for links a function gives to people.
|
|
900
1099
|
# The same value the server is told is its own, never a name only this stack resolves.
|
|
901
1100
|
SUPATYPE_PUBLIC_URL: ${publicApiUrl}
|
|
@@ -927,10 +1126,14 @@ ${mounts.projectReadOnly}
|
|
|
927
1126
|
STRIPE_SECRET_KEY: \${STRIPE_SECRET_KEY:-}
|
|
928
1127
|
STRIPE_WEBHOOK_SECRET: \${STRIPE_WEBHOOK_SECRET:-}
|
|
929
1128
|
SITE_URL: \${SITE_URL:-${publicApiUrl}}
|
|
1129
|
+
# Added to this worker's calls to the stack's own address, so the auth server believes the end
|
|
1130
|
+
# user's address they pass on. Withheld from function code by the worker.
|
|
1131
|
+
${forwardingSecretRequired()}
|
|
930
1132
|
${dbDependency}
|
|
931
1133
|
${realtimeBlock}
|
|
932
1134
|
control-plane:
|
|
933
1135
|
image: ${inRepoImage("control-plane")}
|
|
1136
|
+
${SERVICE_DEFAULTS}
|
|
934
1137
|
expose:
|
|
935
1138
|
- "8080"
|
|
936
1139
|
volumes:
|
|
@@ -956,6 +1159,7 @@ ${mounts.projectWritable}
|
|
|
956
1159
|
${realtimeControlPlaneEnv}${dbDependency}
|
|
957
1160
|
server:
|
|
958
1161
|
image: \${SUPATYPE_SERVER_IMAGE:-\${SUPATYPE_AUTH_IMAGE:-${RELEASE_IMAGES.server}}}
|
|
1162
|
+
${LOGGING}
|
|
959
1163
|
# host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
|
|
960
1164
|
# mapped, so a project proxying the site or Studio to something on the host worked on macOS
|
|
961
1165
|
# and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
|
|
@@ -969,7 +1173,7 @@ ${realtimeControlPlaneEnv}${dbDependency}
|
|
|
969
1173
|
# on a slow host the gap is wide enough to lose it for good. Bounded
|
|
970
1174
|
# rather than unlimited, so a real misconfiguration still stops and
|
|
971
1175
|
# stays visible instead of hiding in a crash loop.
|
|
972
|
-
|
|
1176
|
+
${RESTART}
|
|
973
1177
|
${gatewayNetworks}${serverPorts} volumes:
|
|
974
1178
|
# The project is read-only: the server reads the schema, the manifest and the functions, and
|
|
975
1179
|
# has no business editing any of them.
|
|
@@ -982,7 +1186,7 @@ ${mounts.projectReadOnly}
|
|
|
982
1186
|
# declared and never actually switched on. A narrower bind than making the whole project
|
|
983
1187
|
# writable, because the rest of the tree keeps the guarantee.
|
|
984
1188
|
${mounts.projectState}
|
|
985
|
-
working_dir: /project
|
|
1189
|
+
${functionsBind}${keyspaceMount} working_dir: /project
|
|
986
1190
|
environment:
|
|
987
1191
|
SUPATYPE_MODE: ${devLocal ? "dev" : "standalone"}
|
|
988
1192
|
SUPATYPE_MANIFEST_PATH: .supatype/manifest.json
|
|
@@ -993,7 +1197,7 @@ ${mounts.projectState}
|
|
|
993
1197
|
SUPATYPE_STORAGE_URL: http://storage:5000
|
|
994
1198
|
SUPATYPE_URL: ${publicApiUrl}
|
|
995
1199
|
SUPATYPE_ANON_KEY: \${ANON_KEY:-}
|
|
996
|
-
${publicEnvForCompose(config)} SUPATYPE_SERVICE_ROLE_KEY: \${SERVICE_ROLE_KEY:-}
|
|
1200
|
+
${publicEnvForCompose(config)}${serviceSwitchesForCompose(config)} SUPATYPE_SERVICE_ROLE_KEY: \${SERVICE_ROLE_KEY:-}
|
|
997
1201
|
SUPATYPE_SQL_DATABASE_URL: "${ownerUrl}"
|
|
998
1202
|
# The SQL editor's own login, not a superuser. The owner URL above stays: the server falls
|
|
999
1203
|
# back to it and uses it for role membership.
|
|
@@ -1005,23 +1209,32 @@ ${realtimeServerEnv}
|
|
|
1005
1209
|
SUPATYPE_CONTROL_PLANE_URL: http://control-plane:8080
|
|
1006
1210
|
${CONTROL_PLANE_SECRET_REQUIRED}
|
|
1007
1211
|
SUPATYPE_VALKEY_ADDR: ${respHost}:6379
|
|
1008
|
-
${appEnv}
|
|
1212
|
+
${keyspaceServerEnv(config, keyspacePasswordFile)}${appEnv}
|
|
1009
1213
|
SUPATYPE_API_HOST: 0.0.0.0
|
|
1010
1214
|
SUPATYPE_API_PORT: 9999
|
|
1011
1215
|
SUPATYPE_API_EXTERNAL_URL: ${publicApiUrl}
|
|
1216
|
+
# The client address the per-client limits (verify, OTP, sign-up, recover, token refresh)
|
|
1217
|
+
# count against. Kong writes X-Real-IP from the connection and replaces any the client sent;
|
|
1218
|
+
# X-Forwarded-For would keep the client's own text at the front. Unset, no request through
|
|
1219
|
+
# Kong was ever counted. Behind another proxy, set the header that proxy writes in .env.
|
|
1220
|
+
SUPATYPE_RATE_LIMIT_HEADER: "\${SUPATYPE_RATE_LIMIT_HEADER:-X-Real-IP}"
|
|
1221
|
+
# Believed only on a request carrying it: Kong adds it, a client cannot (D14).
|
|
1222
|
+
${forwardingSecretRequired("SUPATYPE_SECURITY_FORWARDING_SECRET")}
|
|
1012
1223
|
# Browser origins allowed besides the site URL: api.corsOrigins, then whatever .env adds.
|
|
1013
1224
|
# A list saved in Studio replaces both until it is reset. Dev mode allows every origin.
|
|
1014
1225
|
SUPATYPE_CORS_ALLOW_ORIGINS: "${corsOriginsEnv(config)}"
|
|
1015
1226
|
SUPATYPE_DB_DRIVER: postgres
|
|
1016
1227
|
SUPATYPE_DB_DATABASE_URL: "${authUrl}${authSearchPathSeparator}search_path=auth"
|
|
1017
|
-
SUPATYPE_SITE_URL: \${SITE_URL:-${siteUrlFallback}}
|
|
1228
|
+
SUPATYPE_SITE_URL: \${SITE_URL:-${composeSiteUrlFallback(config, siteUrlFallback)}}
|
|
1018
1229
|
SUPATYPE_JWT_SECRET: \${JWT_SECRET:?JWT_SECRET is missing from .env}
|
|
1019
1230
|
SUPATYPE_JWT_EXP: 3600
|
|
1020
1231
|
SUPATYPE_JWT_AUD: authenticated
|
|
1021
1232
|
SUPATYPE_JWT_DEFAULT_GROUP_NAME: authenticated
|
|
1022
1233
|
SUPATYPE_JWT_ADMIN_ROLES: service_role,supatype_admin
|
|
1023
|
-
# auth.email.enableConfirmations
|
|
1024
|
-
|
|
1234
|
+
# auth.email.enabled and auth.email.enableConfirmations decide the fallbacks; a value in .env
|
|
1235
|
+
# wins. Unset, a standalone stack sends confirmation links and a dev one confirms at once.
|
|
1236
|
+
${EMAIL_ENABLED_ENV}: \${${EMAIL_ENABLED_ENV}:-${configEmailEnabled(config)}}
|
|
1237
|
+
SUPATYPE_MAILER_AUTOCONFIRM: \${SUPATYPE_MAILER_AUTOCONFIRM:-${configMailerAutoconfirm(config, devLocal ? "dev" : "standalone")}}
|
|
1025
1238
|
# Emailed links are SUPATYPE_API_EXTERNAL_URL plus these paths. The external URL is the
|
|
1026
1239
|
# gateway's root, where / belongs to the app, so the server's default of /verify sent every
|
|
1027
1240
|
# confirmation, magic-link and recovery link to a 404. The auth routes are under /auth/v1/.
|
|
@@ -1039,14 +1252,14 @@ ${composeEnvLines(mailerUrlPathsEnv())}
|
|
|
1039
1252
|
# leaving it unset now behaves exactly as it would with no value at all.
|
|
1040
1253
|
SUPATYPE_SMTP_PORT: \${SUPATYPE_SMTP_PORT:-587}
|
|
1041
1254
|
SUPATYPE_SMTP_USER: \${SUPATYPE_SMTP_USER:-}
|
|
1042
|
-
SUPATYPE_SMTP_PASS:
|
|
1255
|
+
SUPATYPE_SMTP_PASS: ${composeSmtpPass(config)}
|
|
1043
1256
|
SUPATYPE_SMTP_ADMIN_EMAIL: \${SUPATYPE_SMTP_ADMIN_EMAIL:-}
|
|
1044
1257
|
SUPATYPE_SMTP_SENDER_NAME: \${SUPATYPE_SMTP_SENDER_NAME:-}
|
|
1045
1258
|
# Resend's key and sender, and SES's sender, from .env. Without these the server had no way
|
|
1046
1259
|
# to get them and a resend or ses provider fell back to the noop mailer.
|
|
1047
|
-
${composeEnvLines(
|
|
1048
|
-
SUPATYPE_DISABLE_SIGNUP: \${DISABLE_SIGNUP
|
|
1049
|
-
${authProviderEnv}${samlEnv}
|
|
1260
|
+
${composeEnvLines(composeMailerPassthrough(config))}
|
|
1261
|
+
SUPATYPE_DISABLE_SIGNUP: \${DISABLE_SIGNUP:-${composeDisableSignupFallback(config)}}
|
|
1262
|
+
${config.auth?.anonymous?.enabled === undefined ? ANONYMOUS_SIGN_IN_FROM_ENV : ""}${composeAllowListLine(config)}${authProviderEnv}${authGroupsEnv}${samlEnv}
|
|
1050
1263
|
depends_on:
|
|
1051
1264
|
${dbDependencyClause}${keyspaceInPg ? "" : " valkey:\n condition: service_started\n"} postgrest:
|
|
1052
1265
|
condition: service_started
|
|
@@ -1060,13 +1273,15 @@ ${realtimeDependency} control-plane:
|
|
|
1060
1273
|
${objectStoreBlock}
|
|
1061
1274
|
schema-engine:
|
|
1062
1275
|
image: \${${ENGINE_SERVICE.imageVariable}:-${ENGINE_SERVICE.defaultImage}}
|
|
1276
|
+
${LOGGING}
|
|
1063
1277
|
profiles: ["tools"]
|
|
1064
1278
|
entrypoint: ["${ENGINE_SERVICE.entrypoint}"]
|
|
1065
1279
|
volumes:
|
|
1066
1280
|
${mounts.engineProject}
|
|
1067
1281
|
working_dir: ${ENGINE_SERVICE.projectDir}
|
|
1068
1282
|
${dbDependency}${studioBlock}${valkeyBlock}${tlsHintComment} kong:
|
|
1069
|
-
image:
|
|
1283
|
+
image: \${SUPATYPE_KONG_IMAGE:-${KONG_IMAGE}}
|
|
1284
|
+
${SERVICE_DEFAULTS}
|
|
1070
1285
|
${gatewayNetworks} # host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
|
|
1071
1286
|
# mapped, so a project proxying the site or Studio to something on the host worked on macOS
|
|
1072
1287
|
# and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
|
|
@@ -1100,6 +1315,9 @@ ${gatewayNetworks} # host.docker.internal is a Docker Desktop name. On Linux
|
|
|
1100
1315
|
# realtime subscribe often took that long. A records still come from the hosts file first, so
|
|
1101
1316
|
# host.docker.internal above resolves as before.
|
|
1102
1317
|
KONG_DNS_ORDER: "LAST,A,CNAME"
|
|
1318
|
+
# Read through Kong's env vault by the pre-function on every route to the server (kong-config.ts).
|
|
1319
|
+
${forwardingSecretRequired()}
|
|
1320
|
+
KONG_PROXY_LISTEN: "${kongListen}"
|
|
1103
1321
|
${kongTlsEnv} volumes:
|
|
1104
1322
|
${mounts.kong}
|
|
1105
1323
|
ports:
|
|
@@ -1118,38 +1336,41 @@ function ensureComposeManifest(cwd, config) {
|
|
|
1118
1336
|
// The manifest is generated, not operator-authored, but `push` writes real values into it (the
|
|
1119
1337
|
// schema, for one), so an existing file keeps every key but the routes below. Malformed, it is
|
|
1120
1338
|
// left for the server to complain about rather than overwritten here.
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
return;
|
|
1124
|
-
}
|
|
1125
|
-
patchRouteManifest(manifestPath, {
|
|
1126
|
-
schema: "public",
|
|
1127
|
-
postgrest_url: "http://postgrest:3000",
|
|
1128
|
-
...composeServiceRoutes(config),
|
|
1129
|
-
});
|
|
1339
|
+
const fresh = existsSync(manifestPath) ? {} : { schema: "public", postgrest_url: "http://postgrest:3000" };
|
|
1340
|
+
switchServices(manifestPath, composeServiceSwitches(config), { ...fresh, ...composeServiceRoutes(config) }, { keepMalformed: true });
|
|
1130
1341
|
}
|
|
1131
1342
|
/**
|
|
1132
1343
|
* Where the server finds each service of this stack, set on every render rather than only into a
|
|
1133
1344
|
* new file. Native dev shares the manifest and records its own host ports for realtime, functions
|
|
1134
1345
|
* and storage, so a project moved from native to Docker kept native's URLs and the server proxied
|
|
1135
1346
|
* every subscription and every /storage/v1 call to a port nothing in the stack listened on (502).
|
|
1136
|
-
* An older CLI's `functions_enabled: false` is put right by the same write.
|
|
1137
1347
|
*/
|
|
1138
1348
|
function composeServiceRoutes(config) {
|
|
1139
1349
|
return {
|
|
1140
1350
|
// This file always generates a `storage` service, and native dev records its own storage
|
|
1141
1351
|
// service on a host port.
|
|
1142
1352
|
storage_url: "http://storage:5000",
|
|
1143
|
-
//
|
|
1144
|
-
// the server ends up proxying subscriptions to a host that does not resolve. Undefined drops
|
|
1145
|
-
// the key.
|
|
1146
|
-
realtime_enabled: realtimeEnabled(config),
|
|
1353
|
+
// Undefined drops the key: no realtime service is generated (composeServiceSwitches).
|
|
1147
1354
|
realtime_url: realtimeEnabled(config) ? "http://realtime:4000" : undefined,
|
|
1355
|
+
functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Which services of this stack are switched on, set on every render with its routes. An older
|
|
1360
|
+
* CLI's `functions_enabled: false` is put right by the same write.
|
|
1361
|
+
*/
|
|
1362
|
+
function composeServiceSwitches(config) {
|
|
1363
|
+
return {
|
|
1364
|
+
// The stack's storage is always on, its start value: native dev switches its own storage service
|
|
1365
|
+
// off and on, and a switch it left would switch off the stack's.
|
|
1366
|
+
storage: undefined,
|
|
1367
|
+
// Matches the compose file: a manifest advertising a service that was not generated is how
|
|
1368
|
+
// the server ends up proxying subscriptions to a host that does not resolve.
|
|
1369
|
+
realtime: realtimeEnabled(config),
|
|
1148
1370
|
// True because this file *always* generates a `functions-worker` service and hands the server
|
|
1149
1371
|
// `SUPATYPE_FUNCTIONS_WORKER_URL`. It said false, so the server answered 404 for every function
|
|
1150
1372
|
// in a stack that was running a worker for them, provisioned, then switched off.
|
|
1151
|
-
|
|
1152
|
-
functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
|
|
1373
|
+
functions: true,
|
|
1153
1374
|
};
|
|
1154
1375
|
}
|
|
1155
1376
|
/**
|
|
@@ -1298,16 +1519,27 @@ function resolveDrafts(cwd, config, options) {
|
|
|
1298
1519
|
return options.drafts;
|
|
1299
1520
|
return projectHasVersionedModels(cwd, config);
|
|
1300
1521
|
}
|
|
1522
|
+
/**
|
|
1523
|
+
* The host file holding the keyspace password when the project names one (R2-S16), checked before
|
|
1524
|
+
* anything is written: both forms set, a file that is missing or empty, or a file beside HTTPS
|
|
1525
|
+
* (whose Kong cannot read one) stop here with what to change, rather than in a container later.
|
|
1526
|
+
*/
|
|
1527
|
+
function composeKeyspacePasswordFile(cwd, config, options) {
|
|
1528
|
+
const use = { required: keyspacePasswordRequired(config), tls: selfHostTlsEnabled(config, options?.devLocal === true) };
|
|
1529
|
+
return checkedKeyspacePasswordFile(cwd, use, { brand: { intro: "Self-host compose" } })?.path;
|
|
1530
|
+
}
|
|
1301
1531
|
export function writeSelfHostCompose(cwd, config, options) {
|
|
1302
1532
|
// No URL-unsafe password check here: `supatype update` and the dev watcher write this file too,
|
|
1303
1533
|
// and start nothing. up, render, restart and dev refuse before they start. push, diff and dev's
|
|
1304
1534
|
// recovery only start the database, so they warn (startComposeDatabase in dev-compose.ts).
|
|
1305
1535
|
assertExternalUrlMatchesEnv(cwd, config);
|
|
1306
1536
|
assertBundledDbUser(cwd, config);
|
|
1537
|
+
const keyspacePasswordFile = composeKeyspacePasswordFile(cwd, config, options);
|
|
1307
1538
|
const tier = resolveFieldMaskingTier(cwd, config, options);
|
|
1308
1539
|
const resolved = {
|
|
1309
1540
|
...options,
|
|
1310
1541
|
...(tier !== undefined && { fieldMaskingTier: tier }),
|
|
1542
|
+
...(keyspacePasswordFile !== undefined && { keyspacePasswordFile }),
|
|
1311
1543
|
drafts: resolveDrafts(cwd, config, options),
|
|
1312
1544
|
functionsDatabase: options?.functionsDatabase ?? namesComposeDatabase(readEnvValue(cwd, "SUPATYPE_FUNCTIONS_DB_URL", "")),
|
|
1313
1545
|
};
|
|
@@ -1316,16 +1548,31 @@ export function writeSelfHostCompose(cwd, config, options) {
|
|
|
1316
1548
|
mkdirSync(paths.dir, { recursive: true });
|
|
1317
1549
|
// Before the file that requires it is written, so no stack is ever rendered without one.
|
|
1318
1550
|
ensureControlPlaneSecret(cwd);
|
|
1551
|
+
ensureForwardingSecret(cwd);
|
|
1552
|
+
// The keyspace password the same way, where the keyspace requires one (N-RB2) and the project
|
|
1553
|
+
// keeps it in .env. An existing project gets one on its next dev or up, and compose recreates db
|
|
1554
|
+
// and server with it.
|
|
1555
|
+
if (keyspacePasswordRequired(config) && keyspacePasswordFile === undefined)
|
|
1556
|
+
ensureKeyspacePassword(cwd);
|
|
1319
1557
|
// The SAML signing key too, once SAML is on: the file requires it, and it must never change.
|
|
1320
1558
|
ensureSamlPrivateKey(cwd, config);
|
|
1321
|
-
// No
|
|
1322
|
-
//
|
|
1323
|
-
//
|
|
1559
|
+
// No hooks/ here: the worker mounts the whole project and treats a missing root as nothing to
|
|
1560
|
+
// serve. The functions directory is made below, for the server's bind; it stays empty, and an
|
|
1561
|
+
// empty one is not scaffolded into (refreshFunctionsContext), so a project with no functions
|
|
1562
|
+
// still gets no function types.
|
|
1324
1563
|
ensureComposeManifest(cwd, config);
|
|
1325
|
-
|
|
1564
|
+
const rendered = renderSelfHostCompose(config, cwd, resolved);
|
|
1565
|
+
// The server binds the functions directory writable, and a bind whose host path is missing is
|
|
1566
|
+
// refused when the stack starts. Created only after the render, which refuses a path outside the
|
|
1567
|
+
// project; and not when the directory is the project root, which is there already.
|
|
1568
|
+
mkdirSync(preferredFunctionsPathFromProject(config, cwd), { recursive: true });
|
|
1569
|
+
writeFileSync(paths.composePath, rendered, "utf8");
|
|
1326
1570
|
// The object store's login, from the same `.env` values the compose file reads, generated first
|
|
1327
1571
|
// when the project has none.
|
|
1328
|
-
|
|
1572
|
+
// Not for a stack on the project's own bucket, which runs no object store.
|
|
1573
|
+
if (!keepsFilesInOwnBucket(config, options?.devLocal === true)) {
|
|
1574
|
+
writeFileSync(paths.s3ConfigPath, renderSeaweedIdentities(ensureObjectStoreCredentials(cwd)), "utf8");
|
|
1575
|
+
}
|
|
1329
1576
|
const studioHostDev = options?.devLocal === true && hasStudioOverride(config);
|
|
1330
1577
|
const tlsEnabled = selfHostTlsEnabled(config, options?.devLocal === true);
|
|
1331
1578
|
const domain = config.server.domain?.trim();
|
|
@@ -1346,15 +1593,23 @@ export function writeSelfHostCompose(cwd, config, options) {
|
|
|
1346
1593
|
email: acmeEmail,
|
|
1347
1594
|
domain,
|
|
1348
1595
|
redisHost: keyspaceInPostgres(config) ? "db" : "valkey",
|
|
1596
|
+
redisAuth: keyspacePasswordRequired(config),
|
|
1349
1597
|
},
|
|
1350
1598
|
}
|
|
1351
1599
|
: {}),
|
|
1352
1600
|
}), "utf8");
|
|
1353
1601
|
return paths;
|
|
1354
1602
|
}
|
|
1355
|
-
/**
|
|
1603
|
+
/**
|
|
1604
|
+
* What the last compose run that captured its output said when it failed, and the cause recognised,
|
|
1605
|
+
* or nothing. Each run starts it afresh. Said again in the fatal message: under dev's dashboard it
|
|
1606
|
+
* was printed only into the pane, which froze cut at the window's width, and the screen left after
|
|
1607
|
+
* the dashboard said only "docker compose failed" (0.9.2 round 2, R2-S10).
|
|
1608
|
+
*/
|
|
1609
|
+
let lastComposeFailure = [];
|
|
1610
|
+
/** Exit with a friendly compose failure message, carrying the reason the failed run gave. */
|
|
1356
1611
|
export function exitComposeFailed(status, context, brand) {
|
|
1357
|
-
fatalError(`docker compose failed (exit ${status}).`, [context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
|
|
1612
|
+
fatalError(`docker compose failed (exit ${status}).`, [...lastComposeFailure, context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
|
|
1358
1613
|
}
|
|
1359
1614
|
/** The `docker` arguments for `docker compose <args>` on one project's file. */
|
|
1360
1615
|
function composeInvocation(composePath, args, projectRoot, composeProject, quiet) {
|
|
@@ -1379,6 +1634,7 @@ function composeInvocation(composePath, args, projectRoot, composeProject, quiet
|
|
|
1379
1634
|
export function runDockerCompose(composePath, args, projectRoot = process.cwd(), composeProject, options) {
|
|
1380
1635
|
if (options?.skipDaemonProbe !== true)
|
|
1381
1636
|
requireDockerDaemon(options?.brand !== undefined ? { brand: options.brand } : undefined);
|
|
1637
|
+
lastComposeFailure = [];
|
|
1382
1638
|
// Inside a command's flow, docker's output is captured and its stdout logged there. Written
|
|
1383
1639
|
// straight to the terminal, it landed in the frame the flow redraws, and every line above it
|
|
1384
1640
|
// came out twice.
|
|
@@ -1429,6 +1685,7 @@ export async function settleComposeRuns() {
|
|
|
1429
1685
|
}
|
|
1430
1686
|
async function quietComposeRun(composePath, args, projectRoot, composeProject, brand) {
|
|
1431
1687
|
await requireDockerDaemonAsync(brand !== undefined ? { brand } : undefined);
|
|
1688
|
+
lastComposeFailure = [];
|
|
1432
1689
|
const runCompose = () => askDockerCompose(composePath, args, projectRoot, composeProject, NO_DOCKER_LIMIT);
|
|
1433
1690
|
// As in runDockerCompose: a Kong already running is reloaded when `up` moved what it routes to.
|
|
1434
1691
|
const result = args[0] === "up"
|
|
@@ -1499,20 +1756,34 @@ function capturedComposeOutput(result) {
|
|
|
1499
1756
|
.trim();
|
|
1500
1757
|
}
|
|
1501
1758
|
/**
|
|
1502
|
-
* Say what a failed compose run printed, when the CLI captured it, and any cause it recognises
|
|
1503
|
-
* `captured` is null when the output already went to the
|
|
1759
|
+
* Say what a failed compose run printed, when the CLI captured it, and any cause it recognises,
|
|
1760
|
+
* and keep it for {@link exitComposeFailed}. `captured` is null when the output already went to the
|
|
1761
|
+
* terminal, which then keeps it too.
|
|
1504
1762
|
*/
|
|
1505
1763
|
function reportComposeFailure(args, captured) {
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
return;
|
|
1510
|
-
for (const line of addressPoolExhaustionHint(captured))
|
|
1764
|
+
const hints = args[0] === "up" ? addressPoolExhaustionHint(captured) : [];
|
|
1765
|
+
const lines = [...(captured ? [`docker compose: ${captured}`] : []), ...hints];
|
|
1766
|
+
for (const line of lines)
|
|
1511
1767
|
console.error(`[supatype] ${line}`);
|
|
1768
|
+
if (captured !== null)
|
|
1769
|
+
lastComposeFailure = lines;
|
|
1512
1770
|
}
|
|
1513
1771
|
/** Compose project name for a Supatype project, isolates docker state per project. */
|
|
1514
1772
|
export function composeProjectName(projectName) {
|
|
1515
1773
|
const slug = projectName.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1516
1774
|
return `supatype-${slug || "project"}`;
|
|
1517
1775
|
}
|
|
1776
|
+
/**
|
|
1777
|
+
* The volumes Docker still holds for the compose project `composeProject`, by compose's own label;
|
|
1778
|
+
* none when Docker cannot say. `down --volumes` removes only those the compose file declares now,
|
|
1779
|
+
* so one a service left the file with (SeaweedFS's, after a switch to S3) is still here.
|
|
1780
|
+
*/
|
|
1781
|
+
export function composeProjectVolumes(composeProject) {
|
|
1782
|
+
const listed = askDockerSync(["volume", "ls", "-q", "--filter", `label=com.docker.compose.project=${composeProject}`], {
|
|
1783
|
+
timeoutMs: DOCKER_QUERY_TIMEOUT_MS,
|
|
1784
|
+
});
|
|
1785
|
+
if (listed.status !== 0)
|
|
1786
|
+
return [];
|
|
1787
|
+
return listed.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "");
|
|
1788
|
+
}
|
|
1518
1789
|
//# sourceMappingURL=self-host-compose.js.map
|