@supatype/cli 0.9.0 → 0.9.2
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 +640 -68
- package/bin/node-version.js +28 -0
- package/bin/supatype.js +8 -4
- 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 +32 -4
- package/dist/app/proxy-dev-app.d.ts.map +1 -1
- package/dist/app/proxy-dev-app.js +111 -77
- package/dist/app/proxy-dev-app.js.map +1 -1
- package/dist/app/vite-dev-args.d.ts +20 -0
- package/dist/app/vite-dev-args.d.ts.map +1 -0
- package/dist/app/vite-dev-args.js +65 -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/augmentation-generator.d.ts +2 -0
- package/dist/augmentation-generator.d.ts.map +1 -1
- package/dist/augmentation-generator.js +7 -3
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/auth-providers.d.ts +5 -4
- package/dist/auth-providers.d.ts.map +1 -1
- package/dist/auth-providers.js +3 -12
- package/dist/auth-providers.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/build-spawn.d.ts +35 -0
- package/dist/build-spawn.d.ts.map +1 -0
- package/dist/build-spawn.js +75 -0
- package/dist/build-spawn.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/cli-version-embedded.js +1 -1
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -1
- package/dist/cli.js.map +1 -1
- package/dist/cloud-credentials.d.ts.map +1 -1
- package/dist/cloud-credentials.js +3 -1
- package/dist/cloud-credentials.js.map +1 -1
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +11 -15
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/adopt.js +1 -1
- package/dist/commands/adopt.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 +29 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +69 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/cache.d.ts.map +1 -1
- package/dist/commands/cache.js +5 -0
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/db.d.ts.map +1 -1
- package/dist/commands/db.js +46 -23
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.d.ts +14 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +67 -52
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +21 -4
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +244 -86
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/diff.d.ts +3 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +28 -34
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/functions.d.ts.map +1 -1
- package/dist/commands/functions.js +21 -16
- 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/init.d.ts +15 -10
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +312 -163
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/internal.d.ts.map +1 -1
- package/dist/commands/internal.js +27 -7
- package/dist/commands/internal.js.map +1 -1
- package/dist/commands/introspect.d.ts.map +1 -1
- package/dist/commands/introspect.js +3 -0
- package/dist/commands/introspect.js.map +1 -1
- package/dist/commands/keys-print.d.ts +20 -0
- package/dist/commands/keys-print.d.ts.map +1 -0
- package/dist/commands/keys-print.js +47 -0
- package/dist/commands/keys-print.js.map +1 -0
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +16 -12
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/link-helpers.d.ts.map +1 -1
- package/dist/commands/link-helpers.js +28 -6
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/migrate.d.ts +5 -2
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +34 -36
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/pull.d.ts.map +1 -1
- package/dist/commands/pull.js +6 -5
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +30 -19
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/rename.js +1 -1
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/seed.d.ts +2 -11
- package/dist/commands/seed.d.ts.map +1 -1
- package/dist/commands/seed.js +11 -38
- 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 +133 -272
- package/dist/commands/self-host.js.map +1 -1
- package/dist/commands/sso.d.ts +26 -0
- package/dist/commands/sso.d.ts.map +1 -0
- package/dist/commands/sso.js +362 -0
- package/dist/commands/sso.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +25 -8
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +156 -63
- package/dist/commands/update.js.map +1 -1
- package/dist/component-launch.d.ts.map +1 -1
- package/dist/component-launch.js +2 -1
- package/dist/component-launch.js.map +1 -1
- package/dist/compose-db-roles.d.ts +4 -4
- package/dist/compose-db-roles.d.ts.map +1 -1
- package/dist/compose-db-roles.js +14 -10
- package/dist/compose-db-roles.js.map +1 -1
- package/dist/compose-engine-run.d.ts +9 -2
- package/dist/compose-engine-run.d.ts.map +1 -1
- package/dist/compose-engine-run.js +30 -13
- package/dist/compose-engine-run.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 +13 -5
- package/dist/compose-render-mode.js.map +1 -1
- package/dist/compose-services.d.ts +18 -0
- package/dist/compose-services.d.ts.map +1 -1
- package/dist/compose-services.js +49 -23
- package/dist/compose-services.js.map +1 -1
- package/dist/config-mailer-env.d.ts +31 -0
- package/dist/config-mailer-env.d.ts.map +1 -0
- package/dist/config-mailer-env.js +45 -0
- package/dist/config-mailer-env.js.map +1 -0
- 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 +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -2
- package/dist/config.js.map +1 -1
- package/dist/db-rows.d.ts +3 -2
- package/dist/db-rows.d.ts.map +1 -1
- package/dist/db-rows.js +19 -4
- package/dist/db-rows.js.map +1 -1
- package/dist/dev-compose.d.ts +69 -9
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +272 -187
- package/dist/dev-compose.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 +13 -6
- package/dist/dev-ports.d.ts.map +1 -1
- package/dist/dev-ports.js +124 -68
- 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 +8 -2
- package/dist/dev-schema-watch.d.ts.map +1 -1
- package/dist/dev-schema-watch.js +24 -13
- 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 +66 -2
- package/dist/dev-session-lock.d.ts.map +1 -1
- package/dist/dev-session-lock.js +104 -5
- package/dist/dev-session-lock.js.map +1 -1
- package/dist/dev-session.d.ts +19 -3
- package/dist/dev-session.d.ts.map +1 -1
- package/dist/dev-session.js +31 -8
- 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 +27 -10
- package/dist/dev-shutdown.js.map +1 -1
- package/dist/diff-access.d.ts +10 -0
- package/dist/diff-access.d.ts.map +1 -0
- package/dist/diff-access.js +69 -0
- package/dist/diff-access.js.map +1 -0
- package/dist/diff-output.d.ts.map +1 -1
- package/dist/diff-output.js +2 -1
- package/dist/diff-output.js.map +1 -1
- package/dist/docker-exec.d.ts.map +1 -1
- package/dist/docker-exec.js +4 -4
- package/dist/docker-exec.js.map +1 -1
- package/dist/docker-runtime.d.ts +34 -4
- package/dist/docker-runtime.d.ts.map +1 -1
- package/dist/docker-runtime.js +155 -46
- package/dist/docker-runtime.js.map +1 -1
- package/dist/engine-answers.d.ts +2 -1
- package/dist/engine-answers.d.ts.map +1 -1
- package/dist/engine-answers.js +11 -0
- package/dist/engine-answers.js.map +1 -1
- package/dist/engine-client.d.ts +20 -0
- package/dist/engine-client.d.ts.map +1 -1
- package/dist/engine-client.js +9 -8
- 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 +3 -2
- package/dist/engine-floor.d.ts.map +1 -1
- package/dist/engine-floor.js +2 -2
- package/dist/engine-floor.js.map +1 -1
- package/dist/engine-push-output.d.ts +8 -1
- package/dist/engine-push-output.d.ts.map +1 -1
- package/dist/engine-push-output.js +8 -1
- package/dist/engine-push-output.js.map +1 -1
- package/dist/env-file.d.ts +23 -3
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +74 -40
- package/dist/env-file.js.map +1 -1
- package/dist/env-lines.d.ts +3 -2
- package/dist/env-lines.d.ts.map +1 -1
- package/dist/env-lines.js +5 -2
- package/dist/env-lines.js.map +1 -1
- package/dist/env-value.d.ts +15 -0
- package/dist/env-value.d.ts.map +1 -0
- package/dist/env-value.js +34 -0
- package/dist/env-value.js.map +1 -0
- package/dist/error-message.d.ts +20 -0
- package/dist/error-message.d.ts.map +1 -1
- package/dist/error-message.js +42 -0
- package/dist/error-message.js.map +1 -1
- package/dist/frontend-env.d.ts +13 -4
- package/dist/frontend-env.d.ts.map +1 -1
- package/dist/frontend-env.js +25 -5
- package/dist/frontend-env.js.map +1 -1
- package/dist/frontend-values-linked.d.ts +22 -0
- package/dist/frontend-values-linked.d.ts.map +1 -0
- package/dist/frontend-values-linked.js +143 -0
- package/dist/frontend-values-linked.js.map +1 -0
- package/dist/frontend-values.d.ts +90 -0
- package/dist/frontend-values.d.ts.map +1 -0
- package/dist/frontend-values.js +208 -0
- package/dist/frontend-values.js.map +1 -0
- package/dist/functions-deno-types.d.ts.map +1 -1
- package/dist/functions-deno-types.js +5 -5
- package/dist/functions-deno-types.js.map +1 -1
- package/dist/functions-env-local.d.ts +13 -0
- package/dist/functions-env-local.d.ts.map +1 -0
- package/dist/functions-env-local.js +20 -0
- package/dist/functions-env-local.js.map +1 -0
- 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/release-images.d.ts +6 -6
- package/dist/generated/release-images.js +3 -3
- package/dist/generated/release-images.js.map +1 -1
- package/dist/generated/typescript-libs.d.ts +4 -0
- package/dist/generated/typescript-libs.d.ts.map +1 -0
- package/dist/generated/typescript-libs.js +64 -0
- package/dist/generated/typescript-libs.js.map +1 -0
- 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 +4 -2
- package/dist/hooks-generator.js.map +1 -1
- package/dist/host-database.d.ts +16 -12
- package/dist/host-database.d.ts.map +1 -1
- package/dist/host-database.js +28 -17
- package/dist/host-database.js.map +1 -1
- package/dist/init-answers.d.ts +18 -0
- package/dist/init-answers.d.ts.map +1 -0
- package/dist/init-answers.js +46 -0
- package/dist/init-answers.js.map +1 -0
- 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 +43 -0
- package/dist/init-next-runtime-env.d.ts.map +1 -0
- package/dist/init-next-runtime-env.js +261 -0
- package/dist/init-next-runtime-env.js.map +1 -0
- package/dist/init-package-json.d.ts +11 -3
- package/dist/init-package-json.d.ts.map +1 -1
- package/dist/init-package-json.js +20 -13
- 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-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/jwt.d.ts +5 -0
- package/dist/jwt.d.ts.map +1 -1
- package/dist/jwt.js +16 -0
- package/dist/jwt.js.map +1 -1
- 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/kong-config.d.ts +1 -0
- package/dist/kong-config.d.ts.map +1 -1
- package/dist/kong-config.js +64 -20
- package/dist/kong-config.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 +32 -0
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +49 -0
- package/dist/local-secrets.js.map +1 -1
- package/dist/local-stack-guard.d.ts +37 -0
- package/dist/local-stack-guard.d.ts.map +1 -0
- package/dist/local-stack-guard.js +85 -0
- package/dist/local-stack-guard.js.map +1 -0
- package/dist/local-stack.d.ts.map +1 -1
- package/dist/local-stack.js +7 -6
- 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 +4 -0
- package/dist/mailer-env.d.ts.map +1 -1
- package/dist/mailer-env.js +12 -1
- package/dist/mailer-env.js.map +1 -1
- package/dist/model-hooks.d.ts +4 -4
- package/dist/model-hooks.d.ts.map +1 -1
- package/dist/model-hooks.js +13 -7
- package/dist/model-hooks.js.map +1 -1
- package/dist/native-dev-env.d.ts +25 -2
- package/dist/native-dev-env.d.ts.map +1 -1
- package/dist/native-dev-env.js +39 -4
- package/dist/native-dev-env.js.map +1 -1
- package/dist/native-keyspace.d.ts +21 -6
- package/dist/native-keyspace.d.ts.map +1 -1
- package/dist/native-keyspace.js +48 -14
- 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-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/node-executable.d.ts +6 -0
- package/dist/node-executable.d.ts.map +1 -0
- package/dist/node-executable.js +43 -0
- package/dist/node-executable.js.map +1 -0
- package/dist/parent-watch.d.ts +8 -3
- package/dist/parent-watch.d.ts.map +1 -1
- package/dist/parent-watch.js +12 -11
- package/dist/parent-watch.js.map +1 -1
- package/dist/postgres-ctl.d.ts +33 -5
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +60 -16
- package/dist/postgres-ctl.js.map +1 -1
- package/dist/postgres-image.d.ts +16 -0
- package/dist/postgres-image.d.ts.map +1 -1
- package/dist/postgres-image.js +34 -11
- package/dist/postgres-image.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 +110 -9
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +242 -104
- 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 +60 -4
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +23 -1
- package/dist/project-config.js.map +1 -1
- package/dist/push-audit.d.ts +4 -1
- package/dist/push-audit.d.ts.map +1 -1
- package/dist/push-audit.js +33 -4
- package/dist/push-audit.js.map +1 -1
- package/dist/recorded-field-masking-tier.d.ts +2 -2
- package/dist/recorded-field-masking-tier.d.ts.map +1 -1
- package/dist/recorded-field-masking-tier.js +6 -6
- package/dist/recorded-field-masking-tier.js.map +1 -1
- package/dist/rename-journal.d.ts +1 -1
- package/dist/rename-journal.d.ts.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-api-url.d.ts +2 -0
- package/dist/resolve-api-url.d.ts.map +1 -1
- package/dist/resolve-api-url.js +5 -1
- package/dist/resolve-api-url.js.map +1 -1
- package/dist/resolve-target.d.ts +16 -1
- package/dist/resolve-target.d.ts.map +1 -1
- package/dist/resolve-target.js +20 -11
- package/dist/resolve-target.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 +33 -0
- package/dist/run-captured.d.ts.map +1 -0
- package/dist/run-captured.js +36 -0
- package/dist/run-captured.js.map +1 -0
- 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 +5 -1
- package/dist/runtime-routes.js.map +1 -1
- package/dist/saml-config.d.ts +53 -0
- package/dist/saml-config.d.ts.map +1 -0
- package/dist/saml-config.js +177 -0
- package/dist/saml-config.js.map +1 -0
- package/dist/saml-key-rotation.d.ts +5 -0
- package/dist/saml-key-rotation.d.ts.map +1 -0
- package/dist/saml-key-rotation.js +26 -0
- package/dist/saml-key-rotation.js.map +1 -0
- package/dist/saml-sp-certificate.d.ts +15 -0
- package/dist/saml-sp-certificate.d.ts.map +1 -0
- package/dist/saml-sp-certificate.js +34 -0
- package/dist/saml-sp-certificate.js.map +1 -0
- package/dist/schema-reset.d.ts +41 -0
- package/dist/schema-reset.d.ts.map +1 -0
- package/dist/schema-reset.js +98 -0
- package/dist/schema-reset.js.map +1 -0
- 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-child.d.ts +25 -0
- package/dist/seed-child.d.ts.map +1 -0
- package/dist/seed-child.js +61 -0
- package/dist/seed-child.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-runner.d.ts +3 -5
- package/dist/seed-runner.d.ts.map +1 -1
- package/dist/seed-runner.js +20 -42
- package/dist/seed-runner.js.map +1 -1
- package/dist/seed.d.ts +15 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/self-host-compose.d.ts +24 -2
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +261 -63
- package/dist/self-host-compose.js.map +1 -1
- package/dist/serial-runs.d.ts +7 -0
- package/dist/serial-runs.d.ts.map +1 -0
- package/dist/serial-runs.js +29 -0
- package/dist/serial-runs.js.map +1 -0
- package/dist/sso-admin.d.ts +114 -0
- package/dist/sso-admin.d.ts.map +1 -0
- package/dist/sso-admin.js +256 -0
- package/dist/sso-admin.js.map +1 -0
- package/dist/stack-engine.d.ts +28 -0
- package/dist/stack-engine.d.ts.map +1 -0
- package/dist/stack-engine.js +59 -0
- package/dist/stack-engine.js.map +1 -0
- package/dist/stack-exit-watch.d.ts +52 -0
- package/dist/stack-exit-watch.d.ts.map +1 -0
- package/dist/stack-exit-watch.js +98 -0
- package/dist/stack-exit-watch.js.map +1 -0
- 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-setting-warnings.d.ts +9 -0
- package/dist/stack-setting-warnings.d.ts.map +1 -0
- package/dist/stack-setting-warnings.js +19 -0
- package/dist/stack-setting-warnings.js.map +1 -0
- 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-dev-server.d.ts.map +1 -1
- package/dist/studio-dev-server.js +2 -1
- package/dist/studio-dev-server.js.map +1 -1
- package/dist/target-client.d.ts +12 -2
- package/dist/target-client.d.ts.map +1 -1
- package/dist/target-client.js +14 -1
- package/dist/target-client.js.map +1 -1
- package/dist/tsx-runner.d.ts +5 -0
- package/dist/tsx-runner.d.ts.map +1 -1
- package/dist/tsx-runner.js +16 -16
- package/dist/tsx-runner.js.map +1 -1
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +27 -3
- package/dist/type-extractor.js.map +1 -1
- package/dist/type-generation.d.ts +1 -1
- package/dist/type-generation.d.ts.map +1 -1
- package/dist/type-generation.js +2 -4
- package/dist/type-generation.js.map +1 -1
- package/dist/type-resolver.d.ts.map +1 -1
- package/dist/type-resolver.js +31 -12
- package/dist/type-resolver.js.map +1 -1
- package/dist/ui/clack-api.d.ts.map +1 -1
- package/dist/ui/clack-api.js +45 -23
- package/dist/ui/clack-api.js.map +1 -1
- package/dist/ui/components/LineInput.d.ts +26 -0
- package/dist/ui/components/LineInput.d.ts.map +1 -0
- package/dist/ui/components/LineInput.js +60 -0
- package/dist/ui/components/LineInput.js.map +1 -0
- package/dist/ui/dev/DevReadyPanelView.js +1 -1
- package/dist/ui/dev/DevReadyPanelView.js.map +1 -1
- package/dist/ui/flows/FlowApp.d.ts +3 -1
- package/dist/ui/flows/FlowApp.d.ts.map +1 -1
- package/dist/ui/flows/FlowApp.js +14 -5
- package/dist/ui/flows/FlowApp.js.map +1 -1
- package/dist/ui/flows/prompt-fields.d.ts +3 -1
- package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
- package/dist/ui/flows/prompt-fields.js +10 -5
- package/dist/ui/flows/prompt-fields.js.map +1 -1
- package/dist/ui/flows/types.d.ts +5 -1
- package/dist/ui/flows/types.d.ts.map +1 -1
- package/dist/ui/runtime/command-chrome.d.ts.map +1 -1
- package/dist/ui/runtime/command-chrome.js +2 -0
- package/dist/ui/runtime/command-chrome.js.map +1 -1
- package/dist/ui/runtime/flow-transcript.d.ts +17 -0
- package/dist/ui/runtime/flow-transcript.d.ts.map +1 -0
- package/dist/ui/runtime/flow-transcript.js +38 -0
- package/dist/ui/runtime/flow-transcript.js.map +1 -0
- package/dist/ui/runtime/run-clack-flow.d.ts +7 -0
- package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
- package/dist/ui/runtime/run-clack-flow.js +131 -17
- package/dist/ui/runtime/run-clack-flow.js.map +1 -1
- package/dist/valkey-sidecar.d.ts +24 -11
- package/dist/valkey-sidecar.d.ts.map +1 -1
- package/dist/valkey-sidecar.js +45 -25
- 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 -6
- 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,31 +6,36 @@ 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
|
-
import {
|
|
11
|
+
import { plain } from "./ui/messages.js";
|
|
12
|
+
import { getActiveFlowApi } from "./ui/runtime/flow-session.js";
|
|
13
|
+
import { COMPOSE_DEV_KONG_PORT, defaultAppStaticDir, postgrestSchemaEnv, externalDatabaseUrl, hooksPathFromProject, preferredFunctionsPathFromProject, realtimeEnabled, publicEnvServerEnv, serviceRoleRoutes, selfHostTlsEnabled, usesExternalDatabase, } from "./project-config.js";
|
|
12
14
|
import { hasStudioOverride, pinnedVersion, VERSION_PIN_LOCAL } from "./binary-cache.js";
|
|
13
15
|
import { assertEngineVersionSupported, engineImageVersion } from "./engine-floor.js";
|
|
14
16
|
import { buildKongDeclarative } from "./kong-config.js";
|
|
15
|
-
import { keyspaceInPostgres } from "./cache-provider.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";
|
|
16
19
|
import { postgresImageFor, runningPostgresImage } from "./postgres-image.js";
|
|
17
20
|
import { STUDIO_DEV_PORT } from "./studio-dev-server.js";
|
|
18
21
|
import { readEnvFile, readEnvValue } from "./env-file.js";
|
|
22
|
+
import { OWN_BUCKET_S3_SETTINGS } from "./local-storage.js";
|
|
19
23
|
import { composeDbPublish, DB_PUBLIC_HOST_ENV, SELF_HOST_BIND } from "./db-port.js";
|
|
20
24
|
import { upKeepingKongCurrent, upKeepingKongCurrentAsync } from "./compose-kong.js";
|
|
21
25
|
import { addressPoolExhaustionHint } from "./docker-address-pool.js";
|
|
22
26
|
import { composeAuthProviderEnv } from "./auth-providers.js";
|
|
23
|
-
import {
|
|
27
|
+
import { composeSamlEnv, ensureSamlPrivateKey } from "./saml-config.js";
|
|
28
|
+
import { BUNDLED_DB_USER, CONTROL_PLANE_SECRET_ENV, 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";
|
|
24
29
|
import { fieldMaskingTierFromProject } from "./field-masking-tier.js";
|
|
25
30
|
import { readRecordedTier } from "./recorded-field-masking-tier.js";
|
|
26
31
|
import { projectHasVersionedModels } from "./model-versioning.js";
|
|
27
32
|
import { POSTGREST_IMAGE } from "./postgrest-release.js";
|
|
28
33
|
import { postgrestHookActorEnv } from "./hook-actor.js";
|
|
29
34
|
import { IN_REPO_IMAGE_ENV, RELEASE_IMAGES, unpinnedImagesNote } from "./release-images.js";
|
|
30
|
-
import { configMailerAutoconfirm } from "./mailer-autoconfirm.js";
|
|
35
|
+
import { configEmailEnabled, configMailerAutoconfirm, EMAIL_ENABLED_ENV } from "./mailer-autoconfirm.js";
|
|
31
36
|
import { MAILER_PASSTHROUGH_ENV, mailerUrlPathsEnv } from "./mailer-env.js";
|
|
32
37
|
import { studioRuntimeJson } from "./studio-auth-config.js";
|
|
33
|
-
import {
|
|
38
|
+
import { switchServices } from "./route-manifest.js";
|
|
34
39
|
/**
|
|
35
40
|
* The control plane secret as the server and the control plane receive it, and nobody else.
|
|
36
41
|
*
|
|
@@ -38,6 +43,41 @@ import { patchRouteManifest } from "./route-manifest.js";
|
|
|
38
43
|
* refuse to start the stack and say which variable is missing.
|
|
39
44
|
*/
|
|
40
45
|
const CONTROL_PLANE_SECRET_REQUIRED = `${CONTROL_PLANE_SECRET_ENV}: \${${CONTROL_PLANE_SECRET_ENV}:?${CONTROL_PLANE_SECRET_ENV} is missing from .env}`;
|
|
46
|
+
/**
|
|
47
|
+
* The keyspace password as the db, the server and Kong receive it, when the keyspace requires one
|
|
48
|
+
* (`keyspacePasswordRequired`). Required rather than defaulted, like the control plane secret:
|
|
49
|
+
* writeSelfHostCompose generates it first, and a stack started without it would refuse the server.
|
|
50
|
+
*/
|
|
51
|
+
const KEYSPACE_PASSWORD_REQUIRED = `${KEYSPACE_PASSWORD_ENV}: \${${KEYSPACE_PASSWORD_ENV}:?${KEYSPACE_PASSWORD_ENV} is missing from .env}`;
|
|
52
|
+
/**
|
|
53
|
+
* The keyspace password line for a service that talks RESP to the keyspace, or nothing when it
|
|
54
|
+
* requires none. Kong is one with TLS on: its ACME plugin keeps certificates there, and kong.yml
|
|
55
|
+
* names this variable through Kong's env vault rather than holding the value. With the password in
|
|
56
|
+
* a file (`passwordFile`, R2-S16), the line names the file where {@link keyspacePasswordMount}
|
|
57
|
+
* puts it; writeSelfHostCompose refuses that beside TLS, since Kong's env vault cannot read a file.
|
|
58
|
+
*/
|
|
59
|
+
function keyspacePasswordEnv(config, passwordFile) {
|
|
60
|
+
if (!keyspacePasswordRequired(config))
|
|
61
|
+
return "";
|
|
62
|
+
if (passwordFile === undefined)
|
|
63
|
+
return ` ${KEYSPACE_PASSWORD_REQUIRED}\n`;
|
|
64
|
+
return ` ${KEYSPACE_PASSWORD_FILE_ENV}: ${KEYSPACE_PASSWORD_CONTAINER_PATH}\n`;
|
|
65
|
+
}
|
|
66
|
+
/** The read-only mount of the project's keyspace password file, for a service the line above names it to. */
|
|
67
|
+
function keyspacePasswordMount(config, passwordFile) {
|
|
68
|
+
if (!keyspacePasswordRequired(config) || passwordFile === undefined)
|
|
69
|
+
return "";
|
|
70
|
+
return `${bindMount(passwordFile, KEYSPACE_PASSWORD_CONTAINER_PATH, true)}\n`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The server's keyspace lines. Besides the environment compose gives it, the server reads the
|
|
74
|
+
* project's .env and .env.local, and refuses to start when it finds the password beside the file,
|
|
75
|
+
* so with a file the password is set blank here, which no dotenv file overrides.
|
|
76
|
+
*/
|
|
77
|
+
function keyspaceServerEnv(config, passwordFile) {
|
|
78
|
+
const lines = keyspacePasswordEnv(config, passwordFile);
|
|
79
|
+
return lines !== "" && passwordFile !== undefined ? `${lines} ${KEYSPACE_PASSWORD_ENV}: ""\n` : lines;
|
|
80
|
+
}
|
|
41
81
|
/** Env keys written when `versions` pins exist in supatype.config.ts. */
|
|
42
82
|
export const COMPOSE_PINNED_IMAGE_ENV_KEYS = [
|
|
43
83
|
"SUPATYPE_ENGINE_IMAGE",
|
|
@@ -58,9 +98,42 @@ const SEAWEEDFS_IMAGE = "chrislusf/seaweedfs:4.46@sha256:08d516132314207d10c8e37
|
|
|
58
98
|
* durable, and a response-cache key beside them did not.
|
|
59
99
|
*/
|
|
60
100
|
const ACME_KEY_PREFIX = "kong_acme:";
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
101
|
+
/**
|
|
102
|
+
* The project's object store login as compose reads it from `.env` (issue 71: every stack used to
|
|
103
|
+
* share one pair, written into this file). Required, not defaulted: writeSelfHostCompose generates
|
|
104
|
+
* it before the file is written.
|
|
105
|
+
*/
|
|
106
|
+
const OBJECT_STORE_ACCESS_KEY = `\${${OBJECT_STORE_ACCESS_KEY_ENV}:?${OBJECT_STORE_ACCESS_KEY_ENV} is missing from .env}`;
|
|
107
|
+
const OBJECT_STORE_SECRET_KEY = `\${${OBJECT_STORE_SECRET_KEY_ENV}:?${OBJECT_STORE_SECRET_KEY_ENV} is missing from .env}`;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the stack keeps files in the project's own S3 bucket rather than a SeaweedFS of its own:
|
|
110
|
+
* production storage is "s3" (`storage.production`, init's "Production storage?" answer). Never the
|
|
111
|
+
* Docker dev stack, which this generator also writes and which follows the dev setting (0.9.2).
|
|
112
|
+
*/
|
|
113
|
+
function keepsFilesInOwnBucket(config, devLocal) {
|
|
114
|
+
return !devLocal && config.storage?.production === "s3";
|
|
115
|
+
}
|
|
116
|
+
/** The project's S3 settings compose hands the storage service from `.env`, blank when unset. */
|
|
117
|
+
const OPTIONAL_OWN_BUCKET_SETTINGS = OWN_BUCKET_S3_SETTINGS.filter((name) => name !== "S3_BUCKET");
|
|
118
|
+
/**
|
|
119
|
+
* The storage service's S3 settings: the stack's SeaweedFS, every one passed so the service needs
|
|
120
|
+
* no defaults, or the project's own bucket in single-bucket mode, which only S3_BUCKET is required for.
|
|
121
|
+
*/
|
|
122
|
+
function storageS3Env(ownBucket) {
|
|
123
|
+
if (!ownBucket) {
|
|
124
|
+
return ` S3_ENDPOINT: http://seaweedfs:8333
|
|
125
|
+
S3_REGION: us-east-1
|
|
126
|
+
S3_ACCESS_KEY: ${OBJECT_STORE_ACCESS_KEY}
|
|
127
|
+
S3_SECRET_KEY: ${OBJECT_STORE_SECRET_KEY}
|
|
128
|
+
S3_FORCE_PATH_STYLE: "true"
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
131
|
+
return ` # storage.production is "s3": every bucket is a key prefix in the project's own S3 bucket, and
|
|
132
|
+
# the stack runs no SeaweedFS. A blank setting is read as unset (see the storage docs).
|
|
133
|
+
S3_BUCKET: "\${S3_BUCKET:?S3_BUCKET is missing from .env, and storage.production is s3 in supatype.config.ts}"
|
|
134
|
+
${OPTIONAL_OWN_BUCKET_SETTINGS.map((name) => ` ${name}: "\${${name}:-}"`).join("\n")}
|
|
135
|
+
`;
|
|
136
|
+
}
|
|
64
137
|
/**
|
|
65
138
|
* The compose volume key Postgres keeps its data in. Docker names the volume
|
|
66
139
|
* `<compose project>_<key>`, and `supatype dev --reset-db` removes it by that name, so the key is
|
|
@@ -183,14 +256,12 @@ function supportedEngineImage(image, from) {
|
|
|
183
256
|
* world-readable and the per-bucket policy decorative, which is the opposite of what
|
|
184
257
|
* `applyPublicPolicy` is for: a bucket is public because its policy says so.
|
|
185
258
|
*/
|
|
186
|
-
export function renderSeaweedIdentities() {
|
|
259
|
+
export function renderSeaweedIdentities(credentials) {
|
|
187
260
|
const identities = {
|
|
188
261
|
identities: [
|
|
189
262
|
{
|
|
190
263
|
name: "supatype",
|
|
191
|
-
credentials: [
|
|
192
|
-
{ accessKey: OBJECT_STORE_ACCESS_KEY, secretKey: OBJECT_STORE_SECRET_KEY },
|
|
193
|
-
],
|
|
264
|
+
credentials: [{ accessKey: credentials.accessKey, secretKey: credentials.secretKey }],
|
|
194
265
|
actions: ["Admin", "Read", "List", "Tagging", "Write"],
|
|
195
266
|
},
|
|
196
267
|
],
|
|
@@ -207,6 +278,10 @@ export function selfHostComposePaths(cwd) {
|
|
|
207
278
|
s3ConfigPath: join(dir, "s3.json"),
|
|
208
279
|
};
|
|
209
280
|
}
|
|
281
|
+
/** The project folder a compose file {@link selfHostComposePaths} names lives in. */
|
|
282
|
+
export function projectRootOfComposePath(composePath) {
|
|
283
|
+
return dirname(dirname(dirname(composePath)));
|
|
284
|
+
}
|
|
210
285
|
export function appUpstreamForCompose(config) {
|
|
211
286
|
if (config.app.mode !== "proxy")
|
|
212
287
|
return undefined;
|
|
@@ -411,6 +486,16 @@ function corsOriginsEnv(config) {
|
|
|
411
486
|
const fromEnv = "${SUPATYPE_CORS_ALLOW_ORIGINS:-}";
|
|
412
487
|
return configured.length > 0 ? `${configured.join(",")},${fromEnv}` : fromEnv;
|
|
413
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* The server's `SUPATYPE_PUBLIC_ENV` line, ending in a newline, for `server.public_env: false`;
|
|
491
|
+
* empty otherwise, leaving the server's default.
|
|
492
|
+
*/
|
|
493
|
+
function publicEnvForCompose(config) {
|
|
494
|
+
const value = publicEnvServerEnv(config)["SUPATYPE_PUBLIC_ENV"];
|
|
495
|
+
if (value === undefined)
|
|
496
|
+
return "";
|
|
497
|
+
return ` # server.public_env: no /supatype-env.json or /supatype-env.js.\n SUPATYPE_PUBLIC_ENV: "${value}"\n`;
|
|
498
|
+
}
|
|
414
499
|
function serverAppEnvForCompose(config, devLocal) {
|
|
415
500
|
const mode = config.app.mode ?? "none";
|
|
416
501
|
const lines = [` SUPATYPE_APP_MODE: ${mode}`];
|
|
@@ -446,6 +531,40 @@ function networksClause(networks) {
|
|
|
446
531
|
function networksBlock(functionsDb) {
|
|
447
532
|
return `networks:\n ${FUNCTIONS_NETWORK}: {}\n${functionsDb ? ` ${FUNCTIONS_DB_NETWORK}: {}\n` : ""}`;
|
|
448
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* Every container's log, rotated: 0.9.1 release test RB8.
|
|
536
|
+
*
|
|
537
|
+
* With no `logging:` a container writes to the daemon's default driver, and on a Linux server that
|
|
538
|
+
* is `json-file` with no size limit at all. An idle stack's Postgres wrote about 0.8 GB a day there,
|
|
539
|
+
* so the disk of the server the deploy guide describes filled in weeks and the database stopped.
|
|
540
|
+
* Docker Desktop's `local` default rotates, which is why nobody saw it on a laptop.
|
|
541
|
+
*
|
|
542
|
+
* `json-file` rather than `local` because it is what `docker logs` and every log shipper read
|
|
543
|
+
* without configuration. The sizes come from `.env`, as every other knob in this file does: the file
|
|
544
|
+
* is regenerated on every write, so an edit to it would not last.
|
|
545
|
+
*/
|
|
546
|
+
const LOGGING_ANCHOR = `x-logging: &default-logging
|
|
547
|
+
driver: json-file
|
|
548
|
+
options:
|
|
549
|
+
max-size: "\${SUPATYPE_LOG_MAX_SIZE:-10m}"
|
|
550
|
+
max-file: "\${SUPATYPE_LOG_MAX_FILE:-5}"
|
|
551
|
+
`;
|
|
552
|
+
/** A service's `logging:` line, pointing at {@link LOGGING_ANCHOR}. */
|
|
553
|
+
const LOGGING = " logging: *default-logging";
|
|
554
|
+
/**
|
|
555
|
+
* A long-running service's restart policy: restarted when it fails, five times at most. Never a
|
|
556
|
+
* one-shot tool (`schema-engine`), which is meant to exit.
|
|
557
|
+
*
|
|
558
|
+
* 0.9.2 release test (N-FF11): only the server had one. A storage service that refused its S3
|
|
559
|
+
* settings exited 1 under policy `no` and stayed down, and so did any service that failed on
|
|
560
|
+
* something transient, a store or database still starting. Bounded, as the server's always was,
|
|
561
|
+
* rather than `unless-stopped`: a real misconfiguration ends exited with its reason in its log, which
|
|
562
|
+
* is what the CLI's watch on a starting stack looks for (stack-exit-watch.ts), instead of
|
|
563
|
+
* restarting for ever.
|
|
564
|
+
*/
|
|
565
|
+
const RESTART = " restart: on-failure:5";
|
|
566
|
+
/** A long-running service's {@link LOGGING} and {@link RESTART} lines, which nearly every service has together. */
|
|
567
|
+
const SERVICE_DEFAULTS = `${LOGGING}\n${RESTART}`;
|
|
449
568
|
/** Whether `url` (functions' direct database URL) names the stack's own `db` service. */
|
|
450
569
|
export function namesComposeDatabase(url) {
|
|
451
570
|
try {
|
|
@@ -474,6 +593,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
|
474
593
|
const postgrestUrl = postgrestDatabaseUrl(config);
|
|
475
594
|
const sqlEditorUrl = sqlEditorDatabaseUrl(config);
|
|
476
595
|
const devLocal = options?.devLocal === true;
|
|
596
|
+
const ownBucket = keepsFilesInOwnBucket(config, devLocal);
|
|
477
597
|
// An external database is not on any network of this stack.
|
|
478
598
|
const functionsDb = options?.functionsDatabase === true && !external;
|
|
479
599
|
const gatewayNetworks = networksClause(["default", FUNCTIONS_NETWORK]);
|
|
@@ -489,6 +609,8 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
|
489
609
|
const publicApiUrl = `\${API_EXTERNAL_URL:-${externalUrlFallback}}`;
|
|
490
610
|
// OAuth providers hang their default callback off the same public URL the server is told it has.
|
|
491
611
|
const authProviderEnv = composeAuthProviderEnv(config, publicApiUrl);
|
|
612
|
+
// SAML's service provider sits under the same public URL, at /auth/v1 like the OAuth callback.
|
|
613
|
+
const samlEnv = composeSamlEnv(config, publicApiUrl);
|
|
492
614
|
const studioHostDev = devLocal && hasStudioOverride(config);
|
|
493
615
|
const appEnv = serverAppEnvForCompose(config, devLocal);
|
|
494
616
|
const staticDir = appStaticDir(config);
|
|
@@ -504,6 +626,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
|
504
626
|
: `
|
|
505
627
|
studio:
|
|
506
628
|
${studioService}
|
|
629
|
+
${SERVICE_DEFAULTS}
|
|
507
630
|
environment:
|
|
508
631
|
SUPATYPE_CLOUD_JSON: '${studioRuntimeJson(config, publicApiUrl)}'
|
|
509
632
|
expose:
|
|
@@ -551,12 +674,17 @@ ${studioService}
|
|
|
551
674
|
`;
|
|
552
675
|
// One source for the credentials: the server is configured with them and the storage service is
|
|
553
676
|
// handed them, and a mismatch does not fail at start, it fails at the first upload.
|
|
554
|
-
const objectStoreBlock = ` seaweedfs:
|
|
677
|
+
const objectStoreBlock = ownBucket ? "" : ` seaweedfs:
|
|
555
678
|
# Identities come from a config file rather than env vars, and the anonymous identity is
|
|
556
679
|
# deliberately absent: a bucket is public because of its policy, never because the server is
|
|
557
680
|
# open. Written beside this file by the same generator, so the two cannot drift.
|
|
558
681
|
image: \${SUPATYPE_SEAWEEDFS_IMAGE:-${SEAWEEDFS_IMAGE}}
|
|
682
|
+
${SERVICE_DEFAULTS}
|
|
559
683
|
command: server -dir=/data -s3 -s3.port=8333 -s3.config=/etc/seaweedfs/s3.json
|
|
684
|
+
environment:
|
|
685
|
+
# Read by nothing inside. The object store loads s3.json only when it starts, so the login is
|
|
686
|
+
# named here to make compose restart it whenever the login changes, as it does storage.
|
|
687
|
+
SUPATYPE_S3_LOGIN: "${OBJECT_STORE_ACCESS_KEY}:${OBJECT_STORE_SECRET_KEY}"
|
|
560
688
|
volumes:
|
|
561
689
|
- storage-data:/data
|
|
562
690
|
${mounts.seaweed}
|
|
@@ -570,11 +698,17 @@ ${mounts.seaweed}
|
|
|
570
698
|
retries: 20
|
|
571
699
|
start_period: 5s
|
|
572
700
|
${seaweedPorts}`;
|
|
701
|
+
// 0.9.2 release test (N-RB2): the keyspace requires the project's password where the image takes
|
|
702
|
+
// one, and everything that talks RESP to it is handed the same value from .env, or the same file
|
|
703
|
+
// (R2-S16).
|
|
704
|
+
const keyspacePasswordFile = options?.keyspacePasswordFile;
|
|
705
|
+
const keyspaceAuthEnv = keyspacePasswordEnv(config, keyspacePasswordFile);
|
|
706
|
+
const keyspaceMount = keyspacePasswordMount(config, keyspacePasswordFile);
|
|
573
707
|
const kongTlsEnv = tlsEnabled
|
|
574
708
|
? ` KONG_PROXY_LISTEN: "0.0.0.0:8000, 0.0.0.0:8443 ssl"
|
|
575
709
|
KONG_LUA_SSL_TRUSTED_CERTIFICATE: system
|
|
576
710
|
KONG_LUA_SSL_VERIFY_DEPTH: "2"
|
|
577
|
-
`
|
|
711
|
+
${keyspaceAuthEnv}`
|
|
578
712
|
: "";
|
|
579
713
|
const kongPorts = tlsEnabled
|
|
580
714
|
? ` - "80:8000"
|
|
@@ -592,6 +726,7 @@ ${seaweedPorts}`;
|
|
|
592
726
|
: `
|
|
593
727
|
valkey:
|
|
594
728
|
image: \${SUPATYPE_VALKEY_IMAGE:-valkey/valkey:8-alpine}
|
|
729
|
+
${SERVICE_DEFAULTS}
|
|
595
730
|
command: ["valkey-server", "--appendonly", "yes"]
|
|
596
731
|
expose:
|
|
597
732
|
- "6379"
|
|
@@ -608,9 +743,8 @@ ${seaweedPorts}`;
|
|
|
608
743
|
# then re-run \`supatype self-host compose up -d\`. Kong publishes :80/:443 and provisions certs automatically.
|
|
609
744
|
`;
|
|
610
745
|
// An external database is not ours to declare a volume for.
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
${keyspaceInPg ? "" : " valkey-data:\n"}`;
|
|
746
|
+
const volumes = `${external ? "" : ` ${DB_VOLUME_KEY}:\n`}${ownBucket ? "" : " storage-data:\n"}${keyspaceInPg ? "" : " valkey-data:\n"}`;
|
|
747
|
+
const volumesBlock = volumes === "" ? "" : `volumes:\n${volumes}`;
|
|
614
748
|
// `depends_on` for the services that talk to Postgres. With an external database there is no
|
|
615
749
|
// container to wait on, so the clause disappears entirely and each service retries on connect
|
|
616
750
|
// instead: which is also what covers a database that restarts *after* boot, something no
|
|
@@ -631,7 +765,7 @@ ${keyspaceInPg ? "" : " valkey-data:\n"}`;
|
|
|
631
765
|
//
|
|
632
766
|
// A later push succeeds, which is exactly what made it read as an intermittent mystery. It
|
|
633
767
|
// lands on the first push after a stack comes up, which is the first push a new user ever runs.
|
|
634
|
-
const storageDependency = ` depends_on:
|
|
768
|
+
const storageDependency = ownBucket ? dbDependency : ` depends_on:
|
|
635
769
|
${dbDependencyClause} seaweedfs:
|
|
636
770
|
condition: service_healthy
|
|
637
771
|
`;
|
|
@@ -646,6 +780,7 @@ ${dbDependencyClause} seaweedfs:
|
|
|
646
780
|
const realtimeBlock = realtime
|
|
647
781
|
? ` realtime:
|
|
648
782
|
image: ${inRepoImage("realtime")}
|
|
783
|
+
${SERVICE_DEFAULTS}
|
|
649
784
|
expose:
|
|
650
785
|
- "4000"
|
|
651
786
|
- "4001"
|
|
@@ -746,7 +881,7 @@ ${dbDependency}`
|
|
|
746
881
|
# Named here rather than left to the image because only this file knows both features are in
|
|
747
882
|
# the same stack.
|
|
748
883
|
SUPATYPE_KEYSPACE_OUTPUT_PLUGIN_LIBRARIES: "supacache_keys, wal2json"
|
|
749
|
-
`
|
|
884
|
+
${keyspaceAuthEnv}`
|
|
750
885
|
: "";
|
|
751
886
|
// Not published to the host: the keyspace is reachable to the compose network
|
|
752
887
|
// (server, Kong) and nothing else. A RESP port on a public interface is an
|
|
@@ -763,6 +898,7 @@ ${dbDependency}`
|
|
|
763
898
|
`
|
|
764
899
|
: ` db:
|
|
765
900
|
image: \${SUPATYPE_POSTGRES_IMAGE:-${runningPostgresImage(config)}}
|
|
901
|
+
${SERVICE_DEFAULTS}
|
|
766
902
|
${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} environment:
|
|
767
903
|
POSTGRES_USER: \${POSTGRES_USER:-supatype_admin}
|
|
768
904
|
POSTGRES_PASSWORD: \${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is missing from .env}
|
|
@@ -773,7 +909,7 @@ ${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} envir
|
|
|
773
909
|
SUPATYPE_SQL_EDITOR_PASSWORD: \${SUPATYPE_SQL_EDITOR_PASSWORD:?SUPATYPE_SQL_EDITOR_PASSWORD is missing from .env}
|
|
774
910
|
${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
|
|
775
911
|
- ${DB_VOLUME_KEY}:/var/lib/postgresql/data
|
|
776
|
-
healthcheck:
|
|
912
|
+
${keyspaceMount} healthcheck:
|
|
777
913
|
# -h 127.0.0.1 forces TCP. Without it \`pg_isready\` uses the Unix socket, which the
|
|
778
914
|
# entrypoint's temporary init server is already listening on while TCP is still refused,
|
|
779
915
|
# so the container reported healthy, \`depends_on: service_healthy\` released, and every
|
|
@@ -794,9 +930,10 @@ ${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
|
|
|
794
930
|
# Named, so a compose command run by hand reaches this stack instead of starting a second one
|
|
795
931
|
# under the folder's name. \`supatype self-host compose restart <service>\` saves running one.
|
|
796
932
|
name: ${composeProject}
|
|
797
|
-
services:
|
|
933
|
+
${LOGGING_ANCHOR}services:
|
|
798
934
|
${dbServiceBlock} postgrest:
|
|
799
935
|
image: ${POSTGREST_IMAGE}
|
|
936
|
+
${SERVICE_DEFAULTS}
|
|
800
937
|
expose:
|
|
801
938
|
- "3000"
|
|
802
939
|
environment:
|
|
@@ -821,18 +958,14 @@ ${dbServiceBlock} postgrest:
|
|
|
821
958
|
${hookActorLines(config)}${dbDependency}
|
|
822
959
|
storage:
|
|
823
960
|
image: ${inRepoImage("storage")}
|
|
961
|
+
${SERVICE_DEFAULTS}
|
|
824
962
|
expose:
|
|
825
963
|
- "5000"
|
|
826
964
|
environment:
|
|
827
965
|
PORT: 5000
|
|
828
966
|
DATABASE_URL: "${ownerUrl}"
|
|
829
967
|
JWT_SECRET: \${JWT_SECRET:?JWT_SECRET is missing from .env}
|
|
830
|
-
|
|
831
|
-
S3_REGION: us-east-1
|
|
832
|
-
S3_ACCESS_KEY: ${OBJECT_STORE_ACCESS_KEY}
|
|
833
|
-
S3_SECRET_KEY: ${OBJECT_STORE_SECRET_KEY}
|
|
834
|
-
S3_FORCE_PATH_STYLE: "true"
|
|
835
|
-
# Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
|
|
968
|
+
${storageS3Env(ownBucket)} # Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
|
|
836
969
|
# sets one; the service on its own defaults to the free tier's 1 GiB quota and 50 MB files.
|
|
837
970
|
PROJECT_TIER: \${PROJECT_TIER:-enterprise}
|
|
838
971
|
STORAGE_QUOTA: \${STORAGE_QUOTA:--1}
|
|
@@ -841,6 +974,7 @@ ${hookActorLines(config)}${dbDependency}
|
|
|
841
974
|
${storageDependency}
|
|
842
975
|
functions-worker:
|
|
843
976
|
image: ${inRepoImage("functions-worker")}
|
|
977
|
+
${SERVICE_DEFAULTS}
|
|
844
978
|
# An init as PID 1 passes the stop signal on: without one the worker ignored SIGTERM, and every
|
|
845
979
|
# restart a deploy made waited out the whole stop timeout.
|
|
846
980
|
init: true
|
|
@@ -910,6 +1044,7 @@ ${dbDependency}
|
|
|
910
1044
|
${realtimeBlock}
|
|
911
1045
|
control-plane:
|
|
912
1046
|
image: ${inRepoImage("control-plane")}
|
|
1047
|
+
${SERVICE_DEFAULTS}
|
|
913
1048
|
expose:
|
|
914
1049
|
- "8080"
|
|
915
1050
|
volumes:
|
|
@@ -935,6 +1070,7 @@ ${mounts.projectWritable}
|
|
|
935
1070
|
${realtimeControlPlaneEnv}${dbDependency}
|
|
936
1071
|
server:
|
|
937
1072
|
image: \${SUPATYPE_SERVER_IMAGE:-\${SUPATYPE_AUTH_IMAGE:-${RELEASE_IMAGES.server}}}
|
|
1073
|
+
${LOGGING}
|
|
938
1074
|
# host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
|
|
939
1075
|
# mapped, so a project proxying the site or Studio to something on the host worked on macOS
|
|
940
1076
|
# and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
|
|
@@ -948,7 +1084,7 @@ ${realtimeControlPlaneEnv}${dbDependency}
|
|
|
948
1084
|
# on a slow host the gap is wide enough to lose it for good. Bounded
|
|
949
1085
|
# rather than unlimited, so a real misconfiguration still stops and
|
|
950
1086
|
# stays visible instead of hiding in a crash loop.
|
|
951
|
-
|
|
1087
|
+
${RESTART}
|
|
952
1088
|
${gatewayNetworks}${serverPorts} volumes:
|
|
953
1089
|
# The project is read-only: the server reads the schema, the manifest and the functions, and
|
|
954
1090
|
# has no business editing any of them.
|
|
@@ -961,7 +1097,7 @@ ${mounts.projectReadOnly}
|
|
|
961
1097
|
# declared and never actually switched on. A narrower bind than making the whole project
|
|
962
1098
|
# writable, because the rest of the tree keeps the guarantee.
|
|
963
1099
|
${mounts.projectState}
|
|
964
|
-
working_dir: /project
|
|
1100
|
+
${keyspaceMount} working_dir: /project
|
|
965
1101
|
environment:
|
|
966
1102
|
SUPATYPE_MODE: ${devLocal ? "dev" : "standalone"}
|
|
967
1103
|
SUPATYPE_MANIFEST_PATH: .supatype/manifest.json
|
|
@@ -972,7 +1108,7 @@ ${mounts.projectState}
|
|
|
972
1108
|
SUPATYPE_STORAGE_URL: http://storage:5000
|
|
973
1109
|
SUPATYPE_URL: ${publicApiUrl}
|
|
974
1110
|
SUPATYPE_ANON_KEY: \${ANON_KEY:-}
|
|
975
|
-
SUPATYPE_SERVICE_ROLE_KEY: \${SERVICE_ROLE_KEY:-}
|
|
1111
|
+
${publicEnvForCompose(config)} SUPATYPE_SERVICE_ROLE_KEY: \${SERVICE_ROLE_KEY:-}
|
|
976
1112
|
SUPATYPE_SQL_DATABASE_URL: "${ownerUrl}"
|
|
977
1113
|
# The SQL editor's own login, not a superuser. The owner URL above stays: the server falls
|
|
978
1114
|
# back to it and uses it for role membership.
|
|
@@ -984,7 +1120,7 @@ ${realtimeServerEnv}
|
|
|
984
1120
|
SUPATYPE_CONTROL_PLANE_URL: http://control-plane:8080
|
|
985
1121
|
${CONTROL_PLANE_SECRET_REQUIRED}
|
|
986
1122
|
SUPATYPE_VALKEY_ADDR: ${respHost}:6379
|
|
987
|
-
${appEnv}
|
|
1123
|
+
${keyspaceServerEnv(config, keyspacePasswordFile)}${appEnv}
|
|
988
1124
|
SUPATYPE_API_HOST: 0.0.0.0
|
|
989
1125
|
SUPATYPE_API_PORT: 9999
|
|
990
1126
|
SUPATYPE_API_EXTERNAL_URL: ${publicApiUrl}
|
|
@@ -999,8 +1135,10 @@ ${appEnv}
|
|
|
999
1135
|
SUPATYPE_JWT_AUD: authenticated
|
|
1000
1136
|
SUPATYPE_JWT_DEFAULT_GROUP_NAME: authenticated
|
|
1001
1137
|
SUPATYPE_JWT_ADMIN_ROLES: service_role,supatype_admin
|
|
1002
|
-
# auth.email.enableConfirmations
|
|
1003
|
-
|
|
1138
|
+
# auth.email.enabled and auth.email.enableConfirmations decide the fallbacks; a value in .env
|
|
1139
|
+
# wins. Unset, a standalone stack sends confirmation links and a dev one confirms at once.
|
|
1140
|
+
${EMAIL_ENABLED_ENV}: \${${EMAIL_ENABLED_ENV}:-${configEmailEnabled(config)}}
|
|
1141
|
+
SUPATYPE_MAILER_AUTOCONFIRM: \${SUPATYPE_MAILER_AUTOCONFIRM:-${configMailerAutoconfirm(config, devLocal ? "dev" : "standalone")}}
|
|
1004
1142
|
# Emailed links are SUPATYPE_API_EXTERNAL_URL plus these paths. The external URL is the
|
|
1005
1143
|
# gateway's root, where / belongs to the app, so the server's default of /verify sent every
|
|
1006
1144
|
# confirmation, magic-link and recovery link to a 404. The auth routes are under /auth/v1/.
|
|
@@ -1025,7 +1163,7 @@ ${composeEnvLines(mailerUrlPathsEnv())}
|
|
|
1025
1163
|
# to get them and a resend or ses provider fell back to the noop mailer.
|
|
1026
1164
|
${composeEnvLines(Object.fromEntries(MAILER_PASSTHROUGH_ENV.map((name) => [name, `\${${name}:-}`])))}
|
|
1027
1165
|
SUPATYPE_DISABLE_SIGNUP: \${DISABLE_SIGNUP:-false}
|
|
1028
|
-
${authProviderEnv}
|
|
1166
|
+
${authProviderEnv}${samlEnv}
|
|
1029
1167
|
depends_on:
|
|
1030
1168
|
${dbDependencyClause}${keyspaceInPg ? "" : " valkey:\n condition: service_started\n"} postgrest:
|
|
1031
1169
|
condition: service_started
|
|
@@ -1039,6 +1177,7 @@ ${realtimeDependency} control-plane:
|
|
|
1039
1177
|
${objectStoreBlock}
|
|
1040
1178
|
schema-engine:
|
|
1041
1179
|
image: \${${ENGINE_SERVICE.imageVariable}:-${ENGINE_SERVICE.defaultImage}}
|
|
1180
|
+
${LOGGING}
|
|
1042
1181
|
profiles: ["tools"]
|
|
1043
1182
|
entrypoint: ["${ENGINE_SERVICE.entrypoint}"]
|
|
1044
1183
|
volumes:
|
|
@@ -1046,6 +1185,7 @@ ${mounts.engineProject}
|
|
|
1046
1185
|
working_dir: ${ENGINE_SERVICE.projectDir}
|
|
1047
1186
|
${dbDependency}${studioBlock}${valkeyBlock}${tlsHintComment} kong:
|
|
1048
1187
|
image: kong:3.6
|
|
1188
|
+
${SERVICE_DEFAULTS}
|
|
1049
1189
|
${gatewayNetworks} # host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
|
|
1050
1190
|
# mapped, so a project proxying the site or Studio to something on the host worked on macOS
|
|
1051
1191
|
# and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
|
|
@@ -1097,38 +1237,41 @@ function ensureComposeManifest(cwd, config) {
|
|
|
1097
1237
|
// The manifest is generated, not operator-authored, but `push` writes real values into it (the
|
|
1098
1238
|
// schema, for one), so an existing file keeps every key but the routes below. Malformed, it is
|
|
1099
1239
|
// left for the server to complain about rather than overwritten here.
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
patchRouteManifest(manifestPath, {
|
|
1105
|
-
schema: "public",
|
|
1106
|
-
postgrest_url: "http://postgrest:3000",
|
|
1107
|
-
...composeServiceRoutes(config),
|
|
1108
|
-
});
|
|
1240
|
+
const fresh = existsSync(manifestPath) ? {} : { schema: "public", postgrest_url: "http://postgrest:3000" };
|
|
1241
|
+
switchServices(manifestPath, composeServiceSwitches(config), { ...fresh, ...composeServiceRoutes(config) }, { keepMalformed: true });
|
|
1109
1242
|
}
|
|
1110
1243
|
/**
|
|
1111
1244
|
* Where the server finds each service of this stack, set on every render rather than only into a
|
|
1112
1245
|
* new file. Native dev shares the manifest and records its own host ports for realtime, functions
|
|
1113
1246
|
* and storage, so a project moved from native to Docker kept native's URLs and the server proxied
|
|
1114
1247
|
* every subscription and every /storage/v1 call to a port nothing in the stack listened on (502).
|
|
1115
|
-
* An older CLI's `functions_enabled: false` is put right by the same write.
|
|
1116
1248
|
*/
|
|
1117
1249
|
function composeServiceRoutes(config) {
|
|
1118
1250
|
return {
|
|
1119
1251
|
// This file always generates a `storage` service, and native dev records its own storage
|
|
1120
1252
|
// service on a host port.
|
|
1121
1253
|
storage_url: "http://storage:5000",
|
|
1122
|
-
//
|
|
1123
|
-
// the server ends up proxying subscriptions to a host that does not resolve. Undefined drops
|
|
1124
|
-
// the key.
|
|
1125
|
-
realtime_enabled: realtimeEnabled(config),
|
|
1254
|
+
// Undefined drops the key: no realtime service is generated (composeServiceSwitches).
|
|
1126
1255
|
realtime_url: realtimeEnabled(config) ? "http://realtime:4000" : undefined,
|
|
1256
|
+
functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Which services of this stack are switched on, set on every render with its routes. An older
|
|
1261
|
+
* CLI's `functions_enabled: false` is put right by the same write.
|
|
1262
|
+
*/
|
|
1263
|
+
function composeServiceSwitches(config) {
|
|
1264
|
+
return {
|
|
1265
|
+
// The stack's storage is always on, its start value: native dev switches its own storage service
|
|
1266
|
+
// off and on, and a switch it left would switch off the stack's.
|
|
1267
|
+
storage: undefined,
|
|
1268
|
+
// Matches the compose file: a manifest advertising a service that was not generated is how
|
|
1269
|
+
// the server ends up proxying subscriptions to a host that does not resolve.
|
|
1270
|
+
realtime: realtimeEnabled(config),
|
|
1127
1271
|
// True because this file *always* generates a `functions-worker` service and hands the server
|
|
1128
1272
|
// `SUPATYPE_FUNCTIONS_WORKER_URL`. It said false, so the server answered 404 for every function
|
|
1129
1273
|
// in a stack that was running a worker for them, provisioned, then switched off.
|
|
1130
|
-
|
|
1131
|
-
functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
|
|
1274
|
+
functions: true,
|
|
1132
1275
|
};
|
|
1133
1276
|
}
|
|
1134
1277
|
/**
|
|
@@ -1277,16 +1420,27 @@ function resolveDrafts(cwd, config, options) {
|
|
|
1277
1420
|
return options.drafts;
|
|
1278
1421
|
return projectHasVersionedModels(cwd, config);
|
|
1279
1422
|
}
|
|
1423
|
+
/**
|
|
1424
|
+
* The host file holding the keyspace password when the project names one (R2-S16), checked before
|
|
1425
|
+
* anything is written: both forms set, a file that is missing or empty, or a file beside HTTPS
|
|
1426
|
+
* (whose Kong cannot read one) stop here with what to change, rather than in a container later.
|
|
1427
|
+
*/
|
|
1428
|
+
function composeKeyspacePasswordFile(cwd, config, options) {
|
|
1429
|
+
const use = { required: keyspacePasswordRequired(config), tls: selfHostTlsEnabled(config, options?.devLocal === true) };
|
|
1430
|
+
return checkedKeyspacePasswordFile(cwd, use, { brand: { intro: "Self-host compose" } })?.path;
|
|
1431
|
+
}
|
|
1280
1432
|
export function writeSelfHostCompose(cwd, config, options) {
|
|
1281
1433
|
// No URL-unsafe password check here: `supatype update` and the dev watcher write this file too,
|
|
1282
1434
|
// and start nothing. up, render, restart and dev refuse before they start. push, diff and dev's
|
|
1283
1435
|
// recovery only start the database, so they warn (startComposeDatabase in dev-compose.ts).
|
|
1284
1436
|
assertExternalUrlMatchesEnv(cwd, config);
|
|
1285
1437
|
assertBundledDbUser(cwd, config);
|
|
1438
|
+
const keyspacePasswordFile = composeKeyspacePasswordFile(cwd, config, options);
|
|
1286
1439
|
const tier = resolveFieldMaskingTier(cwd, config, options);
|
|
1287
1440
|
const resolved = {
|
|
1288
1441
|
...options,
|
|
1289
1442
|
...(tier !== undefined && { fieldMaskingTier: tier }),
|
|
1443
|
+
...(keyspacePasswordFile !== undefined && { keyspacePasswordFile }),
|
|
1290
1444
|
drafts: resolveDrafts(cwd, config, options),
|
|
1291
1445
|
functionsDatabase: options?.functionsDatabase ?? namesComposeDatabase(readEnvValue(cwd, "SUPATYPE_FUNCTIONS_DB_URL", "")),
|
|
1292
1446
|
};
|
|
@@ -1295,12 +1449,24 @@ export function writeSelfHostCompose(cwd, config, options) {
|
|
|
1295
1449
|
mkdirSync(paths.dir, { recursive: true });
|
|
1296
1450
|
// Before the file that requires it is written, so no stack is ever rendered without one.
|
|
1297
1451
|
ensureControlPlaneSecret(cwd);
|
|
1452
|
+
// The keyspace password the same way, where the keyspace requires one (N-RB2) and the project
|
|
1453
|
+
// keeps it in .env. An existing project gets one on its next dev or up, and compose recreates db
|
|
1454
|
+
// and server with it.
|
|
1455
|
+
if (keyspacePasswordRequired(config) && keyspacePasswordFile === undefined)
|
|
1456
|
+
ensureKeyspacePassword(cwd);
|
|
1457
|
+
// The SAML signing key too, once SAML is on: the file requires it, and it must never change.
|
|
1458
|
+
ensureSamlPrivateKey(cwd, config);
|
|
1298
1459
|
// No functions/ or hooks/ here: the worker mounts the whole project and treats a missing root as
|
|
1299
1460
|
// nothing to serve, while an empty functions/ made `dev` scaffold function types into projects
|
|
1300
1461
|
// that have no functions. `functions new` and `init` create it when there is one.
|
|
1301
1462
|
ensureComposeManifest(cwd, config);
|
|
1302
1463
|
writeFileSync(paths.composePath, renderSelfHostCompose(config, cwd, resolved), "utf8");
|
|
1303
|
-
|
|
1464
|
+
// The object store's login, from the same `.env` values the compose file reads, generated first
|
|
1465
|
+
// when the project has none.
|
|
1466
|
+
// Not for a stack on the project's own bucket, which runs no object store.
|
|
1467
|
+
if (!keepsFilesInOwnBucket(config, options?.devLocal === true)) {
|
|
1468
|
+
writeFileSync(paths.s3ConfigPath, renderSeaweedIdentities(ensureObjectStoreCredentials(cwd)), "utf8");
|
|
1469
|
+
}
|
|
1304
1470
|
const studioHostDev = options?.devLocal === true && hasStudioOverride(config);
|
|
1305
1471
|
const tlsEnabled = selfHostTlsEnabled(config, options?.devLocal === true);
|
|
1306
1472
|
const domain = config.server.domain?.trim();
|
|
@@ -1321,15 +1487,23 @@ export function writeSelfHostCompose(cwd, config, options) {
|
|
|
1321
1487
|
email: acmeEmail,
|
|
1322
1488
|
domain,
|
|
1323
1489
|
redisHost: keyspaceInPostgres(config) ? "db" : "valkey",
|
|
1490
|
+
redisAuth: keyspacePasswordRequired(config),
|
|
1324
1491
|
},
|
|
1325
1492
|
}
|
|
1326
1493
|
: {}),
|
|
1327
1494
|
}), "utf8");
|
|
1328
1495
|
return paths;
|
|
1329
1496
|
}
|
|
1330
|
-
/**
|
|
1497
|
+
/**
|
|
1498
|
+
* What the last compose run that captured its output said when it failed, and the cause recognised,
|
|
1499
|
+
* or nothing. Each run starts it afresh. Said again in the fatal message: under dev's dashboard it
|
|
1500
|
+
* was printed only into the pane, which froze cut at the window's width, and the screen left after
|
|
1501
|
+
* the dashboard said only "docker compose failed" (0.9.2 round 2, R2-S10).
|
|
1502
|
+
*/
|
|
1503
|
+
let lastComposeFailure = [];
|
|
1504
|
+
/** Exit with a friendly compose failure message, carrying the reason the failed run gave. */
|
|
1331
1505
|
export function exitComposeFailed(status, context, brand) {
|
|
1332
|
-
fatalError(`docker compose failed (exit ${status}).`, [context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
|
|
1506
|
+
fatalError(`docker compose failed (exit ${status}).`, [...lastComposeFailure, context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
|
|
1333
1507
|
}
|
|
1334
1508
|
/** The `docker` arguments for `docker compose <args>` on one project's file. */
|
|
1335
1509
|
function composeInvocation(composePath, args, projectRoot, composeProject, quiet) {
|
|
@@ -1352,8 +1526,14 @@ function composeInvocation(composePath, args, projectRoot, composeProject, quiet
|
|
|
1352
1526
|
* person watches and can stop, and a quiet run here is one of those too (docker-exec.ts).
|
|
1353
1527
|
*/
|
|
1354
1528
|
export function runDockerCompose(composePath, args, projectRoot = process.cwd(), composeProject, options) {
|
|
1355
|
-
|
|
1356
|
-
|
|
1529
|
+
if (options?.skipDaemonProbe !== true)
|
|
1530
|
+
requireDockerDaemon(options?.brand !== undefined ? { brand: options.brand } : undefined);
|
|
1531
|
+
lastComposeFailure = [];
|
|
1532
|
+
// Inside a command's flow, docker's output is captured and its stdout logged there. Written
|
|
1533
|
+
// straight to the terminal, it landed in the frame the flow redraws, and every line above it
|
|
1534
|
+
// came out twice.
|
|
1535
|
+
const inFlow = getActiveFlowApi() !== null;
|
|
1536
|
+
const quiet = options?.quiet === true || inFlow;
|
|
1357
1537
|
const runCompose = () => askDockerSync(composeInvocation(composePath, args, projectRoot, composeProject, quiet), {
|
|
1358
1538
|
stdio: quiet ? "pipe" : "inherit",
|
|
1359
1539
|
cwd: projectRoot,
|
|
@@ -1367,6 +1547,9 @@ export function runDockerCompose(composePath, args, projectRoot = process.cwd(),
|
|
|
1367
1547
|
: runCompose();
|
|
1368
1548
|
if (result.status !== 0)
|
|
1369
1549
|
reportComposeFailure(args, quiet ? capturedComposeOutput(result) : null);
|
|
1550
|
+
// The flow's log takes the text a line at a time, blank lines dropped.
|
|
1551
|
+
else if (inFlow && options?.quiet !== true)
|
|
1552
|
+
plain(result.stdout.replace(/\r/g, "").trimEnd());
|
|
1370
1553
|
return result.status ?? 1;
|
|
1371
1554
|
}
|
|
1372
1555
|
/**
|
|
@@ -1396,6 +1579,7 @@ export async function settleComposeRuns() {
|
|
|
1396
1579
|
}
|
|
1397
1580
|
async function quietComposeRun(composePath, args, projectRoot, composeProject, brand) {
|
|
1398
1581
|
await requireDockerDaemonAsync(brand !== undefined ? { brand } : undefined);
|
|
1582
|
+
lastComposeFailure = [];
|
|
1399
1583
|
const runCompose = () => askDockerCompose(composePath, args, projectRoot, composeProject, NO_DOCKER_LIMIT);
|
|
1400
1584
|
// As in runDockerCompose: a Kong already running is reloaded when `up` moved what it routes to.
|
|
1401
1585
|
const result = args[0] === "up"
|
|
@@ -1466,20 +1650,34 @@ function capturedComposeOutput(result) {
|
|
|
1466
1650
|
.trim();
|
|
1467
1651
|
}
|
|
1468
1652
|
/**
|
|
1469
|
-
* Say what a failed compose run printed, when the CLI captured it, and any cause it recognises
|
|
1470
|
-
* `captured` is null when the output already went to the
|
|
1653
|
+
* Say what a failed compose run printed, when the CLI captured it, and any cause it recognises,
|
|
1654
|
+
* and keep it for {@link exitComposeFailed}. `captured` is null when the output already went to the
|
|
1655
|
+
* terminal, which then keeps it too.
|
|
1471
1656
|
*/
|
|
1472
1657
|
function reportComposeFailure(args, captured) {
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
return;
|
|
1477
|
-
for (const line of addressPoolExhaustionHint(captured))
|
|
1658
|
+
const hints = args[0] === "up" ? addressPoolExhaustionHint(captured) : [];
|
|
1659
|
+
const lines = [...(captured ? [`docker compose: ${captured}`] : []), ...hints];
|
|
1660
|
+
for (const line of lines)
|
|
1478
1661
|
console.error(`[supatype] ${line}`);
|
|
1662
|
+
if (captured !== null)
|
|
1663
|
+
lastComposeFailure = lines;
|
|
1479
1664
|
}
|
|
1480
1665
|
/** Compose project name for a Supatype project, isolates docker state per project. */
|
|
1481
1666
|
export function composeProjectName(projectName) {
|
|
1482
1667
|
const slug = projectName.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1483
1668
|
return `supatype-${slug || "project"}`;
|
|
1484
1669
|
}
|
|
1670
|
+
/**
|
|
1671
|
+
* The volumes Docker still holds for the compose project `composeProject`, by compose's own label;
|
|
1672
|
+
* none when Docker cannot say. `down --volumes` removes only those the compose file declares now,
|
|
1673
|
+
* so one a service left the file with (SeaweedFS's, after a switch to S3) is still here.
|
|
1674
|
+
*/
|
|
1675
|
+
export function composeProjectVolumes(composeProject) {
|
|
1676
|
+
const listed = askDockerSync(["volume", "ls", "-q", "--filter", `label=com.docker.compose.project=${composeProject}`], {
|
|
1677
|
+
timeoutMs: DOCKER_QUERY_TIMEOUT_MS,
|
|
1678
|
+
});
|
|
1679
|
+
if (listed.status !== 0)
|
|
1680
|
+
return [];
|
|
1681
|
+
return listed.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "");
|
|
1682
|
+
}
|
|
1485
1683
|
//# sourceMappingURL=self-host-compose.js.map
|