@flisk-sh/flisk 0.0.0-stage → 1.3.190
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 +492 -0
- package/LICENSE +21 -0
- package/README.md +479 -2
- package/Tiltfile +151 -0
- package/cli/bin/flisk.js +42 -0
- package/cli/dist/agent-runtimes/custom.js +335 -0
- package/cli/dist/agent-runtimes/registry.js +34 -0
- package/cli/dist/backend-frameworks/elysia.js +38 -0
- package/cli/dist/backend-frameworks/express.js +49 -0
- package/cli/dist/backend-frameworks/fastify.js +43 -0
- package/cli/dist/backend-frameworks/h3.js +37 -0
- package/cli/dist/backend-frameworks/koa.js +47 -0
- package/cli/dist/backend-frameworks/mcp.js +86 -0
- package/cli/dist/backend-frameworks/nestjs.js +55 -0
- package/cli/dist/backend-frameworks/registry.js +134 -0
- package/cli/dist/backend-frameworks/types.js +1 -0
- package/cli/dist/backend-languages/bun.js +76 -0
- package/cli/dist/backend-languages/go.js +125 -0
- package/cli/dist/backend-languages/node.js +122 -0
- package/cli/dist/backend-languages/python.js +94 -0
- package/cli/dist/backend-languages/registry.js +37 -0
- package/cli/dist/backend-languages/rust.js +82 -0
- package/cli/dist/backend-languages/types.js +1 -0
- package/cli/dist/cli.js +29 -0
- package/cli/dist/commands/__tests__/project-e2e-helpers.js +49 -0
- package/cli/dist/commands/__tests__/ui-loading-screen.test.js +16 -0
- package/cli/dist/commands/agent.js +182 -0
- package/cli/dist/commands/completion-candidates.js +116 -0
- package/cli/dist/commands/completion.js +843 -0
- package/cli/dist/commands/config.js +362 -0
- package/cli/dist/commands/doctor.js +1504 -0
- package/cli/dist/commands/down.js +114 -0
- package/cli/dist/commands/eject.js +108 -0
- package/cli/dist/commands/help.js +152 -0
- package/cli/dist/commands/import.js +164 -0
- package/cli/dist/commands/logs.js +119 -0
- package/cli/dist/commands/maintainers.js +102 -0
- package/cli/dist/commands/mcp.js +28 -0
- package/cli/dist/commands/networks.js +306 -0
- package/cli/dist/commands/project.js +447 -0
- package/cli/dist/commands/projects.js +103 -0
- package/cli/dist/commands/registry.js +53 -0
- package/cli/dist/commands/resource.js +992 -0
- package/cli/dist/commands/resources.js +127 -0
- package/cli/dist/commands/restart.js +89 -0
- package/cli/dist/commands/runtime.js +75 -0
- package/cli/dist/commands/stack.js +171 -0
- package/cli/dist/commands/stacks.js +71 -0
- package/cli/dist/commands/status.js +211 -0
- package/cli/dist/commands/ui.js +725 -0
- package/cli/dist/commands/up.js +609 -0
- package/cli/dist/commands/upgrade.js +840 -0
- package/cli/dist/commands/version.js +10 -0
- package/cli/dist/components/Accessible.js +11 -0
- package/cli/dist/components/BaseTooltip.js +30 -0
- package/cli/dist/components/DetailPanel.js +33 -0
- package/cli/dist/components/FileTree.js +51 -0
- package/cli/dist/components/ResourceSelectInput.js +42 -0
- package/cli/dist/components/ResourceTable.js +35 -0
- package/cli/dist/components/ServiceIssues.js +13 -0
- package/cli/dist/components/TUIHeader.js +27 -0
- package/cli/dist/components/TabBar.js +27 -0
- package/cli/dist/components/Tooltip.js +13 -0
- package/cli/dist/components/index.js +11 -0
- package/cli/dist/components/ui-theme.js +120 -0
- package/cli/dist/config/platform-standards.js +182 -0
- package/cli/dist/frontend-frameworks/lit.js +64 -0
- package/cli/dist/frontend-frameworks/preact.js +62 -0
- package/cli/dist/frontend-frameworks/qwik.js +61 -0
- package/cli/dist/frontend-frameworks/react.js +69 -0
- package/cli/dist/frontend-frameworks/registry.js +83 -0
- package/cli/dist/frontend-frameworks/solid.js +62 -0
- package/cli/dist/frontend-frameworks/svelte.js +67 -0
- package/cli/dist/frontend-frameworks/tanstack-router.js +101 -0
- package/cli/dist/frontend-frameworks/types.js +1 -0
- package/cli/dist/frontend-frameworks/vanilla.js +59 -0
- package/cli/dist/frontend-frameworks/vue.js +72 -0
- package/cli/dist/generator/__tests__/golden-helpers.js +43 -0
- package/cli/dist/generator/extension-fetch.js +291 -0
- package/cli/dist/generator/resource-templates.js +133 -0
- package/cli/dist/generator/template-engine.js +801 -0
- package/cli/dist/index.js +10 -0
- package/cli/dist/mcp/server.js +101 -0
- package/cli/dist/mcp/tools.js +351 -0
- package/cli/dist/program.js +37 -0
- package/cli/dist/types/index.js +38 -0
- package/cli/dist/utils/agent-host.js +36 -0
- package/cli/dist/utils/atomic-write.js +36 -0
- package/cli/dist/utils/bun-floor.js +9 -0
- package/cli/dist/utils/bun-requirement.js +10 -0
- package/cli/dist/utils/cache.js +63 -0
- package/cli/dist/utils/cold-preflight.js +257 -0
- package/cli/dist/utils/command-helpers.js +57 -0
- package/cli/dist/utils/constants.js +160 -0
- package/cli/dist/utils/discovery-context.js +71 -0
- package/cli/dist/utils/discovery-paths.js +93 -0
- package/cli/dist/utils/docker.js +34 -0
- package/cli/dist/utils/doctor-crashloop.js +161 -0
- package/cli/dist/utils/doctor-fix.js +391 -0
- package/cli/dist/utils/doctor-host.js +66 -0
- package/cli/dist/utils/doctor-report.js +78 -0
- package/cli/dist/utils/doctor-runtime.js +880 -0
- package/cli/dist/utils/doctor-starlark.js +132 -0
- package/cli/dist/utils/doctor-wiring.js +698 -0
- package/cli/dist/utils/down-cleanup.js +125 -0
- package/cli/dist/utils/env-validator.js +266 -0
- package/cli/dist/utils/errors.js +175 -0
- package/cli/dist/utils/exec-async.js +31 -0
- package/cli/dist/utils/file-helpers.js +104 -0
- package/cli/dist/utils/formatting.js +165 -0
- package/cli/dist/utils/generated-paths.js +51 -0
- package/cli/dist/utils/help-command.js +11 -0
- package/cli/dist/utils/host-port-config.js +140 -0
- package/cli/dist/utils/host-port-plan.js +100 -0
- package/cli/dist/utils/json-output.js +29 -0
- package/cli/dist/utils/machine-output.js +33 -0
- package/cli/dist/utils/paths.js +43 -0
- package/cli/dist/utils/platform.js +58 -0
- package/cli/dist/utils/port-assignment.js +75 -0
- package/cli/dist/utils/port-conflict-fix.js +25 -0
- package/cli/dist/utils/port-fallback-notice.js +17 -0
- package/cli/dist/utils/port-listener-probe.js +20 -0
- package/cli/dist/utils/project-config-defaults.js +17 -0
- package/cli/dist/utils/project-features.js +91 -0
- package/cli/dist/utils/project-templates.js +32 -0
- package/cli/dist/utils/prompt.js +97 -0
- package/cli/dist/utils/resource-features.js +184 -0
- package/cli/dist/utils/resource-kind.js +9 -0
- package/cli/dist/utils/schema-version-gate.js +45 -0
- package/cli/dist/utils/search-status.js +12 -0
- package/cli/dist/utils/secret-redaction.js +73 -0
- package/cli/dist/utils/service-config-checks.js +189 -0
- package/cli/dist/utils/service-manifest.js +254 -0
- package/cli/dist/utils/service-runtime-state.js +66 -0
- package/cli/dist/utils/service-urls.js +112 -0
- package/cli/dist/utils/services.js +360 -0
- package/cli/dist/utils/shared-infra.js +45 -0
- package/cli/dist/utils/shared-platform-postgres.js +232 -0
- package/cli/dist/utils/single-flight.js +21 -0
- package/cli/dist/utils/smoke.js +401 -0
- package/cli/dist/utils/spinner.js +40 -0
- package/cli/dist/utils/stack-features.js +15 -0
- package/cli/dist/utils/stack-status.js +14 -0
- package/cli/dist/utils/startup-report.js +78 -0
- package/cli/dist/utils/status-message.js +21 -0
- package/cli/dist/utils/status-ports.js +33 -0
- package/cli/dist/utils/suggestions.js +63 -0
- package/cli/dist/utils/tar.js +46 -0
- package/cli/dist/utils/tdk-version.js +51 -0
- package/cli/dist/utils/terminal-layout.js +19 -0
- package/cli/dist/utils/tilt-events.js +194 -0
- package/cli/dist/utils/tilt-logs.js +61 -0
- package/cli/dist/utils/tilt-port-owner.js +63 -0
- package/cli/dist/utils/tilt-process.js +54 -0
- package/cli/dist/utils/tilt-resource-state.js +32 -0
- package/cli/dist/utils/tilt-startup.js +49 -0
- package/cli/dist/utils/tilt-unreachable-message.js +9 -0
- package/cli/dist/utils/tilt.js +104 -0
- package/cli/dist/utils/ui-keymap.js +129 -0
- package/cli/dist/utils/ui-service-state.js +34 -0
- package/cli/dist/utils/up-only.js +28 -0
- package/cli/dist/utils/up-readiness.js +118 -0
- package/cli/dist/utils/url-actions.js +103 -0
- package/cli/dist/utils/validation.js +62 -0
- package/cli/dist/utils/which.js +56 -0
- package/cli/dist/utils/windows-doctor.js +176 -0
- package/cli/dist-bundle/chunk-6EA4DGCY.js +2 -0
- package/cli/dist-bundle/chunk-BZ4H7MM4.js +3 -0
- package/cli/dist-bundle/chunk-CLCUIDBH.js +510 -0
- package/cli/dist-bundle/cli.js +2017 -0
- package/cli/dist-bundle/cold-preflight-SY26O2IG.js +2 -0
- package/cli/dist-bundle/devtools-ZUHXW33W.js +5 -0
- package/cli/dist-bundle/extension-fetch-J4FFH7TJ.js +2 -0
- package/cli/package.json +83 -0
- package/cli/shared-platform-engineering/docker-templates/bun-hoisted-symlink-fix.sh +25 -0
- package/cli/shared-platform-engineering/docker-templates/infisical-entrypoint.sh +466 -0
- package/cli/shared-platform-engineering/docker-templates/install-deps.sh +154 -0
- package/cli/shared-platform-engineering/docker-templates/prisma-bun-client-link-fix.sh +14 -0
- package/cli/shared-platform-engineering/docker-templates/prisma-normalize-client.sh +58 -0
- package/cli/templates/.tiltignore.hbs +72 -0
- package/cli/templates/TILT_RESOURCE_DEFAULTS.star.hbs +220 -0
- package/cli/templates/TILT_TECH_STACK.star.hbs +149 -0
- package/cli/templates/Tiltfile.hbs +381 -0
- package/cli/templates/spec.master.hbs +192 -0
- package/discovery/AGENTS.md +362 -0
- package/discovery/TILT_DISCOVERY.star +429 -0
- package/discovery/Tiltfile +58 -0
- package/discovery/config.star +265 -0
- package/discovery/constants.star +167 -0
- package/discovery/deterministic.star +213 -0
- package/discovery/discovery_daemon.star +193 -0
- package/discovery/discovery_orchestrator.star +492 -0
- package/discovery/filtering.star +7 -0
- package/discovery/identity-management-backend/service.yaml +26 -0
- package/discovery/identity-management-frontend/service.yaml +29 -0
- package/discovery/identity-sdk/service.yaml +9 -0
- package/discovery/incremental_discovery.star +215 -0
- package/discovery/indexing.star +9 -0
- package/discovery/json_manifest_scanner.star +57 -0
- package/discovery/libraries.star +48 -0
- package/discovery/loading.star +25 -0
- package/discovery/manifest/constants.star +106 -0
- package/discovery/manifest/loading.star +418 -0
- package/discovery/manifest/normalize.star +289 -0
- package/discovery/manifest/validation.star +110 -0
- package/discovery/normalization.star +13 -0
- package/discovery/registry.star +562 -0
- package/discovery/resource_snapshot.py +384 -0
- package/discovery/resource_snapshot.star +145 -0
- package/discovery/schemas.star +3 -0
- package/discovery/services/platform/cdc/debezium/nats-connector/service.yaml +9 -0
- package/discovery/services/platform/cdc/nats-http-bridge/service.yaml +9 -0
- package/discovery/services/platform/orchestrator/orchestrator-glue-backend/service.yaml +26 -0
- package/discovery/services/platform/synthetic-monitor/service.yaml +9 -0
- package/discovery/test_resource_snapshot.py +253 -0
- package/discovery/validation.star +80 -0
- package/discovery/versioning.star +3 -0
- package/engine/AGENTS.md +706 -0
- package/engine/README.md +31 -0
- package/engine/REFACTORING_MANIFEST_SYSTEM.md +974 -0
- package/engine/Tiltfile +86 -0
- package/engine/assets/docker/golden-layers.Dockerfile +204 -0
- package/engine/assets/docker/wake-gateway/Dockerfile +28 -0
- package/engine/assets/docker/wake-gateway/decide.test.ts +177 -0
- package/engine/assets/docker/wake-gateway/decide.ts +135 -0
- package/engine/assets/docker/wake-gateway/server.ts +363 -0
- package/engine/assets/scripts/cleanup-completed-migrator-images.sh +39 -0
- package/engine/assets/scripts/cleanup-tilt-images.sh +122 -0
- package/engine/assets/scripts/mac-m1-resource-monitor.sh +123 -0
- package/engine/config.star +5 -0
- package/engine/entrypoint.star +101 -0
- package/engine/lifecycle/orchestrator.star +263 -0
- package/engine/paths.star +719 -0
- package/engine/schemas/project-schema.json +147 -0
- package/engine/schemas/service-schema.json +537 -0
- package/engine/scripts/README.md +89 -0
- package/engine/scripts/build-and-publish-lib.sh +207 -0
- package/engine/scripts/check-lib-publish.sh +87 -0
- package/engine/scripts/debug-container.sh +265 -0
- package/engine/scripts/generate-manifest.sh +200 -0
- package/engine/spec.master +702 -0
- package/engine/spec.master.example +341 -0
- package/engine/topologies/README.md +33 -0
- package/engine/topologies/platform/docker/AGENTS.md +59 -0
- package/engine/topologies/platform/docker/auth/auth.star +207 -0
- package/engine/topologies/platform/docker/build/frontend_build_plan.star +65 -0
- package/engine/topologies/platform/docker/build/golden_image.star +37 -0
- package/engine/topologies/platform/docker/build/golden_image_build.star +144 -0
- package/engine/topologies/platform/docker/build/golden_image_constants.star +100 -0
- package/engine/topologies/platform/docker/build/golden_image_dockerfile.star +263 -0
- package/engine/topologies/platform/docker/compose/compose.star +637 -0
- package/engine/topologies/platform/docker/compose/compose_helpers.star +54 -0
- package/engine/topologies/platform/docker/compose/traefik_standalone.star +171 -0
- package/engine/topologies/platform/docker/config/bunignore.star +144 -0
- package/engine/topologies/platform/docker/config/dockerignore.star +152 -0
- package/engine/topologies/platform/docker/config/healthcheck.star +58 -0
- package/engine/topologies/platform/docker/constants.star +211 -0
- package/engine/topologies/platform/docker/dockerfile/dockerfile.star +56 -0
- package/engine/topologies/platform/docker/dockerfile/language_dockerfile.star +264 -0
- package/engine/topologies/platform/docker/generators/golden_docker_generator_v2.star +76 -0
- package/engine/topologies/platform/docker/index.star +40 -0
- package/engine/topologies/platform/docker/layers/bun_helpers.star +25 -0
- package/engine/topologies/platform/docker/layers/infisical/index.star +42 -0
- package/engine/topologies/platform/docker/layers/infisical/infisical_docker.star +264 -0
- package/engine/topologies/platform/docker/layers/l1_base_layers.star +89 -0
- package/engine/topologies/platform/docker/layers/l2_dependency_layers.star +147 -0
- package/engine/topologies/platform/docker/layers/l3_builder_layers.star +229 -0
- package/engine/topologies/platform/docker/layers/l4_runtime_layers.star +282 -0
- package/engine/topologies/platform/docker/layers/prisma/constants.star +138 -0
- package/engine/topologies/platform/docker/layers/prisma/db_readiness.star +98 -0
- package/engine/topologies/platform/docker/layers/prisma/filesystem_setup.star +131 -0
- package/engine/topologies/platform/docker/layers/prisma/migrate_script.star +100 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_build.star +128 -0
- package/engine/topologies/platform/docker/layers/prisma/prisma_runtime.star +205 -0
- package/engine/topologies/platform/docker/layers/prisma/secret_resolution.star +121 -0
- package/engine/topologies/platform/docker/networking/api_path_constants.star +206 -0
- package/engine/topologies/platform/docker/networking/sablier_container_cycle.star +31 -0
- package/engine/topologies/platform/docker/networking/traefik.star +266 -0
- package/engine/topologies/platform/docker/networking/traefik_constants.star +148 -0
- package/engine/topologies/platform/docker/networking/traefik_helpers.star +162 -0
- package/engine/topologies/platform/docker/networking/traefik_static_routes.star +165 -0
- package/engine/topologies/platform/docker/secrets/env_secrets.star +74 -0
- package/engine/topologies/platform/docker/secrets/infisical.star +109 -0
- package/engine/topologies/platform/net/AGENTS.md +64 -0
- package/engine/topologies/platform/net/proxy.star +6 -0
- package/engine/topologies/platform/registries/local.star +6 -0
- package/engine/topologies/platform/registries/verdaccio_loader.star +20 -0
- package/engine/topologies/platform/security/AGENTS.md +49 -0
- package/engine/topologies/platform/security/secrets.star +241 -0
- package/engine/topologies/platform/state/AGENTS.md +64 -0
- package/engine/topologies/platform/state/relational.star +6 -0
- package/engine/topologies/tilt/common/AGENTS.md +59 -0
- package/engine/topologies/tilt/common/utils.star +409 -0
- package/engine/topologies/tilt/common/utils_debug.star +71 -0
- package/engine/topologies/tilt/common/utils_deterministic.star +170 -0
- package/engine/topologies/tilt/common/utils_docker_networks.star +54 -0
- package/engine/topologies/tilt/common/utils_env.star +92 -0
- package/engine/topologies/tilt/common/utils_output.star +99 -0
- package/engine/topologies/tilt/config/AGENTS.md +68 -0
- package/engine/topologies/tilt/config/defaults.star +5 -0
- package/engine/topologies/tilt/config/feature_flags.star +12 -0
- package/engine/topologies/tilt/config/global.star +57 -0
- package/engine/topologies/tilt/config/profiles.star +398 -0
- package/engine/topologies/tilt/generators/agents_md.star +64 -0
- package/engine/topologies/tilt/generators/api_gateway.star +147 -0
- package/engine/topologies/tilt/generators/index.star +126 -0
- package/engine/topologies/tilt/generators/infisical/README.md +424 -0
- package/engine/topologies/tilt/generators/infisical/examples.star +314 -0
- package/engine/topologies/tilt/generators/infisical/index.star +59 -0
- package/engine/topologies/tilt/generators/infisical/machine_identity.star +422 -0
- package/engine/topologies/tilt/generators/infisical/organization.star +536 -0
- package/engine/topologies/tilt/generators/infisical/path_manager.star +478 -0
- package/engine/topologies/tilt/generators/infisical/secrets_generator.star +422 -0
- package/engine/topologies/tilt/generators/nginx_conf.star +145 -0
- package/engine/topologies/tilt/generators/npmrc.star +132 -0
- package/engine/topologies/tilt/generators/tsconfig.star +25 -0
- package/engine/topologies/tilt/generators/typescript/backend_library_tsconfig.star +73 -0
- package/engine/topologies/tilt/generators/typescript/backend_tsconfig.star +137 -0
- package/engine/topologies/tilt/generators/typescript/common.star +9 -0
- package/engine/topologies/tilt/generators/typescript/frontend_library_tsconfig.star +78 -0
- package/engine/topologies/tilt/generators/typescript/frontend_tsconfig.star +140 -0
- package/engine/topologies/tilt/generators/typescript/include.star +25 -0
- package/engine/topologies/tilt/generators/typescript/playwright_config.star +42 -0
- package/engine/topologies/tilt/generators/typescript/prisma_config.star +51 -0
- package/engine/topologies/tilt/generators/validators.star +868 -0
- package/engine/topologies/tilt/generators/vite/backend.star +80 -0
- package/engine/topologies/tilt/generators/vite/frameworks/lit.star +92 -0
- package/engine/topologies/tilt/generators/vite/frameworks/preact.star +94 -0
- package/engine/topologies/tilt/generators/vite/frameworks/qwik.star +94 -0
- package/engine/topologies/tilt/generators/vite/frameworks/react.star +128 -0
- package/engine/topologies/tilt/generators/vite/frameworks/solid.star +94 -0
- package/engine/topologies/tilt/generators/vite/frameworks/svelte.star +94 -0
- package/engine/topologies/tilt/generators/vite/frameworks/vanilla.star +92 -0
- package/engine/topologies/tilt/generators/vite/frameworks/vue.star +94 -0
- package/engine/topologies/tilt/generators/vite/frontend.star +153 -0
- package/engine/topologies/tilt/generators/vite/generators.star +45 -0
- package/engine/topologies/tilt/generators/vite/helpers.star +256 -0
- package/engine/topologies/tilt/generators/vite/library.star +67 -0
- package/engine/topologies/tilt/generators/vite/sdk.star +75 -0
- package/engine/topologies/tilt/generators/vite/templates.star +460 -0
- package/engine/topologies/tilt/generators/vite_config.star +24 -0
- package/engine/topologies/tilt/manifest/AGENTS.md +61 -0
- package/engine/topologies/tilt/manifest/README.md +679 -0
- package/engine/topologies/tilt/manifest/__init__.star +220 -0
- package/engine/topologies/tilt/manifest/constants.star +262 -0
- package/engine/topologies/tilt/manifest/errors.star +268 -0
- package/engine/topologies/tilt/manifest/integration.star +348 -0
- package/engine/topologies/tilt/manifest/json_to_yaml.py +61 -0
- package/engine/topologies/tilt/manifest/loader.star +239 -0
- package/engine/topologies/tilt/manifest/mapper.star +229 -0
- package/engine/topologies/tilt/manifest/parser.star +490 -0
- package/engine/topologies/tilt/manifest/schema.star +502 -0
- package/engine/topologies/tilt/manifest/tests/test_integration.star +278 -0
- package/engine/topologies/tilt/manifest/tests/test_loader_parser.star +475 -0
- package/engine/topologies/tilt/manifest/tests/test_manifest.star +319 -0
- package/engine/topologies/tilt/manifest/tests/test_validator.star +472 -0
- package/engine/topologies/tilt/manifest/validator.star +744 -0
- package/engine/topologies/tilt/manifest/yaml_to_json.py +20 -0
- package/engine/topologies/tilt/resources/AGENTS.md +71 -0
- package/engine/topologies/tilt/resources/build_concurrency.star +56 -0
- package/engine/topologies/tilt/resources/conditions.star +5 -0
- package/engine/topologies/tilt/resources/databases.star +246 -0
- package/engine/topologies/tilt/resources/declaration.star +5 -0
- package/engine/topologies/tilt/resources/deps.star +5 -0
- package/engine/topologies/tilt/resources/infra-loader.star +504 -0
- package/engine/topologies/tilt/resources/libs.star +32 -0
- package/engine/topologies/tilt/resources/libs_discovery.star +104 -0
- package/engine/topologies/tilt/resources/libs_paths.star +81 -0
- package/engine/topologies/tilt/resources/libs_resource_definition.star +153 -0
- package/engine/topologies/tilt/resources/libs_setup.star +166 -0
- package/engine/topologies/tilt/resources/libs_tsconfig.star +39 -0
- package/engine/topologies/tilt/resources/orchestrator/apply.star +79 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +864 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_manifest_orchestration.star +90 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_migrator_orchestration.star +150 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_resource_validation.star +38 -0
- package/engine/topologies/tilt/resources/orchestrator/apply_runtime_flags.star +46 -0
- package/engine/topologies/tilt/resources/orchestrator/builders/typescript.star +193 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/AGENTS.md +75 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/index.star +23 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/dependencies/resolver.star +136 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/env.star +219 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/frontend.star +172 -0
- package/engine/topologies/tilt/resources/orchestrator/generators/manifest_resource.star +577 -0
- package/engine/topologies/tilt/resources/orchestrator/helpers.star +35 -0
- package/engine/topologies/tilt/resources/orchestrator.star +56 -0
- package/engine/topologies/tilt/resources/ordering.star +5 -0
- package/engine/topologies/tilt/resources/shared-platform-postgres.star +30 -0
- package/engine/topologies/tilt/resources/triggers.star +5 -0
- package/engine/topologies/tilt/resources/watchers.star +304 -0
- package/engine/where-things-live.star +719 -0
- package/examples/tdk-example/LICENSE +21 -0
- package/examples/tdk-example/README.md +23 -0
- package/examples/tdk-example/TILT_SERVICE_DEFAULTS.star +42 -0
- package/examples/tdk-example/TILT_TECH_STACK.star +67 -0
- package/examples/tdk-example/Tiltfile +25 -0
- package/examples/tdk-example/services/platform/messaging/docker-compose.yml +26 -0
- package/examples/tdk-example/services/shop/orders-api/package.json +20 -0
- package/examples/tdk-example/services/shop/orders-api/service.json +14 -0
- package/examples/tdk-example/services/shop/orders-api/src/index.ts +81 -0
- package/examples/tdk-example/services/shop/orders-app/index.html +12 -0
- package/examples/tdk-example/services/shop/orders-app/package.json +23 -0
- package/examples/tdk-example/services/shop/orders-app/public/.gitkeep +0 -0
- package/examples/tdk-example/services/shop/orders-app/service.json +9 -0
- package/examples/tdk-example/services/shop/orders-app/src/main.tsx +9 -0
- package/examples/tdk-example/services/shop/orders-app/src/orders.tsx +67 -0
- package/examples/tdk-example/services/shop/orders-app/src/style.css +15 -0
- package/examples/tdk-example/services/shop/orders-worker/package.json +18 -0
- package/examples/tdk-example/services/shop/orders-worker/service.json +13 -0
- package/examples/tdk-example/services/shop/orders-worker/src/index.ts +33 -0
- package/ext/Tiltfile +66 -0
- package/ext/ide-components/README.md +221 -0
- package/ext/ide-components/code_viewer/server.py +208 -0
- package/ext/ide-components/config_inspector/server.py +1052 -0
- package/ext/ide-components/file_browser/server.py +287 -0
- package/ext/ide-components/shared/config_service.py +471 -0
- package/ext/ide-components/shared/file_utils.py +300 -0
- package/ext/ide-components/shared/http_utils.py +234 -0
- package/ext/ide-components/shared/static/styles.css +1334 -0
- package/ext/ide-components/shared/syntax_highlighter.py +142 -0
- package/ext/ide-components/shared/template_engine.py +125 -0
- package/ext/ide-components/shared/templates/base.html +121 -0
- package/ext/ide-components/shared/test_config_service.py +328 -0
- package/ext/ide-components/shared/tilt_integration.py +160 -0
- package/ext/ui-enhancements/cron-status-server.sh +51 -0
- package/ext/ui-enhancements/cron-status-tracker.sh +148 -0
- package/ext/ui-enhancements/extension.yaml +36 -0
- package/ext/ui-enhancements/tiltfile.py +101 -0
- package/ext/ui-enhancements/ui/cron-jobs-tab.css +396 -0
- package/ext/ui-enhancements/ui/help-panel.css +279 -0
- package/ext/ui-enhancements/ui/icons.css +125 -0
- package/ext/ui-enhancements/ui/tooltips.css +114 -0
- package/package.json +94 -4
- package/shared-platform-engineering/docker-templates/bun-hoisted-symlink-fix.sh +25 -0
- package/shared-platform-engineering/docker-templates/infisical-entrypoint.sh +466 -0
- package/shared-platform-engineering/docker-templates/install-deps.sh +154 -0
- package/shared-platform-engineering/docker-templates/prisma-bun-client-link-fix.sh +14 -0
- package/shared-platform-engineering/docker-templates/prisma-normalize-client.sh +58 -0
- package/specs/specs/TILT_SERVICE_DEFAULTS.star +207 -0
- package/specs/specs/TILT_TECH_STACK.star +161 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Copyright (c) 2026 Flisk contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# === INLINED CONSTANTS for pure extension loading ===
|
|
4
|
+
WEB_FRAMEWORK = "hono"
|
|
5
|
+
RUNTIME_CONFIG = {"bun": {"image_base": "oven/bun:1.3.11-alpine", "package_manager": "bun", "lockfile": "bun.lock", "backend_start_command": "bun run start", "frontend_start_command": "bun run dev"}, "node": {"image_base": "node:22-alpine", "package_manager": "npm", "lockfile": "package-lock.json", "backend_start_command": "node dist/index.js"}}
|
|
6
|
+
OUTPUT = struct(AUTOGENERATED_FOLDER = ".autogenerated")
|
|
7
|
+
# === END INLINED CONSTANTS ===
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
L3 Builder Layers - Compilation and Build Stages
|
|
12
|
+
|
|
13
|
+
Handles the build stages for different application types:
|
|
14
|
+
- l3_backend_compiler: TypeScript backend compilation
|
|
15
|
+
- l3_frontend_builder: Frontend application building
|
|
16
|
+
- l3_migration_engine: Prisma migration preparation
|
|
17
|
+
- l3_production_purger: Production dependency stripping
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
load('./l1_base_layers.star', 'BUN_BASE')
|
|
21
|
+
load('./l2_dependency_layers.star', 'GOLDEN_L2_IMAGE', 'normalize_res_path')
|
|
22
|
+
load('../../../../../discovery/config.star', 'GLOBAL_CONFIG')
|
|
23
|
+
load('../../../tilt/manifest/constants.star', 'AUTOGENERATED_CONFIG_PATHS')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
load('./prisma/prisma_build.star',
|
|
28
|
+
'prisma_copy_instructions',
|
|
29
|
+
'prisma_generate_instructions',
|
|
30
|
+
'prisma_normalize_output',
|
|
31
|
+
'L3_generate_migration_engine',
|
|
32
|
+
)
|
|
33
|
+
# Infisical is opt-in: use_infisical defaults to False and nothing in the free engine passes True, so the generator behind this
|
|
34
|
+
# (tilt/generators/infisical/secrets_generator.star) is not on the default path. It is an older contract with fixed secret names and
|
|
35
|
+
# ports. Do not wire `secrets.required` through it; the default provider is platform/docker/secrets/env_secrets.star.
|
|
36
|
+
load('./infisical/infisical_docker.star', 'InfisicalDocker')
|
|
37
|
+
|
|
38
|
+
# Load project name for dynamic golden image naming
|
|
39
|
+
# Use TDK_PROJECT_ROOT env var set by Tilt, fallback to current directory
|
|
40
|
+
def _load_golden_prefix():
|
|
41
|
+
project_root = os.environ.get('TDK_PROJECT_ROOT', '')
|
|
42
|
+
project_json_path = '.tdk/project.json'
|
|
43
|
+
if project_root:
|
|
44
|
+
project_json_path = project_root + '/' + project_json_path
|
|
45
|
+
|
|
46
|
+
if os.path.exists(project_json_path):
|
|
47
|
+
_project_json = read_json(project_json_path)
|
|
48
|
+
return _project_json.get('project', {}).get('name', 'tdk-project')
|
|
49
|
+
return 'tdk-project'
|
|
50
|
+
|
|
51
|
+
_GOLDEN_PREFIX = _load_golden_prefix()
|
|
52
|
+
|
|
53
|
+
_docker_cfg = GLOBAL_CONFIG['docker']
|
|
54
|
+
GOLDEN_L3_BACKEND_IMAGE = _docker_cfg.get('golden_l3_backend_image', _GOLDEN_PREFIX + '-l3-backend:latest')
|
|
55
|
+
GOLDEN_L3_FRONTEND_IMAGE = _docker_cfg.get('golden_l3_frontend_image', _GOLDEN_PREFIX + '-l3-frontend:latest')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def L3_generate_backend_compiler(res_path, build_cmd = RUNTIME_CONFIG["bun"]["backend_start_command"], use_prisma = True, use_shared_libs = True, use_infisical = False, use_golden = True, has_prisma_config = False):
|
|
59
|
+
"""
|
|
60
|
+
Generate the backend compiler layer for TypeScript services.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
res_path: Resource path (service directory)
|
|
64
|
+
build_cmd: Build command to run (default: from RUNTIME_CONFIG)
|
|
65
|
+
use_prisma: Include Prisma setup (default: True)
|
|
66
|
+
use_shared_libs: Include shared library copies (default: True)
|
|
67
|
+
use_infisical: Include Infisical CLI installation (default: True)
|
|
68
|
+
use_golden: Whether to use golden L3-backend image (default: True)
|
|
69
|
+
has_prisma_config: Whether the service has Prisma config (default: False)
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
Dockerfile content string for the l3_backend_build stage
|
|
73
|
+
"""
|
|
74
|
+
# Normalize res_path for Docker COPY (must be relative to build context)
|
|
75
|
+
res_path_rel = normalize_res_path(res_path)
|
|
76
|
+
|
|
77
|
+
base_image = GOLDEN_L3_BACKEND_IMAGE if use_golden else BUN_BASE
|
|
78
|
+
prisma_copy = prisma_copy_instructions(res_path) if use_prisma else ""
|
|
79
|
+
prisma_generate = prisma_generate_instructions() if use_prisma else ""
|
|
80
|
+
prisma_compat = prisma_normalize_output() if use_prisma else ""
|
|
81
|
+
parts = [
|
|
82
|
+
"# ---- L3: backend_compiler ----\n",
|
|
83
|
+
"FROM " + base_image + " AS l3_backend_build\n",
|
|
84
|
+
"WORKDIR /app/" + res_path + "\n",
|
|
85
|
+
"# Build argument to skip Infisical setup (for local dev / fast builds)\n",
|
|
86
|
+
"ARG SKIP_INFISICAL_SETUP=0\n",
|
|
87
|
+
"# Reuse resolved dependencies from l2_deps_manifest to avoid reinstalling in L3\n",
|
|
88
|
+
"COPY --link --from=l2_deps_manifest /app/" + res_path + "/node_modules ./node_modules\n",
|
|
89
|
+
"# Bun isolated linker symlinks may resolve through /app/node_modules/.bun\n",
|
|
90
|
+
"COPY --link --from=l2_deps_manifest /app/node_modules/.bun /app/node_modules/.bun\n",
|
|
91
|
+
"# Copy manifest files for dependency installation (in case L2 is stale)\n",
|
|
92
|
+
"COPY " + res_path_rel + "/package.json ./package.json\n",
|
|
93
|
+
"COPY " + res_path_rel + "/" + AUTOGENERATED_CONFIG_PATHS['bunfig_docker'] + " ./bunfig.toml\n",
|
|
94
|
+
"COPY " + res_path_rel + "/" + AUTOGENERATED_CONFIG_PATHS['npmrc_docker'] + " ./.npmrc\n",
|
|
95
|
+
"COPY " + res_path_rel + "/" + OUTPUT.AUTOGENERATED_FOLDER + "/tsconfig.docker.autogenerated.json ./tsconfig.json\n",
|
|
96
|
+
"COPY " + res_path_rel + "/" + OUTPUT.AUTOGENERATED_FOLDER + "/tsconfig.autogenerated.json ./" + OUTPUT.AUTOGENERATED_FOLDER + "/tsconfig.autogenerated.json\n",
|
|
97
|
+
"COPY " + res_path_rel + "/" + OUTPUT.AUTOGENERATED_FOLDER + "/*.ts ./" + OUTPUT.AUTOGENERATED_FOLDER + "/\n",
|
|
98
|
+
"COPY " + res_path_rel + "/src ./src\n",
|
|
99
|
+
prisma_copy,
|
|
100
|
+
prisma_generate,
|
|
101
|
+
prisma_compat,
|
|
102
|
+
]
|
|
103
|
+
# shared libs (@{npm_scope}/*) are resolved from Verdaccio by l2_deps_manifest
|
|
104
|
+
# and already present in node_modules — no COPY of shared-* source dirs needed.
|
|
105
|
+
# Use InfisicalDocker generator for CLI setup (if not using golden image)
|
|
106
|
+
if use_infisical and not use_golden:
|
|
107
|
+
parts.append(InfisicalDocker.builder_setup(
|
|
108
|
+
use_infisical=use_infisical,
|
|
109
|
+
use_golden=use_golden,
|
|
110
|
+
))
|
|
111
|
+
parts.append("ENV NODE_ENV=production\n")
|
|
112
|
+
parts.append("RUN " + build_cmd + "\n")
|
|
113
|
+
parts.append("# Fix " + WEB_FRAMEWORK + "/cors subpath import for Bun runtime compatibility\n")
|
|
114
|
+
parts.append("RUN find ./dist -type f -name \"*.js\" -exec sed -i \"s|from '" + WEB_FRAMEWORK + "/cors'|from '../node_modules/" + WEB_FRAMEWORK + "/dist/middleware/cors/index.js'|g\" {} + || true\n")
|
|
115
|
+
return "".join(parts)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def L3_generate_frontend_builder(res_path, build_cmd = RUNTIME_CONFIG["bun"]["backend_start_command"], use_infisical = False, use_shared_libs = True, use_golden = True):
|
|
119
|
+
"""
|
|
120
|
+
Generate the frontend builder layer for Vue/React applications.
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
res_path: Resource path (service directory)
|
|
124
|
+
build_cmd: Build command to run (default: from RUNTIME_CONFIG)
|
|
125
|
+
use_infisical: Include Infisical CLI installation (default: False)
|
|
126
|
+
use_shared_libs: Include shared library copies (default: True)
|
|
127
|
+
use_golden: Whether to use golden L3-frontend image (default: True)
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Dockerfile content string for the l3_frontend_build stage
|
|
131
|
+
"""
|
|
132
|
+
# Normalize res_path for Docker COPY (must be relative to build context)
|
|
133
|
+
res_path_rel = normalize_res_path(res_path)
|
|
134
|
+
|
|
135
|
+
# Use golden L3-frontend image if enabled (no Prisma)
|
|
136
|
+
base_image = GOLDEN_L3_FRONTEND_IMAGE if use_golden else BUN_BASE
|
|
137
|
+
|
|
138
|
+
parts = [
|
|
139
|
+
"# ---- L3: frontend_builder ----\n",
|
|
140
|
+
"FROM " + base_image + " AS l3_frontend_build\n",
|
|
141
|
+
"WORKDIR /app/" + res_path + "\n",
|
|
142
|
+
"# Build argument to skip Infisical setup (for local dev / fast builds)\n",
|
|
143
|
+
"ARG SKIP_INFISICAL_SETUP=1\n",
|
|
144
|
+
"# Reuse resolved dependencies from l2_deps_manifest to avoid reinstalling in L3\n",
|
|
145
|
+
"COPY --link --from=l2_deps_manifest /app/" + res_path + "/node_modules ./node_modules\n",
|
|
146
|
+
# Bun isolated linker symlinks may resolve through /app/node_modules/.bun.
|
|
147
|
+
"COPY --link --from=l2_deps_manifest /app/node_modules/.bun /app/node_modules/.bun\n",
|
|
148
|
+
"# Copy manifest files required by the build\n",
|
|
149
|
+
"COPY " + res_path_rel + "/package.json ./package.json\n",
|
|
150
|
+
"COPY " + res_path_rel + "/" + AUTOGENERATED_CONFIG_PATHS['bunfig_docker'] + " ./bunfig.toml\n",
|
|
151
|
+
"COPY " + res_path_rel + "/" + OUTPUT.AUTOGENERATED_FOLDER + "/tsconfig.docker.autogenerated.json ./tsconfig.json\n",
|
|
152
|
+
"COPY " + res_path_rel + "/" + OUTPUT.AUTOGENERATED_FOLDER + "/tsconfig.autogenerated.json ./" + OUTPUT.AUTOGENERATED_FOLDER + "/tsconfig.autogenerated.json\n",
|
|
153
|
+
# Copy ALL TypeScript files from autogenerated directory (env.ts, api-client.ts, vite configs, etc.)
|
|
154
|
+
"COPY " + res_path_rel + "/" + OUTPUT.AUTOGENERATED_FOLDER + "/*.ts ./" + OUTPUT.AUTOGENERATED_FOLDER + "/\n",
|
|
155
|
+
"COPY " + res_path_rel + "/src ./src\n",
|
|
156
|
+
"COPY " + res_path_rel + "/public ./public\n",
|
|
157
|
+
"COPY " + res_path_rel + "/index.html ./index.html\n",
|
|
158
|
+
]
|
|
159
|
+
# shared libs (@{npm_scope}/*) are resolved from Verdaccio by l2_deps_manifest
|
|
160
|
+
# and already present in node_modules — no COPY of shared-* source dirs needed.
|
|
161
|
+
# Use InfisicalDocker generator for CLI setup (if not using golden image)
|
|
162
|
+
if use_infisical and not use_golden:
|
|
163
|
+
parts.append(InfisicalDocker.builder_setup(
|
|
164
|
+
use_infisical=use_infisical,
|
|
165
|
+
use_golden=use_golden,
|
|
166
|
+
))
|
|
167
|
+
parts.append("ENV NODE_ENV=production\n")
|
|
168
|
+
# Point Vite at the generated build config. Without --config, `vite build`
|
|
169
|
+
# looks for vite.config.ts in the service root (which is never generated
|
|
170
|
+
# there) and silently falls back to defaults - losing `base`, so the built
|
|
171
|
+
# index.html references /assets/* instead of /<service>/assets/*.
|
|
172
|
+
# Args passed after the script name are appended to the end of the script
|
|
173
|
+
# command, so they reach `vite build` while any preceding steps in the
|
|
174
|
+
# script (e.g. `tsc --noEmit &&`) still run.
|
|
175
|
+
# A build script that already names a config (the CLI scaffold does) keeps its own; a second --config is not added.
|
|
176
|
+
config_flag = "" if "--config" in build_cmd else " --config " + AUTOGENERATED_CONFIG_PATHS['vite_build']
|
|
177
|
+
parts.append(
|
|
178
|
+
"RUN " + build_cmd + config_flag + "\n"
|
|
179
|
+
)
|
|
180
|
+
return "".join(parts)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# L3_generate_migration_engine is now loaded from prisma/prisma_build.star
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def L3_generate_production_purger(res_path, use_golden = True):
|
|
187
|
+
"""
|
|
188
|
+
Generate the production purger layer that removes development dependencies.
|
|
189
|
+
|
|
190
|
+
Implements Option 2: Reduce node_modules size by:
|
|
191
|
+
1. Installing only production dependencies (--production flag)
|
|
192
|
+
2. Removing unnecessary files (.md, .ts, .map, test files, etc.)
|
|
193
|
+
3. Pruning package.json files from node_modules
|
|
194
|
+
4. Removing optional dependencies not needed at runtime
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
res_path: Resource path (service directory)
|
|
198
|
+
use_golden: Whether to use golden L2 image (default: True)
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
Dockerfile content string for the l3_production_purger stage
|
|
202
|
+
"""
|
|
203
|
+
# Normalize res_path for Docker COPY (must be relative to build context)
|
|
204
|
+
res_path_rel = normalize_res_path(res_path)
|
|
205
|
+
|
|
206
|
+
# Use golden L2 image if enabled (Bun + system deps pre-installed)
|
|
207
|
+
base_image = GOLDEN_L2_IMAGE if use_golden else BUN_BASE
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
"# ---- L3: production_purger ----\n"
|
|
211
|
+
+ "FROM " + base_image + " AS l3_production_purger\n"
|
|
212
|
+
+ "WORKDIR /app/" + res_path + "\n"
|
|
213
|
+
+ "COPY " + res_path_rel + "/package.json ./package.json\n"
|
|
214
|
+
+ "COPY " + res_path_rel + "/" + AUTOGENERATED_CONFIG_PATHS['bunfig_docker'] + " ./bunfig.toml\n"
|
|
215
|
+
+ "COPY " + res_path_rel + "/" + AUTOGENERATED_CONFIG_PATHS['npmrc_docker'] + " ./.npmrc\n"
|
|
216
|
+
# NOTE: no COPY --from=l2_deps_manifest /cache/bun here - a cache mount's
|
|
217
|
+
# contents are never committed to a stage's filesystem, so COPY --from can't
|
|
218
|
+
# read them (BuildKit fails with "snapshot ... does not exist" on finalize).
|
|
219
|
+
# The --mount=type=cache below already shares the same warmed /cache/bun
|
|
220
|
+
# cache across stages via its target+sharing=shared, with no COPY needed.
|
|
221
|
+
# sharing=shared allows parallel builds without lock contention (Bun cache is atomic)
|
|
222
|
+
+ "RUN --mount=type=cache,target=/cache/bun,sharing=shared bun install --production --cache-dir=/cache/bun\n"
|
|
223
|
+
+ "# Option 2: Aggressive node_modules pruning to reduce size\n"
|
|
224
|
+
+ "# NOTE: Keep .d.ts files - they are needed for Bun module resolution with subpath exports\n"
|
|
225
|
+
+ "RUN find node_modules -type f \\( -name '*.md' -o -name '*.ts' ! -name '*.d.ts' -o -name '*.map' -o -name '*.test.js' -o -name '*.spec.js' -o -name 'README*' -o -name 'CHANGELOG*' -o -name 'LICENSE*' \\) -delete\n"
|
|
226
|
+
+ "RUN find node_modules -type d \\( -name '.bin' -o -name 'test' -o -name 'tests' -o -name '__tests__' -o -name 'spec' -o -name 'specs' -o -name '.github' -o -name 'docs' -o -name 'examples' \\) -exec rm -rf {} + 2>/dev/null || true\n"
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
GLOBAL_CONFIG = {}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# Copyright (c) 2026 Flisk contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# === INLINED CONSTANTS for pure extension loading ===
|
|
4
|
+
BASE_PORT_FRONTEND = 3000
|
|
5
|
+
BASE_PORT_BACKEND = 4000
|
|
6
|
+
OUTPUT = struct(AUTOGENERATED_FOLDER = ".autogenerated")
|
|
7
|
+
# === END INLINED CONSTANTS ===
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
L4 Runtime Layers - Final Application Runtime Stages
|
|
12
|
+
|
|
13
|
+
Handles the final runtime stages for deployed applications:
|
|
14
|
+
- l4_backend_runtime: Backend service runtime with Bun
|
|
15
|
+
- l4_frontend_runtime: Frontend runtime with Nginx or Bun static
|
|
16
|
+
- l4_migrator_runtime: Database migration runner with Infisical integration
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
load('./l1_base_layers.star', 'BUN_BASE')
|
|
20
|
+
load('./l2_dependency_layers.star', 'normalize_res_path')
|
|
21
|
+
load('../../../../../discovery/config.star', 'GLOBAL_CONFIG')
|
|
22
|
+
load('../../../tilt/common/utils_debug.star', 'DEBUG_MODE')
|
|
23
|
+
load('../../../tilt/manifest/constants.star', 'AUTOGENERATED_CONFIG_PATHS')
|
|
24
|
+
load('./prisma/prisma_runtime.star',
|
|
25
|
+
'prisma_runtime_copy',
|
|
26
|
+
'prisma_cli_runtime_copy',
|
|
27
|
+
'prisma_bun_symlink_fix',
|
|
28
|
+
'prisma_config_copy',
|
|
29
|
+
'L4_generate_migrator_runtime',
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
load('./bun_helpers.star', 'bun_hoisted_packages_symlink_fix')
|
|
33
|
+
load('../config/healthcheck.star', 'DOCKER_HEALTHCHECK', 'dockerfile_healthcheck_flags')
|
|
34
|
+
# Infisical is opt-in: use_infisical defaults to False and nothing in the free engine passes True, so the generator behind this
|
|
35
|
+
# (tilt/generators/infisical/secrets_generator.star) is not on the default path. It is an older contract with fixed secret names and
|
|
36
|
+
# ports. Do not wire `secrets.required` through it; the default provider is platform/docker/secrets/env_secrets.star.
|
|
37
|
+
load('./infisical/infisical_docker.star', 'InfisicalDocker')
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Load project name for dynamic golden image naming
|
|
41
|
+
# Use TDK_PROJECT_ROOT env var set by Tilt, fallback to current directory
|
|
42
|
+
def _load_golden_prefix():
|
|
43
|
+
project_root = os.environ.get('TDK_PROJECT_ROOT', '')
|
|
44
|
+
project_json_path = '.tdk/project.json'
|
|
45
|
+
if project_root:
|
|
46
|
+
project_json_path = project_root + '/' + project_json_path
|
|
47
|
+
|
|
48
|
+
if os.path.exists(project_json_path):
|
|
49
|
+
_project_json = read_json(project_json_path)
|
|
50
|
+
return _project_json.get('project', {}).get('name', 'tdk-project')
|
|
51
|
+
return 'tdk-project'
|
|
52
|
+
|
|
53
|
+
_GOLDEN_PREFIX = _load_golden_prefix()
|
|
54
|
+
|
|
55
|
+
_docker_cfg = GLOBAL_CONFIG['docker']
|
|
56
|
+
GOLDEN_L4_BACKEND_IMAGE = _docker_cfg.get('golden_l4_backend_image', _GOLDEN_PREFIX + '-l4-backend:latest')
|
|
57
|
+
GOLDEN_L4_FRONTEND_IMAGE = _docker_cfg.get('golden_l4_frontend_image', _GOLDEN_PREFIX + '-l4-frontend:latest')
|
|
58
|
+
|
|
59
|
+
DEFAULT_BUN_START_COMMAND = 'bun run start'
|
|
60
|
+
|
|
61
|
+
_ENTRY_FILE_EXTENSIONS = ['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts', '.jsx', '.tsx']
|
|
62
|
+
_SHELL_CHARS = ['=', '&', '|', ';', '$', '`', '<', '>', '(', ')', '"', "'", '*', '\\']
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _is_entry_file(token):
|
|
66
|
+
if token.startswith('-'):
|
|
67
|
+
return False
|
|
68
|
+
for ch in _SHELL_CHARS:
|
|
69
|
+
if ch in token:
|
|
70
|
+
return False
|
|
71
|
+
for ext in _ENTRY_FILE_EXTENSIONS:
|
|
72
|
+
if token.endswith(ext):
|
|
73
|
+
return True
|
|
74
|
+
return False
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def start_command_from_script(start_script):
|
|
78
|
+
"""
|
|
79
|
+
`bun run start` starts a Bun wrapper that spawns a second Bun runtime for the
|
|
80
|
+
real server. When the start script only runs one entry file, run that file
|
|
81
|
+
directly so each container holds a single Bun process. Anything else keeps
|
|
82
|
+
`bun run start` so custom start scripts behave exactly as before.
|
|
83
|
+
"""
|
|
84
|
+
tokens = (start_script or '').split()
|
|
85
|
+
if len(tokens) == 3 and tokens[0] == 'bun' and tokens[1] == 'run' and _is_entry_file(tokens[2]):
|
|
86
|
+
return 'bun ' + tokens[2]
|
|
87
|
+
if len(tokens) == 2 and tokens[0] == 'bun' and _is_entry_file(tokens[1]):
|
|
88
|
+
return 'bun ' + tokens[1]
|
|
89
|
+
return DEFAULT_BUN_START_COMMAND
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def resolve_bun_start_command(res_path, cmd = DEFAULT_BUN_START_COMMAND):
|
|
93
|
+
"""Resolve the runtime command from the service's package.json `start` script."""
|
|
94
|
+
if cmd != DEFAULT_BUN_START_COMMAND:
|
|
95
|
+
return cmd
|
|
96
|
+
package_json_path = res_path + '/package.json'
|
|
97
|
+
if not res_path.startswith('/'):
|
|
98
|
+
package_json_path = os.environ.get('TDK_PROJECT_ROOT', '.') + '/' + package_json_path
|
|
99
|
+
if not os.path.exists(package_json_path):
|
|
100
|
+
return cmd
|
|
101
|
+
package_json = read_json(package_json_path, default = {}) or {}
|
|
102
|
+
scripts = package_json.get('scripts', {}) or {}
|
|
103
|
+
return start_command_from_script(scripts.get('start', ''))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _cmd_instruction(command):
|
|
107
|
+
return "CMD [" + ", ".join(["\"" + part + "\"" for part in command.split()]) + "]\n"
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _backend_healthcheck_instruction(port, manifest = None):
|
|
111
|
+
# Probe the service over HTTP, not the runtime binary: `bun --version` passes even when the server has crashed.
|
|
112
|
+
# Workers and bring-your-own services without healthCheckPath serve no HTTP, so they get no probe (HEALTHCHECK NONE).
|
|
113
|
+
if manifest and (manifest.get('appType') == 'worker' or (manifest.get('appType') == 'bring-your-own' and not manifest.get('healthCheckPath'))):
|
|
114
|
+
return "HEALTHCHECK NONE\n"
|
|
115
|
+
health_path = manifest.get('healthCheckPath', '/health') if manifest else '/health'
|
|
116
|
+
# The Dockerfile generator passes the manifest but not the port, so the service's own port wins over the 4000 default.
|
|
117
|
+
probe_port = manifest.get('port', port) if manifest else port
|
|
118
|
+
# fetch() is built into bun, so no extra package is needed in the image. Path is schema-limited to [a-z0-9/-].
|
|
119
|
+
probe = "fetch('http://127.0.0.1:" + str(probe_port) + health_path + "').then(r=>process.exit(r.ok?0:1),()=>process.exit(1))"
|
|
120
|
+
return "HEALTHCHECK " + dockerfile_healthcheck_flags() + " CMD bun -e \"" + probe + "\" || exit 1\n"
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def L4_generate_backend_runtime(res_path, port = BASE_PORT_BACKEND, cmd = 'bun run start', use_infisical = False, resource_name = 'service', use_golden = True, use_prisma = True, has_prisma_config = False, manifest = None):
|
|
124
|
+
"""
|
|
125
|
+
Generate the backend runtime layer for deployed services.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
res_path: Resource path (service directory)
|
|
129
|
+
port: Port to expose (default: BASE_PORT_BACKEND from master config)
|
|
130
|
+
cmd: Command to run (default: 'bun run start')
|
|
131
|
+
use_infisical: Enable Infisical secret management (default: True)
|
|
132
|
+
resource_name: Service name for logging and configuration (default: 'service')
|
|
133
|
+
use_golden: Whether to use golden L4-backend image (default: True)
|
|
134
|
+
use_prisma: Whether the service has the "prisma" feature enabled - gates copying
|
|
135
|
+
the .prisma/prisma dirs from the L3 build stage, which only exist there when
|
|
136
|
+
L3 itself ran prisma generate, plus the pinned Prisma CLI from the L3
|
|
137
|
+
migration stage that the entrypoint needs to run migrations (default: True)
|
|
138
|
+
has_prisma_config: Whether service has a generated prisma.config.ts to copy in
|
|
139
|
+
(default: False)
|
|
140
|
+
manifest: Service manifest dict for feature detection (default: None)
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
Dockerfile content string for the l4_backend_runtime stage
|
|
144
|
+
"""
|
|
145
|
+
# Normalize res_path for Docker COPY (must be relative to build context)
|
|
146
|
+
res_path_rel = normalize_res_path(res_path)
|
|
147
|
+
cmd = resolve_bun_start_command(res_path, cmd)
|
|
148
|
+
|
|
149
|
+
# Use golden L4-backend image if enabled (production-optimized backend runtime)
|
|
150
|
+
base_image = GOLDEN_L4_BACKEND_IMAGE if use_golden else BUN_BASE
|
|
151
|
+
|
|
152
|
+
parts = [
|
|
153
|
+
"# ---- L4: backend_runtime ----\n",
|
|
154
|
+
"FROM " + base_image + " AS l4_backend_runtime\n",
|
|
155
|
+
"WORKDIR /app/" + res_path + "\n",
|
|
156
|
+
"# Build argument to skip Infisical setup (for local dev / fast builds)\n",
|
|
157
|
+
"ARG SKIP_INFISICAL_SETUP=0\n",
|
|
158
|
+
"ENV NODE_ENV=production\n",
|
|
159
|
+
"COPY --from=l3_production_purger /app/" + res_path + "/node_modules ./node_modules\n",
|
|
160
|
+
prisma_runtime_copy(res_path) if use_prisma else "",
|
|
161
|
+
prisma_cli_runtime_copy(res_path) if use_prisma else "",
|
|
162
|
+
"COPY --from=l3_backend_build /app/" + res_path + "/dist ./dist\n",
|
|
163
|
+
"COPY " + res_path_rel + "/package.json ./package.json\n",
|
|
164
|
+
prisma_bun_symlink_fix() if use_prisma else "",
|
|
165
|
+
bun_hoisted_packages_symlink_fix(),
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
# Check for special tooling requirements from manifest features
|
|
169
|
+
# Services requiring Hugo (or other tools) should specify in manifest features array
|
|
170
|
+
manifest_features = manifest.get('featuresEnabled', []) if manifest else []
|
|
171
|
+
if "hugo" in manifest_features:
|
|
172
|
+
parts.append("USER root\n")
|
|
173
|
+
parts.append("RUN apk add --no-cache hugo\n")
|
|
174
|
+
parts.append("USER bun\n")
|
|
175
|
+
|
|
176
|
+
# A files-durability agent keeps its checkpoints in /var/lib/tdk-agent, a named volume. Docker seeds a new volume with the
|
|
177
|
+
# image directory's owner, so create the directory owned by bun, or the agent cannot write its first checkpoint (EACCES).
|
|
178
|
+
agent_cfg = manifest.get('agent') if manifest else None
|
|
179
|
+
if type(agent_cfg) == 'dict' and agent_cfg.get('durability', 'files') == 'files':
|
|
180
|
+
parts.append("USER root\n")
|
|
181
|
+
parts.append("RUN mkdir -p /var/lib/tdk-agent && chown bun:bun /var/lib/tdk-agent\n")
|
|
182
|
+
parts.append("USER bun\n")
|
|
183
|
+
|
|
184
|
+
if has_prisma_config:
|
|
185
|
+
# Prisma v7 migrate deploy reads datasource.url from prisma.config.ts in CWD
|
|
186
|
+
parts.append(prisma_config_copy(res_path))
|
|
187
|
+
|
|
188
|
+
# Only set USER if not using golden image (already set in golden L4)
|
|
189
|
+
if not use_golden:
|
|
190
|
+
parts.append("USER bun\n")
|
|
191
|
+
|
|
192
|
+
parts.extend([
|
|
193
|
+
"EXPOSE " + str(port) + "\n",
|
|
194
|
+
])
|
|
195
|
+
|
|
196
|
+
# Only add healthcheck if not using golden image (already in golden L4)
|
|
197
|
+
if not use_golden:
|
|
198
|
+
parts.append(_backend_healthcheck_instruction(port, manifest))
|
|
199
|
+
|
|
200
|
+
if use_infisical:
|
|
201
|
+
# Use InfisicalDocker generator for proper secret injection setup
|
|
202
|
+
# This uses Starlark generators instead of hardcoded values
|
|
203
|
+
infisical_setup = InfisicalDocker.runtime_setup(
|
|
204
|
+
resource_name=resource_name,
|
|
205
|
+
secret_path=None, # Auto-generate from resource_name
|
|
206
|
+
resource_type="backend",
|
|
207
|
+
command=cmd,
|
|
208
|
+
use_entrypoint=True,
|
|
209
|
+
)
|
|
210
|
+
parts.append(infisical_setup)
|
|
211
|
+
else:
|
|
212
|
+
parts.append(_cmd_instruction(cmd))
|
|
213
|
+
|
|
214
|
+
# Provide build targets that match external tooling (e.g. --target production/ development)
|
|
215
|
+
parts.append("\nFROM l4_backend_runtime AS production\nFROM l4_backend_runtime AS development\n")
|
|
216
|
+
|
|
217
|
+
return "".join(parts)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def L4_generate_frontend_runtime(res_path, target_path = '/usr/share/nginx/html', use_nginx = True, use_golden = True, port = None):
|
|
221
|
+
"""
|
|
222
|
+
Generate the frontend runtime layer for static site serving.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
res_path: Resource path (service directory)
|
|
226
|
+
target_path: Target path for static files (default: Nginx html directory)
|
|
227
|
+
use_nginx: Use Nginx for serving (default: True, uses Bun static if False)
|
|
228
|
+
use_golden: Whether to use golden L4-frontend image (default: True)
|
|
229
|
+
port: Port to expose (default: None, uses BASE_PORT_FRONTEND or 80 for nginx)
|
|
230
|
+
|
|
231
|
+
Returns:
|
|
232
|
+
Dockerfile content string for the l4_frontend_runtime stage
|
|
233
|
+
"""
|
|
234
|
+
# Use provided port or fall back to base port constant
|
|
235
|
+
expose_port = port if port else BASE_PORT_FRONTEND
|
|
236
|
+
# Normalize res_path for Docker COPY (must be relative to build context)
|
|
237
|
+
res_path_rel = normalize_res_path(res_path)
|
|
238
|
+
|
|
239
|
+
if use_nginx:
|
|
240
|
+
# Use golden L4-frontend image if enabled (Nginx pre-configured)
|
|
241
|
+
base_image = GOLDEN_L4_FRONTEND_IMAGE if use_golden else "nginx:1.27-alpine"
|
|
242
|
+
|
|
243
|
+
# If using golden image, skip curl installation (already there)
|
|
244
|
+
healthcheck_setup = "" if use_golden else "RUN apk add --no-cache curl\n"
|
|
245
|
+
|
|
246
|
+
return (
|
|
247
|
+
"# ---- L4: frontend_runtime (nginx) ----\n"
|
|
248
|
+
+ "FROM " + base_image + " AS l4_frontend_runtime\n"
|
|
249
|
+
+ healthcheck_setup
|
|
250
|
+
+ "COPY --from=l3_frontend_build /app/" + res_path + "/dist " + target_path + "\n"
|
|
251
|
+
+ "COPY " + res_path_rel + "/" + OUTPUT.AUTOGENERATED_FOLDER + "/nginx.autogenerated.conf /etc/nginx/conf.d/default.conf\n"
|
|
252
|
+
+ "EXPOSE 80\n"
|
|
253
|
+
+ ("" if use_golden else "HEALTHCHECK " + dockerfile_healthcheck_flags(DOCKER_HEALTHCHECK["frontend_start_period_seconds"]) + " CMD curl -f http://localhost/ || exit 1\n")
|
|
254
|
+
+ "CMD [\"nginx\", \"-g\", \"daemon off;\"]\n"
|
|
255
|
+
+ "FROM l4_frontend_runtime AS production\n"
|
|
256
|
+
+ "FROM l4_frontend_runtime AS development\n"
|
|
257
|
+
)
|
|
258
|
+
# Use golden L4-frontend image even for Bun static serving (or BUN_BASE as fallback)
|
|
259
|
+
# NOTE: When use_nginx=False, we MUST use BUN_BASE because the golden L4 frontend
|
|
260
|
+
# image is nginx-based and doesn't have Bun installed
|
|
261
|
+
base_image = GOLDEN_L4_FRONTEND_IMAGE if (use_golden and use_nginx) else BUN_BASE
|
|
262
|
+
|
|
263
|
+
return (
|
|
264
|
+
"# ---- L4: frontend_runtime (bun static) ----\n"
|
|
265
|
+
+ "FROM " + base_image + " AS l4_frontend_runtime\n"
|
|
266
|
+
+ "WORKDIR /app/" + res_path + "\n"
|
|
267
|
+
+ "COPY --from=l3_frontend_build /app/" + res_path + "/dist ./dist\n"
|
|
268
|
+
+ "COPY --from=l3_frontend_build /app/" + res_path + "/node_modules ./node_modules\n"
|
|
269
|
+
+ "COPY --from=l3_frontend_build /app/" + res_path + "/" + OUTPUT.AUTOGENERATED_FOLDER + " ./" + OUTPUT.AUTOGENERATED_FOLDER + "\n"
|
|
270
|
+
+ "COPY " + res_path_rel + "/package.json ./package.json\n"
|
|
271
|
+
+ "EXPOSE " + str(expose_port) + "\n"
|
|
272
|
+
+ _cmd_instruction(resolve_bun_start_command(res_path))
|
|
273
|
+
+ "FROM l4_frontend_runtime AS production\n"
|
|
274
|
+
+ "FROM l4_frontend_runtime AS development\n"
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
# L4_generate_migrator_runtime is now loaded from prisma/prisma_runtime.star
|
|
279
|
+
|
|
280
|
+
DEBUG = {}
|
|
281
|
+
|
|
282
|
+
GLOBAL_CONFIG = {}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Copyright (c) 2026 Flisk contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# === INLINED CONSTANTS for pure extension loading ===
|
|
4
|
+
RUNTIME = "bun"
|
|
5
|
+
# === END INLINED CONSTANTS ===
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Shared constants/helpers for Prisma Docker layer generators.
|
|
10
|
+
|
|
11
|
+
Centralizes repeated paths/defaults used across prisma_*.star modules so
|
|
12
|
+
string-heavy Dockerfile/script fragments stay consistent and reusable.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
APP_DIR = "/app"
|
|
18
|
+
NODE_MODULES_DIR = "node_modules"
|
|
19
|
+
NODE_MODULES_BIN_DIR = NODE_MODULES_DIR + "/.bin"
|
|
20
|
+
APP_NODE_MODULES_DIR = APP_DIR + "/" + NODE_MODULES_DIR
|
|
21
|
+
APP_NODE_MODULES_BIN_DIR = APP_NODE_MODULES_DIR + "/.bin"
|
|
22
|
+
APP_BUN_STORE_DIR = APP_NODE_MODULES_DIR + "/.bun"
|
|
23
|
+
|
|
24
|
+
PRISMA_DIR_NAME = "prisma"
|
|
25
|
+
PRISMA_SCOPE_DIR_NAME = "@prisma"
|
|
26
|
+
PRISMA_SCHEMA_PATH = PRISMA_DIR_NAME + "/schema.prisma"
|
|
27
|
+
|
|
28
|
+
PRISMA_CONFIG_FILE = "prisma.config.ts"
|
|
29
|
+
PRISMA_CONFIG_WORKDIR_PATH = "./" + PRISMA_CONFIG_FILE
|
|
30
|
+
PRISMA_CONFIG_ABS_PATH = APP_DIR + "/" + PRISMA_CONFIG_FILE
|
|
31
|
+
|
|
32
|
+
APP_SRC_DIR = APP_DIR + "/src"
|
|
33
|
+
APP_GENERATED_CLIENT_DIR = APP_DIR + "/generated-client"
|
|
34
|
+
APP_PRISMA_DIR = APP_DIR + "/" + PRISMA_DIR_NAME
|
|
35
|
+
|
|
36
|
+
PRISMA_DOT_DIR_REL_PATH = NODE_MODULES_DIR + "/.prisma"
|
|
37
|
+
PRISMA_DOT_CLIENT_REL_PATH = PRISMA_DOT_DIR_REL_PATH + "/client"
|
|
38
|
+
PRISMA_DOT_CLIENT_ABS_PATH = APP_DIR + "/" + PRISMA_DOT_CLIENT_REL_PATH
|
|
39
|
+
|
|
40
|
+
PRISMA_BIN_REL_PATH = NODE_MODULES_DIR + "/.bin/prisma"
|
|
41
|
+
PRISMA_BIN_ABS_PATH = APP_DIR + "/" + PRISMA_BIN_REL_PATH
|
|
42
|
+
PRISMA_BIN_SYMLINK_TARGET = "../prisma/build/index.js"
|
|
43
|
+
|
|
44
|
+
PRISMA_PACKAGE_REL_PATH = NODE_MODULES_DIR + "/prisma"
|
|
45
|
+
PRISMA_SCOPE_REL_PATH = NODE_MODULES_DIR + "/" + PRISMA_SCOPE_DIR_NAME
|
|
46
|
+
PRISMA_ENGINES_REL_PATH = PRISMA_SCOPE_REL_PATH + "/engines"
|
|
47
|
+
PRISMA_PACKAGE_NODE_MODULES_REL_PATH = PRISMA_PACKAGE_REL_PATH + "/node_modules"
|
|
48
|
+
|
|
49
|
+
APP_PRISMA_PACKAGE_DIR = APP_NODE_MODULES_DIR + "/" + PRISMA_DIR_NAME
|
|
50
|
+
APP_PRISMA_SCOPE_DIR = APP_NODE_MODULES_DIR + "/" + PRISMA_SCOPE_DIR_NAME
|
|
51
|
+
APP_PRISMA_ENGINES_DIR = APP_PRISMA_SCOPE_DIR + "/engines"
|
|
52
|
+
APP_PRISMA_PACKAGE_NODE_MODULES_DIR = APP_PRISMA_PACKAGE_DIR + "/node_modules"
|
|
53
|
+
APP_PRISMA_PACKAGE_ENGINES_DIR = APP_PRISMA_PACKAGE_NODE_MODULES_DIR + "/" + PRISMA_SCOPE_DIR_NAME + "/engines"
|
|
54
|
+
|
|
55
|
+
PRISMA_CLIENT_PACKAGE_REL_PATH = PRISMA_SCOPE_REL_PATH + "/client"
|
|
56
|
+
BUN_PRISMA_CLIENT_LINKER_NODE_MODULES_GLOB = NODE_MODULES_DIR + "/.bun/@prisma+client*/node_modules"
|
|
57
|
+
|
|
58
|
+
MIGRATE_SH_FILE = "migrate.sh"
|
|
59
|
+
MIGRATE_SH_ABS_PATH = APP_DIR + "/" + MIGRATE_SH_FILE
|
|
60
|
+
|
|
61
|
+
L3_MIGRATION_BUILD_STAGE = "l3_migration_build"
|
|
62
|
+
|
|
63
|
+
ROOT_USER = "root"
|
|
64
|
+
BUN_USER = RUNTIME
|
|
65
|
+
|
|
66
|
+
PRISMA_GENERATE_COMMAND = "bunx prisma generate"
|
|
67
|
+
PRISMA_GENERATE_RUN = "RUN " + PRISMA_GENERATE_COMMAND + "\n"
|
|
68
|
+
PRISMA_MIGRATE_DEPLOY_SUBCOMMAND = "migrate deploy"
|
|
69
|
+
PRISMA_GENERATE_SUBCOMMAND = "generate"
|
|
70
|
+
|
|
71
|
+
# Load project name for dynamic golden image naming
|
|
72
|
+
# Use TDK_PROJECT_ROOT env var set by Tilt, fallback to current directory
|
|
73
|
+
def _load_golden_prefix():
|
|
74
|
+
project_root = os.environ.get('TDK_PROJECT_ROOT', '')
|
|
75
|
+
project_json_path = '.tdk/project.json'
|
|
76
|
+
if project_root:
|
|
77
|
+
project_json_path = project_root + '/' + project_json_path
|
|
78
|
+
|
|
79
|
+
if os.path.exists(project_json_path):
|
|
80
|
+
_project_json = read_json(project_json_path)
|
|
81
|
+
return _project_json.get('project', {}).get('name', 'tdk-project')
|
|
82
|
+
return 'tdk-project'
|
|
83
|
+
|
|
84
|
+
_GOLDEN_PREFIX = _load_golden_prefix()
|
|
85
|
+
|
|
86
|
+
# Migrators build on l3-backend; the golden build no longer makes a separate l3-migrator image.
|
|
87
|
+
DEFAULT_GOLDEN_L3_MIGRATOR_IMAGE = _GOLDEN_PREFIX + "-l3-backend:latest"
|
|
88
|
+
DEFAULT_GOLDEN_L4_MIGRATOR_IMAGE = _GOLDEN_PREFIX + "-l4-migrator:latest"
|
|
89
|
+
|
|
90
|
+
DEFAULT_DB_PORT = "5432"
|
|
91
|
+
DEFAULT_DB_WAIT_TIMEOUT_SECS = 120
|
|
92
|
+
DB_URL_HOSTPORT_WITH_AUTH_SED = "sed -n 's#^[^/]*//[^@]*@\\([^/]*\\)/.*#\\1#p'"
|
|
93
|
+
DB_URL_HOSTPORT_NO_AUTH_SED = "sed -n 's#^[^/]*//\\([^/]*\\)/.*#\\1#p'"
|
|
94
|
+
|
|
95
|
+
DEFAULT_INFISICAL_URL = "http://" + _GOLDEN_PREFIX + "-infisical:8081"
|
|
96
|
+
DATABASE_URL_UNSET_CONDITION = "[ -z \"$DATABASE_URL\" ] || [ \"$DATABASE_URL\" = \"null\" ]"
|
|
97
|
+
INFISICAL_SECRET_ENV_KEYS = [
|
|
98
|
+
"DATABASE_URL",
|
|
99
|
+
"DB_USER",
|
|
100
|
+
"DB_PASSWORD",
|
|
101
|
+
"DB_HOST",
|
|
102
|
+
"DB_PORT",
|
|
103
|
+
"DB_NAME",
|
|
104
|
+
]
|
|
105
|
+
DB_URL_COMPONENT_ENV_KEYS = [
|
|
106
|
+
"DB_USER",
|
|
107
|
+
"DB_PASSWORD",
|
|
108
|
+
"DB_HOST",
|
|
109
|
+
"DB_PORT",
|
|
110
|
+
"DB_NAME",
|
|
111
|
+
]
|
|
112
|
+
DB_URL_FROM_COMPONENTS = "postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME"
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def app_resource_dir(res_path):
|
|
116
|
+
return APP_DIR + "/" + res_path
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def resource_node_modules_dir(res_path):
|
|
120
|
+
return app_resource_dir(res_path) + "/" + NODE_MODULES_DIR
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def prisma_normalize_output_block(include_generated_client_export = True):
|
|
124
|
+
"""
|
|
125
|
+
Shared Prisma client normalization instructions used in both generic and
|
|
126
|
+
migration-engine build flows.
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
include_generated_client_export: Include generated-client.ts shim line.
|
|
130
|
+
"""
|
|
131
|
+
export_flag = "1" if include_generated_client_export else "0"
|
|
132
|
+
return (
|
|
133
|
+
"# Normalize Prisma output for both import styles using shared script\n"
|
|
134
|
+
+ "COPY shared-platform-engineering/docker-templates/prisma-normalize-client.sh /usr/local/bin/prisma-normalize-client.sh\n"
|
|
135
|
+
+ "RUN chmod +x /usr/local/bin/prisma-normalize-client.sh && PRISMA_EXPORT_GENERATED_CLIENT="
|
|
136
|
+
+ export_flag
|
|
137
|
+
+ " /usr/local/bin/prisma-normalize-client.sh\n"
|
|
138
|
+
)
|