@supatype/cli 0.9.1 → 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 +303 -91
- 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 +21 -3
- package/dist/app/proxy-dev-app.d.ts.map +1 -1
- package/dist/app/proxy-dev-app.js +84 -46
- 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/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/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 +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/admin.js +5 -11
- 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/dev.d.ts +21 -4
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +222 -68
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/doctor.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 +6 -8
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +193 -114
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/link-helpers.js +1 -1
- package/dist/commands/link-helpers.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +3 -1
- package/dist/commands/push.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 +68 -269
- package/dist/commands/self-host.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/compose-db-roles.d.ts.map +1 -1
- package/dist/compose-db-roles.js +3 -0
- package/dist/compose-db-roles.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.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 +9 -11
- 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 +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/dev-compose.d.ts +9 -4
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +87 -53
- 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 +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-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 +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/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-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/env-file.d.ts +18 -3
- package/dist/env-file.d.ts.map +1 -1
- package/dist/env-file.js +23 -7
- package/dist/env-file.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 +1 -1
- package/dist/frontend-env.js.map +1 -1
- 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-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/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 +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/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 +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/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 +10 -0
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +13 -0
- package/dist/local-secrets.js.map +1 -1
- package/dist/local-stack-guard.d.ts.map +1 -1
- package/dist/local-stack-guard.js +3 -2
- package/dist/local-stack-guard.js.map +1 -1
- 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/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/parent-watch.d.ts.map +1 -1
- package/dist/parent-watch.js +4 -8
- package/dist/parent-watch.js.map +1 -1
- package/dist/postgres-ctl.d.ts +31 -5
- package/dist/postgres-ctl.d.ts.map +1 -1
- package/dist/postgres-ctl.js +49 -11
- 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 +73 -4
- package/dist/process-manager.d.ts.map +1 -1
- package/dist/process-manager.js +121 -45
- 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 +33 -4
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +5 -1
- package/dist/project-config.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/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 +5 -1
- package/dist/runtime-routes.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-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.d.ts +15 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/self-host-compose.d.ts +15 -1
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +216 -51
- package/dist/self-host-compose.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-setting-warnings.d.ts +2 -1
- package/dist/stack-setting-warnings.d.ts.map +1 -1
- package/dist/stack-setting-warnings.js +6 -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/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +27 -3
- package/dist/type-extractor.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 +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 +6 -4
- 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,7 +6,7 @@ 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";
|
|
@@ -14,26 +14,28 @@ import { COMPOSE_DEV_KONG_PORT, defaultAppStaticDir, postgrestSchemaEnv, externa
|
|
|
14
14
|
import { hasStudioOverride, pinnedVersion, VERSION_PIN_LOCAL } from "./binary-cache.js";
|
|
15
15
|
import { assertEngineVersionSupported, engineImageVersion } from "./engine-floor.js";
|
|
16
16
|
import { buildKongDeclarative } from "./kong-config.js";
|
|
17
|
-
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";
|
|
18
19
|
import { postgresImageFor, runningPostgresImage } 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";
|
|
25
27
|
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";
|
|
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";
|
|
27
29
|
import { fieldMaskingTierFromProject } from "./field-masking-tier.js";
|
|
28
30
|
import { readRecordedTier } from "./recorded-field-masking-tier.js";
|
|
29
31
|
import { projectHasVersionedModels } from "./model-versioning.js";
|
|
30
32
|
import { POSTGREST_IMAGE } from "./postgrest-release.js";
|
|
31
33
|
import { postgrestHookActorEnv } from "./hook-actor.js";
|
|
32
34
|
import { IN_REPO_IMAGE_ENV, RELEASE_IMAGES, unpinnedImagesNote } from "./release-images.js";
|
|
33
|
-
import { configMailerAutoconfirm } from "./mailer-autoconfirm.js";
|
|
35
|
+
import { configEmailEnabled, configMailerAutoconfirm, EMAIL_ENABLED_ENV } from "./mailer-autoconfirm.js";
|
|
34
36
|
import { MAILER_PASSTHROUGH_ENV, mailerUrlPathsEnv } from "./mailer-env.js";
|
|
35
37
|
import { studioRuntimeJson } from "./studio-auth-config.js";
|
|
36
|
-
import {
|
|
38
|
+
import { switchServices } from "./route-manifest.js";
|
|
37
39
|
/**
|
|
38
40
|
* The control plane secret as the server and the control plane receive it, and nobody else.
|
|
39
41
|
*
|
|
@@ -41,6 +43,41 @@ import { patchRouteManifest } from "./route-manifest.js";
|
|
|
41
43
|
* refuse to start the stack and say which variable is missing.
|
|
42
44
|
*/
|
|
43
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
|
+
}
|
|
44
81
|
/** Env keys written when `versions` pins exist in supatype.config.ts. */
|
|
45
82
|
export const COMPOSE_PINNED_IMAGE_ENV_KEYS = [
|
|
46
83
|
"SUPATYPE_ENGINE_IMAGE",
|
|
@@ -68,6 +105,35 @@ const ACME_KEY_PREFIX = "kong_acme:";
|
|
|
68
105
|
*/
|
|
69
106
|
const OBJECT_STORE_ACCESS_KEY = `\${${OBJECT_STORE_ACCESS_KEY_ENV}:?${OBJECT_STORE_ACCESS_KEY_ENV} is missing from .env}`;
|
|
70
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
|
+
}
|
|
71
137
|
/**
|
|
72
138
|
* The compose volume key Postgres keeps its data in. Docker names the volume
|
|
73
139
|
* `<compose project>_<key>`, and `supatype dev --reset-db` removes it by that name, so the key is
|
|
@@ -212,6 +278,10 @@ export function selfHostComposePaths(cwd) {
|
|
|
212
278
|
s3ConfigPath: join(dir, "s3.json"),
|
|
213
279
|
};
|
|
214
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
|
+
}
|
|
215
285
|
export function appUpstreamForCompose(config) {
|
|
216
286
|
if (config.app.mode !== "proxy")
|
|
217
287
|
return undefined;
|
|
@@ -461,6 +531,40 @@ function networksClause(networks) {
|
|
|
461
531
|
function networksBlock(functionsDb) {
|
|
462
532
|
return `networks:\n ${FUNCTIONS_NETWORK}: {}\n${functionsDb ? ` ${FUNCTIONS_DB_NETWORK}: {}\n` : ""}`;
|
|
463
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}`;
|
|
464
568
|
/** Whether `url` (functions' direct database URL) names the stack's own `db` service. */
|
|
465
569
|
export function namesComposeDatabase(url) {
|
|
466
570
|
try {
|
|
@@ -489,6 +593,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
|
489
593
|
const postgrestUrl = postgrestDatabaseUrl(config);
|
|
490
594
|
const sqlEditorUrl = sqlEditorDatabaseUrl(config);
|
|
491
595
|
const devLocal = options?.devLocal === true;
|
|
596
|
+
const ownBucket = keepsFilesInOwnBucket(config, devLocal);
|
|
492
597
|
// An external database is not on any network of this stack.
|
|
493
598
|
const functionsDb = options?.functionsDatabase === true && !external;
|
|
494
599
|
const gatewayNetworks = networksClause(["default", FUNCTIONS_NETWORK]);
|
|
@@ -521,6 +626,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
|
|
|
521
626
|
: `
|
|
522
627
|
studio:
|
|
523
628
|
${studioService}
|
|
629
|
+
${SERVICE_DEFAULTS}
|
|
524
630
|
environment:
|
|
525
631
|
SUPATYPE_CLOUD_JSON: '${studioRuntimeJson(config, publicApiUrl)}'
|
|
526
632
|
expose:
|
|
@@ -568,11 +674,12 @@ ${studioService}
|
|
|
568
674
|
`;
|
|
569
675
|
// One source for the credentials: the server is configured with them and the storage service is
|
|
570
676
|
// handed them, and a mismatch does not fail at start, it fails at the first upload.
|
|
571
|
-
const objectStoreBlock = ` seaweedfs:
|
|
677
|
+
const objectStoreBlock = ownBucket ? "" : ` seaweedfs:
|
|
572
678
|
# Identities come from a config file rather than env vars, and the anonymous identity is
|
|
573
679
|
# deliberately absent: a bucket is public because of its policy, never because the server is
|
|
574
680
|
# open. Written beside this file by the same generator, so the two cannot drift.
|
|
575
681
|
image: \${SUPATYPE_SEAWEEDFS_IMAGE:-${SEAWEEDFS_IMAGE}}
|
|
682
|
+
${SERVICE_DEFAULTS}
|
|
576
683
|
command: server -dir=/data -s3 -s3.port=8333 -s3.config=/etc/seaweedfs/s3.json
|
|
577
684
|
environment:
|
|
578
685
|
# Read by nothing inside. The object store loads s3.json only when it starts, so the login is
|
|
@@ -591,11 +698,17 @@ ${mounts.seaweed}
|
|
|
591
698
|
retries: 20
|
|
592
699
|
start_period: 5s
|
|
593
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);
|
|
594
707
|
const kongTlsEnv = tlsEnabled
|
|
595
708
|
? ` KONG_PROXY_LISTEN: "0.0.0.0:8000, 0.0.0.0:8443 ssl"
|
|
596
709
|
KONG_LUA_SSL_TRUSTED_CERTIFICATE: system
|
|
597
710
|
KONG_LUA_SSL_VERIFY_DEPTH: "2"
|
|
598
|
-
`
|
|
711
|
+
${keyspaceAuthEnv}`
|
|
599
712
|
: "";
|
|
600
713
|
const kongPorts = tlsEnabled
|
|
601
714
|
? ` - "80:8000"
|
|
@@ -613,6 +726,7 @@ ${seaweedPorts}`;
|
|
|
613
726
|
: `
|
|
614
727
|
valkey:
|
|
615
728
|
image: \${SUPATYPE_VALKEY_IMAGE:-valkey/valkey:8-alpine}
|
|
729
|
+
${SERVICE_DEFAULTS}
|
|
616
730
|
command: ["valkey-server", "--appendonly", "yes"]
|
|
617
731
|
expose:
|
|
618
732
|
- "6379"
|
|
@@ -629,9 +743,8 @@ ${seaweedPorts}`;
|
|
|
629
743
|
# then re-run \`supatype self-host compose up -d\`. Kong publishes :80/:443 and provisions certs automatically.
|
|
630
744
|
`;
|
|
631
745
|
// An external database is not ours to declare a volume for.
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
${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}`;
|
|
635
748
|
// `depends_on` for the services that talk to Postgres. With an external database there is no
|
|
636
749
|
// container to wait on, so the clause disappears entirely and each service retries on connect
|
|
637
750
|
// instead: which is also what covers a database that restarts *after* boot, something no
|
|
@@ -652,7 +765,7 @@ ${keyspaceInPg ? "" : " valkey-data:\n"}`;
|
|
|
652
765
|
//
|
|
653
766
|
// A later push succeeds, which is exactly what made it read as an intermittent mystery. It
|
|
654
767
|
// 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:
|
|
768
|
+
const storageDependency = ownBucket ? dbDependency : ` depends_on:
|
|
656
769
|
${dbDependencyClause} seaweedfs:
|
|
657
770
|
condition: service_healthy
|
|
658
771
|
`;
|
|
@@ -667,6 +780,7 @@ ${dbDependencyClause} seaweedfs:
|
|
|
667
780
|
const realtimeBlock = realtime
|
|
668
781
|
? ` realtime:
|
|
669
782
|
image: ${inRepoImage("realtime")}
|
|
783
|
+
${SERVICE_DEFAULTS}
|
|
670
784
|
expose:
|
|
671
785
|
- "4000"
|
|
672
786
|
- "4001"
|
|
@@ -767,7 +881,7 @@ ${dbDependency}`
|
|
|
767
881
|
# Named here rather than left to the image because only this file knows both features are in
|
|
768
882
|
# the same stack.
|
|
769
883
|
SUPATYPE_KEYSPACE_OUTPUT_PLUGIN_LIBRARIES: "supacache_keys, wal2json"
|
|
770
|
-
`
|
|
884
|
+
${keyspaceAuthEnv}`
|
|
771
885
|
: "";
|
|
772
886
|
// Not published to the host: the keyspace is reachable to the compose network
|
|
773
887
|
// (server, Kong) and nothing else. A RESP port on a public interface is an
|
|
@@ -784,6 +898,7 @@ ${dbDependency}`
|
|
|
784
898
|
`
|
|
785
899
|
: ` db:
|
|
786
900
|
image: \${SUPATYPE_POSTGRES_IMAGE:-${runningPostgresImage(config)}}
|
|
901
|
+
${SERVICE_DEFAULTS}
|
|
787
902
|
${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} environment:
|
|
788
903
|
POSTGRES_USER: \${POSTGRES_USER:-supatype_admin}
|
|
789
904
|
POSTGRES_PASSWORD: \${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is missing from .env}
|
|
@@ -794,7 +909,7 @@ ${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} envir
|
|
|
794
909
|
SUPATYPE_SQL_EDITOR_PASSWORD: \${SUPATYPE_SQL_EDITOR_PASSWORD:?SUPATYPE_SQL_EDITOR_PASSWORD is missing from .env}
|
|
795
910
|
${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
|
|
796
911
|
- ${DB_VOLUME_KEY}:/var/lib/postgresql/data
|
|
797
|
-
healthcheck:
|
|
912
|
+
${keyspaceMount} healthcheck:
|
|
798
913
|
# -h 127.0.0.1 forces TCP. Without it \`pg_isready\` uses the Unix socket, which the
|
|
799
914
|
# entrypoint's temporary init server is already listening on while TCP is still refused,
|
|
800
915
|
# so the container reported healthy, \`depends_on: service_healthy\` released, and every
|
|
@@ -815,9 +930,10 @@ ${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
|
|
|
815
930
|
# Named, so a compose command run by hand reaches this stack instead of starting a second one
|
|
816
931
|
# under the folder's name. \`supatype self-host compose restart <service>\` saves running one.
|
|
817
932
|
name: ${composeProject}
|
|
818
|
-
services:
|
|
933
|
+
${LOGGING_ANCHOR}services:
|
|
819
934
|
${dbServiceBlock} postgrest:
|
|
820
935
|
image: ${POSTGREST_IMAGE}
|
|
936
|
+
${SERVICE_DEFAULTS}
|
|
821
937
|
expose:
|
|
822
938
|
- "3000"
|
|
823
939
|
environment:
|
|
@@ -842,18 +958,14 @@ ${dbServiceBlock} postgrest:
|
|
|
842
958
|
${hookActorLines(config)}${dbDependency}
|
|
843
959
|
storage:
|
|
844
960
|
image: ${inRepoImage("storage")}
|
|
961
|
+
${SERVICE_DEFAULTS}
|
|
845
962
|
expose:
|
|
846
963
|
- "5000"
|
|
847
964
|
environment:
|
|
848
965
|
PORT: 5000
|
|
849
966
|
DATABASE_URL: "${ownerUrl}"
|
|
850
967
|
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
|
|
968
|
+
${storageS3Env(ownBucket)} # Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
|
|
857
969
|
# sets one; the service on its own defaults to the free tier's 1 GiB quota and 50 MB files.
|
|
858
970
|
PROJECT_TIER: \${PROJECT_TIER:-enterprise}
|
|
859
971
|
STORAGE_QUOTA: \${STORAGE_QUOTA:--1}
|
|
@@ -862,6 +974,7 @@ ${hookActorLines(config)}${dbDependency}
|
|
|
862
974
|
${storageDependency}
|
|
863
975
|
functions-worker:
|
|
864
976
|
image: ${inRepoImage("functions-worker")}
|
|
977
|
+
${SERVICE_DEFAULTS}
|
|
865
978
|
# An init as PID 1 passes the stop signal on: without one the worker ignored SIGTERM, and every
|
|
866
979
|
# restart a deploy made waited out the whole stop timeout.
|
|
867
980
|
init: true
|
|
@@ -931,6 +1044,7 @@ ${dbDependency}
|
|
|
931
1044
|
${realtimeBlock}
|
|
932
1045
|
control-plane:
|
|
933
1046
|
image: ${inRepoImage("control-plane")}
|
|
1047
|
+
${SERVICE_DEFAULTS}
|
|
934
1048
|
expose:
|
|
935
1049
|
- "8080"
|
|
936
1050
|
volumes:
|
|
@@ -956,6 +1070,7 @@ ${mounts.projectWritable}
|
|
|
956
1070
|
${realtimeControlPlaneEnv}${dbDependency}
|
|
957
1071
|
server:
|
|
958
1072
|
image: \${SUPATYPE_SERVER_IMAGE:-\${SUPATYPE_AUTH_IMAGE:-${RELEASE_IMAGES.server}}}
|
|
1073
|
+
${LOGGING}
|
|
959
1074
|
# host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
|
|
960
1075
|
# mapped, so a project proxying the site or Studio to something on the host worked on macOS
|
|
961
1076
|
# and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
|
|
@@ -969,7 +1084,7 @@ ${realtimeControlPlaneEnv}${dbDependency}
|
|
|
969
1084
|
# on a slow host the gap is wide enough to lose it for good. Bounded
|
|
970
1085
|
# rather than unlimited, so a real misconfiguration still stops and
|
|
971
1086
|
# stays visible instead of hiding in a crash loop.
|
|
972
|
-
|
|
1087
|
+
${RESTART}
|
|
973
1088
|
${gatewayNetworks}${serverPorts} volumes:
|
|
974
1089
|
# The project is read-only: the server reads the schema, the manifest and the functions, and
|
|
975
1090
|
# has no business editing any of them.
|
|
@@ -982,7 +1097,7 @@ ${mounts.projectReadOnly}
|
|
|
982
1097
|
# declared and never actually switched on. A narrower bind than making the whole project
|
|
983
1098
|
# writable, because the rest of the tree keeps the guarantee.
|
|
984
1099
|
${mounts.projectState}
|
|
985
|
-
working_dir: /project
|
|
1100
|
+
${keyspaceMount} working_dir: /project
|
|
986
1101
|
environment:
|
|
987
1102
|
SUPATYPE_MODE: ${devLocal ? "dev" : "standalone"}
|
|
988
1103
|
SUPATYPE_MANIFEST_PATH: .supatype/manifest.json
|
|
@@ -1005,7 +1120,7 @@ ${realtimeServerEnv}
|
|
|
1005
1120
|
SUPATYPE_CONTROL_PLANE_URL: http://control-plane:8080
|
|
1006
1121
|
${CONTROL_PLANE_SECRET_REQUIRED}
|
|
1007
1122
|
SUPATYPE_VALKEY_ADDR: ${respHost}:6379
|
|
1008
|
-
${appEnv}
|
|
1123
|
+
${keyspaceServerEnv(config, keyspacePasswordFile)}${appEnv}
|
|
1009
1124
|
SUPATYPE_API_HOST: 0.0.0.0
|
|
1010
1125
|
SUPATYPE_API_PORT: 9999
|
|
1011
1126
|
SUPATYPE_API_EXTERNAL_URL: ${publicApiUrl}
|
|
@@ -1020,8 +1135,10 @@ ${appEnv}
|
|
|
1020
1135
|
SUPATYPE_JWT_AUD: authenticated
|
|
1021
1136
|
SUPATYPE_JWT_DEFAULT_GROUP_NAME: authenticated
|
|
1022
1137
|
SUPATYPE_JWT_ADMIN_ROLES: service_role,supatype_admin
|
|
1023
|
-
# auth.email.enableConfirmations
|
|
1024
|
-
|
|
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")}}
|
|
1025
1142
|
# Emailed links are SUPATYPE_API_EXTERNAL_URL plus these paths. The external URL is the
|
|
1026
1143
|
# gateway's root, where / belongs to the app, so the server's default of /verify sent every
|
|
1027
1144
|
# confirmation, magic-link and recovery link to a 404. The auth routes are under /auth/v1/.
|
|
@@ -1060,6 +1177,7 @@ ${realtimeDependency} control-plane:
|
|
|
1060
1177
|
${objectStoreBlock}
|
|
1061
1178
|
schema-engine:
|
|
1062
1179
|
image: \${${ENGINE_SERVICE.imageVariable}:-${ENGINE_SERVICE.defaultImage}}
|
|
1180
|
+
${LOGGING}
|
|
1063
1181
|
profiles: ["tools"]
|
|
1064
1182
|
entrypoint: ["${ENGINE_SERVICE.entrypoint}"]
|
|
1065
1183
|
volumes:
|
|
@@ -1067,6 +1185,7 @@ ${mounts.engineProject}
|
|
|
1067
1185
|
working_dir: ${ENGINE_SERVICE.projectDir}
|
|
1068
1186
|
${dbDependency}${studioBlock}${valkeyBlock}${tlsHintComment} kong:
|
|
1069
1187
|
image: kong:3.6
|
|
1188
|
+
${SERVICE_DEFAULTS}
|
|
1070
1189
|
${gatewayNetworks} # host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
|
|
1071
1190
|
# mapped, so a project proxying the site or Studio to something on the host worked on macOS
|
|
1072
1191
|
# and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
|
|
@@ -1118,38 +1237,41 @@ function ensureComposeManifest(cwd, config) {
|
|
|
1118
1237
|
// The manifest is generated, not operator-authored, but `push` writes real values into it (the
|
|
1119
1238
|
// schema, for one), so an existing file keeps every key but the routes below. Malformed, it is
|
|
1120
1239
|
// 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
|
-
});
|
|
1240
|
+
const fresh = existsSync(manifestPath) ? {} : { schema: "public", postgrest_url: "http://postgrest:3000" };
|
|
1241
|
+
switchServices(manifestPath, composeServiceSwitches(config), { ...fresh, ...composeServiceRoutes(config) }, { keepMalformed: true });
|
|
1130
1242
|
}
|
|
1131
1243
|
/**
|
|
1132
1244
|
* Where the server finds each service of this stack, set on every render rather than only into a
|
|
1133
1245
|
* new file. Native dev shares the manifest and records its own host ports for realtime, functions
|
|
1134
1246
|
* and storage, so a project moved from native to Docker kept native's URLs and the server proxied
|
|
1135
1247
|
* 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
1248
|
*/
|
|
1138
1249
|
function composeServiceRoutes(config) {
|
|
1139
1250
|
return {
|
|
1140
1251
|
// This file always generates a `storage` service, and native dev records its own storage
|
|
1141
1252
|
// service on a host port.
|
|
1142
1253
|
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),
|
|
1254
|
+
// Undefined drops the key: no realtime service is generated (composeServiceSwitches).
|
|
1147
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),
|
|
1148
1271
|
// True because this file *always* generates a `functions-worker` service and hands the server
|
|
1149
1272
|
// `SUPATYPE_FUNCTIONS_WORKER_URL`. It said false, so the server answered 404 for every function
|
|
1150
1273
|
// in a stack that was running a worker for them, provisioned, then switched off.
|
|
1151
|
-
|
|
1152
|
-
functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
|
|
1274
|
+
functions: true,
|
|
1153
1275
|
};
|
|
1154
1276
|
}
|
|
1155
1277
|
/**
|
|
@@ -1298,16 +1420,27 @@ function resolveDrafts(cwd, config, options) {
|
|
|
1298
1420
|
return options.drafts;
|
|
1299
1421
|
return projectHasVersionedModels(cwd, config);
|
|
1300
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
|
+
}
|
|
1301
1432
|
export function writeSelfHostCompose(cwd, config, options) {
|
|
1302
1433
|
// No URL-unsafe password check here: `supatype update` and the dev watcher write this file too,
|
|
1303
1434
|
// and start nothing. up, render, restart and dev refuse before they start. push, diff and dev's
|
|
1304
1435
|
// recovery only start the database, so they warn (startComposeDatabase in dev-compose.ts).
|
|
1305
1436
|
assertExternalUrlMatchesEnv(cwd, config);
|
|
1306
1437
|
assertBundledDbUser(cwd, config);
|
|
1438
|
+
const keyspacePasswordFile = composeKeyspacePasswordFile(cwd, config, options);
|
|
1307
1439
|
const tier = resolveFieldMaskingTier(cwd, config, options);
|
|
1308
1440
|
const resolved = {
|
|
1309
1441
|
...options,
|
|
1310
1442
|
...(tier !== undefined && { fieldMaskingTier: tier }),
|
|
1443
|
+
...(keyspacePasswordFile !== undefined && { keyspacePasswordFile }),
|
|
1311
1444
|
drafts: resolveDrafts(cwd, config, options),
|
|
1312
1445
|
functionsDatabase: options?.functionsDatabase ?? namesComposeDatabase(readEnvValue(cwd, "SUPATYPE_FUNCTIONS_DB_URL", "")),
|
|
1313
1446
|
};
|
|
@@ -1316,6 +1449,11 @@ export function writeSelfHostCompose(cwd, config, options) {
|
|
|
1316
1449
|
mkdirSync(paths.dir, { recursive: true });
|
|
1317
1450
|
// Before the file that requires it is written, so no stack is ever rendered without one.
|
|
1318
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);
|
|
1319
1457
|
// The SAML signing key too, once SAML is on: the file requires it, and it must never change.
|
|
1320
1458
|
ensureSamlPrivateKey(cwd, config);
|
|
1321
1459
|
// No functions/ or hooks/ here: the worker mounts the whole project and treats a missing root as
|
|
@@ -1325,7 +1463,10 @@ export function writeSelfHostCompose(cwd, config, options) {
|
|
|
1325
1463
|
writeFileSync(paths.composePath, renderSelfHostCompose(config, cwd, resolved), "utf8");
|
|
1326
1464
|
// The object store's login, from the same `.env` values the compose file reads, generated first
|
|
1327
1465
|
// when the project has none.
|
|
1328
|
-
|
|
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
|
+
}
|
|
1329
1470
|
const studioHostDev = options?.devLocal === true && hasStudioOverride(config);
|
|
1330
1471
|
const tlsEnabled = selfHostTlsEnabled(config, options?.devLocal === true);
|
|
1331
1472
|
const domain = config.server.domain?.trim();
|
|
@@ -1346,15 +1487,23 @@ export function writeSelfHostCompose(cwd, config, options) {
|
|
|
1346
1487
|
email: acmeEmail,
|
|
1347
1488
|
domain,
|
|
1348
1489
|
redisHost: keyspaceInPostgres(config) ? "db" : "valkey",
|
|
1490
|
+
redisAuth: keyspacePasswordRequired(config),
|
|
1349
1491
|
},
|
|
1350
1492
|
}
|
|
1351
1493
|
: {}),
|
|
1352
1494
|
}), "utf8");
|
|
1353
1495
|
return paths;
|
|
1354
1496
|
}
|
|
1355
|
-
/**
|
|
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. */
|
|
1356
1505
|
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 });
|
|
1506
|
+
fatalError(`docker compose failed (exit ${status}).`, [...lastComposeFailure, context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
|
|
1358
1507
|
}
|
|
1359
1508
|
/** The `docker` arguments for `docker compose <args>` on one project's file. */
|
|
1360
1509
|
function composeInvocation(composePath, args, projectRoot, composeProject, quiet) {
|
|
@@ -1379,6 +1528,7 @@ function composeInvocation(composePath, args, projectRoot, composeProject, quiet
|
|
|
1379
1528
|
export function runDockerCompose(composePath, args, projectRoot = process.cwd(), composeProject, options) {
|
|
1380
1529
|
if (options?.skipDaemonProbe !== true)
|
|
1381
1530
|
requireDockerDaemon(options?.brand !== undefined ? { brand: options.brand } : undefined);
|
|
1531
|
+
lastComposeFailure = [];
|
|
1382
1532
|
// Inside a command's flow, docker's output is captured and its stdout logged there. Written
|
|
1383
1533
|
// straight to the terminal, it landed in the frame the flow redraws, and every line above it
|
|
1384
1534
|
// came out twice.
|
|
@@ -1429,6 +1579,7 @@ export async function settleComposeRuns() {
|
|
|
1429
1579
|
}
|
|
1430
1580
|
async function quietComposeRun(composePath, args, projectRoot, composeProject, brand) {
|
|
1431
1581
|
await requireDockerDaemonAsync(brand !== undefined ? { brand } : undefined);
|
|
1582
|
+
lastComposeFailure = [];
|
|
1432
1583
|
const runCompose = () => askDockerCompose(composePath, args, projectRoot, composeProject, NO_DOCKER_LIMIT);
|
|
1433
1584
|
// As in runDockerCompose: a Kong already running is reloaded when `up` moved what it routes to.
|
|
1434
1585
|
const result = args[0] === "up"
|
|
@@ -1499,20 +1650,34 @@ function capturedComposeOutput(result) {
|
|
|
1499
1650
|
.trim();
|
|
1500
1651
|
}
|
|
1501
1652
|
/**
|
|
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
|
|
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.
|
|
1504
1656
|
*/
|
|
1505
1657
|
function reportComposeFailure(args, captured) {
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
return;
|
|
1510
|
-
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)
|
|
1511
1661
|
console.error(`[supatype] ${line}`);
|
|
1662
|
+
if (captured !== null)
|
|
1663
|
+
lastComposeFailure = lines;
|
|
1512
1664
|
}
|
|
1513
1665
|
/** Compose project name for a Supatype project, isolates docker state per project. */
|
|
1514
1666
|
export function composeProjectName(projectName) {
|
|
1515
1667
|
const slug = projectName.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1516
1668
|
return `supatype-${slug || "project"}`;
|
|
1517
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
|
+
}
|
|
1518
1683
|
//# sourceMappingURL=self-host-compose.js.map
|