@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,148 @@
|
|
|
1
|
+
#!/usr/bin/env starlark
|
|
2
|
+
# Copyright (c) 2026 Flisk Landscape contributors
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# 🐳 TILT SDK - TRAEFIK CONSTANTS
|
|
6
|
+
# =============================================================================
|
|
7
|
+
# STORY 4 FIX: API Gateway 504 Error Prevention
|
|
8
|
+
# - Startup grace period: 30s (allows services to fully initialize)
|
|
9
|
+
# - Extended timeouts for cold-start services
|
|
10
|
+
# - Proper health check sequencing
|
|
11
|
+
# =============================================================================
|
|
12
|
+
|
|
13
|
+
# === INLINED CONSTANTS for pure extension loading ===
|
|
14
|
+
TRAEFIK_CONFIG = {
|
|
15
|
+
"entrypoint": "web",
|
|
16
|
+
"web_entrypoint": "web",
|
|
17
|
+
"network": "traefik-public",
|
|
18
|
+
"default_host": "localhost",
|
|
19
|
+
"default_port": 8080,
|
|
20
|
+
"tls_enabled": False,
|
|
21
|
+
"entrypoints": ["web"],
|
|
22
|
+
"middlewares": [],
|
|
23
|
+
"tls": {"enabled": False},
|
|
24
|
+
"healthcheck_path": "/health",
|
|
25
|
+
"healthcheck_interval": "10s",
|
|
26
|
+
"healthcheck_timeout": "5s",
|
|
27
|
+
"frontend_priority_base": 100,
|
|
28
|
+
"websecure_entrypoint": "websecure",
|
|
29
|
+
"enable_strip_prefix": True,
|
|
30
|
+
"localhost_suffix": ".localhost",
|
|
31
|
+
"healthcheck_retries": 3,
|
|
32
|
+
"resource_startup_delay": "30s",
|
|
33
|
+
"startup_grace_period": "30s",
|
|
34
|
+
"response_timeout": "30s",
|
|
35
|
+
"connection_timeout": "10s",
|
|
36
|
+
"retry_attempts": 3,
|
|
37
|
+
"circuit_breaker_threshold": 5,
|
|
38
|
+
"strip_prefix_middleware_suffix": "-strip-prefix",
|
|
39
|
+
"retry_initial_interval": "1s",
|
|
40
|
+
"retry_max_interval": "10s",
|
|
41
|
+
"rate_limit_requests": 100,
|
|
42
|
+
"rate_limit_period": "1m",
|
|
43
|
+
"buffer_request_body": True,
|
|
44
|
+
"forward_auth_url": "",
|
|
45
|
+
"api_base_path": "/api",
|
|
46
|
+
"api_version": "v1"
|
|
47
|
+
}
|
|
48
|
+
DEFAULTS = {}
|
|
49
|
+
|
|
50
|
+
# === END INLINED CONSTANTS ===
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
load("../constants.star", "PlatformDockerConstants")
|
|
54
|
+
# =============================================================================
|
|
55
|
+
# MASTER CONFIG IMPORTS - Use centralized configuration
|
|
56
|
+
# =============================================================================
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# =============================================================================
|
|
60
|
+
# API PATH CONSTANTS - Import for dynamic API path generation
|
|
61
|
+
# =============================================================================
|
|
62
|
+
load("./api_path_constants.star",
|
|
63
|
+
"get_api_path_for_domain",
|
|
64
|
+
"get_api_path_for_service",
|
|
65
|
+
"build_traefik_url",
|
|
66
|
+
"build_health_endpoint")
|
|
67
|
+
|
|
68
|
+
TRAEFIK_ENABLE_LABEL = "traefik.enable=true"
|
|
69
|
+
TRAEFIK_DOCKER_NETWORK = PlatformDockerConstants.NETWORK_TRAEFIK_PUBLIC
|
|
70
|
+
|
|
71
|
+
# Entrypoints from master config
|
|
72
|
+
TRAEFIK_WEBSECURE_ENTRYPOINT = TRAEFIK_CONFIG["websecure_entrypoint"]
|
|
73
|
+
|
|
74
|
+
TRAEFIK_FRONTEND_ENABLE_HTTP = True
|
|
75
|
+
TRAEFIK_FRONTEND_ENABLE_HTTPS = True
|
|
76
|
+
TRAEFIK_BACKEND_ENABLE_HTTP = True
|
|
77
|
+
TRAEFIK_BACKEND_ENABLE_HTTPS = False
|
|
78
|
+
|
|
79
|
+
# Middleware settings from master config
|
|
80
|
+
TRAEFIK_ENABLE_STRIP_PREFIX_MIDDLEWARE = TRAEFIK_CONFIG["enable_strip_prefix"]
|
|
81
|
+
TRAEFIK_ENABLE_FRONTEND_HOST_RULE = True
|
|
82
|
+
TRAEFIK_ENABLE_FRONTEND_PATH_RULE = True
|
|
83
|
+
TRAEFIK_ENABLE_BACKEND_HOST_RULE = True
|
|
84
|
+
TRAEFIK_ENABLE_BACKEND_PATH_RULE = True
|
|
85
|
+
|
|
86
|
+
TRAEFIK_PROJECT_HOST = PlatformDockerConstants.LOCAL_DOMAIN
|
|
87
|
+
TRAEFIK_PROJECT_APP_HOST = PlatformDockerConstants.APP_LOCAL_DOMAIN
|
|
88
|
+
TRAEFIK_PROJECT_API_HOST = PlatformDockerConstants.API_LOCAL_DOMAIN
|
|
89
|
+
TRAEFIK_FRONTEND_LOCALHOST_SUFFIX = TRAEFIK_CONFIG["localhost_suffix"]
|
|
90
|
+
|
|
91
|
+
# Priority from master config
|
|
92
|
+
TRAEFIK_FRONTEND_PRIORITY_BASE = TRAEFIK_CONFIG["frontend_priority_base"]
|
|
93
|
+
|
|
94
|
+
# =============================================================================
|
|
95
|
+
# STORY 4 FIX: Health check configuration with 30-second grace period
|
|
96
|
+
# =============================================================================
|
|
97
|
+
# From TILT_RESOURCE_DEFAULTS.star - centralized configuration
|
|
98
|
+
# Health check configuration - optimized to prevent 504s on startup
|
|
99
|
+
TRAEFIK_HEALTHCHECK_RETRIES = TRAEFIK_CONFIG["healthcheck_retries"]
|
|
100
|
+
|
|
101
|
+
# STORY 4 FIX: 30-second grace period (matches issue requirement)
|
|
102
|
+
TRAEFIK_RESOURCE_STARTUP_DELAY = TRAEFIK_CONFIG["resource_startup_delay"]
|
|
103
|
+
TRAEFIK_HEALTHY_THRESHOLD = TRAEFIK_CONFIG["retry_attempts"]
|
|
104
|
+
TRAEFIK_MIDDLEWARE_SUFFIX = TRAEFIK_CONFIG["strip_prefix_middleware_suffix"]
|
|
105
|
+
|
|
106
|
+
# =============================================================================
|
|
107
|
+
# API ROUTING PATHS - Dynamic from Manifests
|
|
108
|
+
# =============================================================================
|
|
109
|
+
# API paths are generated dynamically from manifest domain and appName fields
|
|
110
|
+
# No hardcoded service names - all from service.json
|
|
111
|
+
# =============================================================================
|
|
112
|
+
|
|
113
|
+
# Planner service paths are generated dynamically from manifests
|
|
114
|
+
# Use get_api_path_for_domain() function instead of hardcoded constants
|
|
115
|
+
|
|
116
|
+
# API paths are now generated dynamically - no hardcoded constants
|
|
117
|
+
# Use get_api_path_for_domain() function instead
|
|
118
|
+
|
|
119
|
+
# =============================================================================
|
|
120
|
+
# API ROUTING PATTERN
|
|
121
|
+
# =============================================================================
|
|
122
|
+
# Standard API path pattern generated from manifest: /api/v1/{appName}
|
|
123
|
+
# Domain comes from service manifest, allowing dynamic service discovery
|
|
124
|
+
# No hardcoded examples - all paths from service.json
|
|
125
|
+
# =============================================================================
|
|
126
|
+
# TRAEFIK_API_VERSION and TRAEFIK_API_BASE_PATH now imported from master config
|
|
127
|
+
|
|
128
|
+
# =============================================================================
|
|
129
|
+
# STORY 4 FIX: Retry middleware configuration for transient failures
|
|
130
|
+
# =============================================================================
|
|
131
|
+
TRAEFIK_RETRY_ATTEMPTS = TRAEFIK_CONFIG["retry_attempts"]
|
|
132
|
+
TRAEFIK_RETRY_INITIAL_INTERVAL = TRAEFIK_CONFIG["retry_initial_interval"]
|
|
133
|
+
|
|
134
|
+
# =============================================================================
|
|
135
|
+
# MASTER CONFIG RE-EXPORTS
|
|
136
|
+
# =============================================================================
|
|
137
|
+
# Re-export all values imported from master config so other files can load them
|
|
138
|
+
# from this module. This maintains backward compatibility.
|
|
139
|
+
|
|
140
|
+
# Define traefik constants from master config (available for other files to load)
|
|
141
|
+
TRAEFIK_WEB_ENTRYPOINT = TRAEFIK_CONFIG["web_entrypoint"]
|
|
142
|
+
TRAEFIK_WEBSECURE_ENTRYPOINT = TRAEFIK_CONFIG["websecure_entrypoint"]
|
|
143
|
+
TRAEFIK_HEALTHCHECK_INTERVAL = TRAEFIK_CONFIG["healthcheck_interval"]
|
|
144
|
+
TRAEFIK_HEALTHCHECK_TIMEOUT = TRAEFIK_CONFIG["healthcheck_timeout"]
|
|
145
|
+
TRAEFIK_HEALTHCHECK_RETRIES = TRAEFIK_CONFIG["healthcheck_retries"]
|
|
146
|
+
TRAEFIK_STARTUP_GRACE_PERIOD = TRAEFIK_CONFIG["startup_grace_period"]
|
|
147
|
+
TRAEFIK_API_BASE_PATH = TRAEFIK_CONFIG["api_base_path"]
|
|
148
|
+
TRAEFIK_API_VERSION = TRAEFIK_CONFIG["api_version"]
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Copyright (c) 2026 Flisk Landscape contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# 🐳 TILT SDK - TRAEFIK HELPERS
|
|
5
|
+
# =============================================================================
|
|
6
|
+
|
|
7
|
+
# === INLINED CONSTANTS for pure extension loading ===
|
|
8
|
+
TRAEFIK_API_BASE_PATH = "/api"
|
|
9
|
+
# === END INLINED CONSTANTS ===
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
load(
|
|
13
|
+
"./traefik_constants.star",
|
|
14
|
+
"TRAEFIK_PROJECT_HOST",
|
|
15
|
+
"TRAEFIK_PROJECT_APP_HOST",
|
|
16
|
+
"TRAEFIK_PROJECT_API_HOST",
|
|
17
|
+
"TRAEFIK_ENABLE_BACKEND_PATH_RULE",
|
|
18
|
+
"TRAEFIK_ENABLE_BACKEND_HOST_RULE",
|
|
19
|
+
"TRAEFIK_ENABLE_FRONTEND_HOST_RULE",
|
|
20
|
+
"TRAEFIK_ENABLE_FRONTEND_PATH_RULE",
|
|
21
|
+
"TRAEFIK_FRONTEND_LOCALHOST_SUFFIX",
|
|
22
|
+
"TRAEFIK_WEB_ENTRYPOINT",
|
|
23
|
+
"TRAEFIK_WEBSECURE_ENTRYPOINT",
|
|
24
|
+
"TRAEFIK_API_VERSION",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def build_entrypoints(enable_http, enable_https):
|
|
30
|
+
entrypoints = []
|
|
31
|
+
if enable_http:
|
|
32
|
+
entrypoints.append(TRAEFIK_WEB_ENTRYPOINT)
|
|
33
|
+
if enable_https:
|
|
34
|
+
entrypoints.append(TRAEFIK_WEBSECURE_ENTRYPOINT)
|
|
35
|
+
if len(entrypoints) == 0:
|
|
36
|
+
entrypoints.append(TRAEFIK_WEB_ENTRYPOINT)
|
|
37
|
+
return ",".join(entrypoints)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def frontend_rule(res_name, base_path, traefik_host):
|
|
41
|
+
parts = []
|
|
42
|
+
if TRAEFIK_ENABLE_FRONTEND_HOST_RULE:
|
|
43
|
+
parts.append(
|
|
44
|
+
"Host(`{res_name}{suffix}`)".format(
|
|
45
|
+
res_name=res_name,
|
|
46
|
+
suffix=TRAEFIK_FRONTEND_LOCALHOST_SUFFIX,
|
|
47
|
+
),
|
|
48
|
+
)
|
|
49
|
+
if traefik_host:
|
|
50
|
+
parts.append("Host(`{traefik_host}`)".format(traefik_host=traefik_host))
|
|
51
|
+
if TRAEFIK_ENABLE_FRONTEND_PATH_RULE:
|
|
52
|
+
parts.append(
|
|
53
|
+
"(Host(`{host}`) && PathPrefix(`{base_path}`))".format(
|
|
54
|
+
host=TRAEFIK_PROJECT_APP_HOST,
|
|
55
|
+
base_path=base_path,
|
|
56
|
+
),
|
|
57
|
+
)
|
|
58
|
+
# Also accept localhost for local testing
|
|
59
|
+
parts.append(
|
|
60
|
+
"(Host(`localhost`) && PathPrefix(`{base_path}`))".format(
|
|
61
|
+
base_path=base_path,
|
|
62
|
+
),
|
|
63
|
+
)
|
|
64
|
+
return " || ".join(parts)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def backend_rule(traefik_host, traefik_path):
|
|
68
|
+
parts = []
|
|
69
|
+
if TRAEFIK_ENABLE_BACKEND_HOST_RULE and traefik_host:
|
|
70
|
+
parts.append("Host(`{host}`)".format(host=traefik_host))
|
|
71
|
+
if TRAEFIK_ENABLE_BACKEND_PATH_RULE and traefik_path:
|
|
72
|
+
parts.append("PathPrefix(`{path}`)".format(path=traefik_path))
|
|
73
|
+
return " || ".join(parts)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _pluralize_stack(stack):
|
|
77
|
+
"""Convert stack to proper plural form.
|
|
78
|
+
|
|
79
|
+
Handles irregular plurals and special cases.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
stack: Singular stack name (e.g., "user", "order", "product")
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
str: Pluralized stack name (e.g., "users", "orders", "products")
|
|
86
|
+
"""
|
|
87
|
+
# Already plural
|
|
88
|
+
if stack.endswith("s"):
|
|
89
|
+
return stack
|
|
90
|
+
|
|
91
|
+
# Irregular plurals that don't follow normal rules
|
|
92
|
+
irregulars = {
|
|
93
|
+
"identity": "identity",
|
|
94
|
+
"profile": "profile", # profiles is wrong, profile is correct
|
|
95
|
+
"staff": "staff",
|
|
96
|
+
"inventory": "inventory",
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if stack in irregulars:
|
|
100
|
+
return irregulars[stack]
|
|
101
|
+
|
|
102
|
+
# Words ending in 'y' preceded by a consonant -> 'ies'
|
|
103
|
+
if stack.endswith("y") and len(stack) > 1 and stack[-2] not in "aeiou":
|
|
104
|
+
return stack[:-1] + "ies"
|
|
105
|
+
|
|
106
|
+
# Words ending in ch, sh, ss, x, z, o -> 'es'
|
|
107
|
+
if stack.endswith(("ch", "sh", "ss", "x", "z", "o")):
|
|
108
|
+
return stack + "es"
|
|
109
|
+
|
|
110
|
+
return stack + "s"
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def get_api_path(stack, manifest=None):
|
|
114
|
+
"""Generate API path from stack. Converts stack to proper resource name.
|
|
115
|
+
|
|
116
|
+
URL Restructuring: Changed from /api/v1/{stack} to /api/{resource-name}
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
stack: Resource stack from manifest (from service.json)
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
str: API path like "/api/{stack}-management"
|
|
123
|
+
"""
|
|
124
|
+
# NEW: Use {stack}-management pattern instead of pluralized stack
|
|
125
|
+
# This matches the resource naming convention ({stack}-management)
|
|
126
|
+
return "{base}/{stack}-management".format(
|
|
127
|
+
base=TRAEFIK_API_BASE_PATH,
|
|
128
|
+
stack=stack,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def cli_api_path(resource_name, manifest=None):
|
|
133
|
+
"""API path printed by `flisk up` and served on api.{project}.localhost.
|
|
134
|
+
|
|
135
|
+
Matches cli/src/commands/up.ts: `/api/{name}` with a trailing `-api` stripped.
|
|
136
|
+
"""
|
|
137
|
+
if manifest and manifest.get("apiPath"):
|
|
138
|
+
return manifest.get("apiPath")
|
|
139
|
+
name = resource_name or (manifest.get("appName", "") if manifest else "")
|
|
140
|
+
if name.endswith("-api"):
|
|
141
|
+
name = name[:-4]
|
|
142
|
+
return TRAEFIK_API_BASE_PATH + "/" + name
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def project_backend_rule(manifest, resource_name=None):
|
|
146
|
+
"""Generate routing rule for api.{project}.localhost from manifest.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
manifest: Service manifest dictionary
|
|
150
|
+
resource_name: Runtime resource name (e.g. auth-api-backend)
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
str: Traefik routing rule for project localhost domain
|
|
154
|
+
"""
|
|
155
|
+
if not manifest and not resource_name:
|
|
156
|
+
return ""
|
|
157
|
+
|
|
158
|
+
api_path = cli_api_path(resource_name, manifest)
|
|
159
|
+
return "Host(`{host}`) && PathPrefix(`{path}`)".format(
|
|
160
|
+
host=TRAEFIK_PROJECT_API_HOST,
|
|
161
|
+
path=api_path,
|
|
162
|
+
)
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Copyright (c) 2026 Flisk contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# Traefik static (file-provider) route for a deferred (`sablier.deferStart`)
|
|
5
|
+
# resource -- see openspec/changes/prioritized-cold-start.
|
|
6
|
+
# =============================================================================
|
|
7
|
+
# A never-created resource has no container and thus no Docker labels, so its
|
|
8
|
+
# route can't come from Traefik's Docker-label discovery the way every other
|
|
9
|
+
# resource's does. This generates the file-provider equivalent instead:
|
|
10
|
+
# same routing rule as the Docker-label `-project` router (traefik.star's
|
|
11
|
+
# get_backend_traefik_labels), but pointed at the wake gateway with a fixed
|
|
12
|
+
# LOW priority so the real, Docker-discovered router always wins once the
|
|
13
|
+
# container exists (verified empirically -- see design.md D4: at equal
|
|
14
|
+
# priority the file-provider router won even when the Docker-discovered
|
|
15
|
+
# backend was healthy).
|
|
16
|
+
#
|
|
17
|
+
# Config for a request travels to the gateway via headers (X-Wake-*), not
|
|
18
|
+
# the path/query. The route still strips the same `apiPath` prefix the real
|
|
19
|
+
# Docker-label `-project` router strips (get_backend_traefik_labels) before
|
|
20
|
+
# forwarding -- confirmed live against tdk-erp-system (task 7.2) that a
|
|
21
|
+
# backend's app only serves its bare health path (e.g. `/health`), not the
|
|
22
|
+
# full `/api/{name}/health` the public route is matched on; without this, the
|
|
23
|
+
# gateway's own proxy-through would forward the unstripped path once healthy
|
|
24
|
+
# and the app would 404 on it, even though the wake itself succeeded.
|
|
25
|
+
|
|
26
|
+
load("./traefik_helpers.star", "project_backend_rule", "cli_api_path", "build_entrypoints")
|
|
27
|
+
load("./traefik_constants.star",
|
|
28
|
+
"TRAEFIK_BACKEND_ENABLE_HTTP",
|
|
29
|
+
"TRAEFIK_BACKEND_ENABLE_HTTPS",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
STATIC_ROUTE_PRIORITY = 1
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def normalize_abs_path(path):
|
|
36
|
+
"""Absolute path with `.`/`..` segments collapsed, or "" for "".
|
|
37
|
+
|
|
38
|
+
Tilt's os.path.abspath does not collapse `..` (confirmed:
|
|
39
|
+
abspath("/a/.tdk/.tdk-out/../..") comes back unchanged), and the
|
|
40
|
+
generated Tiltfile's project root is exactly that shape
|
|
41
|
+
(config.main_dir + "/../.."). The gateway's project mount and the compose
|
|
42
|
+
paths in its route headers must match byte-for-byte, so both go through here.
|
|
43
|
+
"""
|
|
44
|
+
if not path:
|
|
45
|
+
return ""
|
|
46
|
+
parts = []
|
|
47
|
+
for segment in os.path.abspath(path).split("/"):
|
|
48
|
+
if segment == "" or segment == ".":
|
|
49
|
+
continue
|
|
50
|
+
if segment == "..":
|
|
51
|
+
if parts:
|
|
52
|
+
parts.pop()
|
|
53
|
+
continue
|
|
54
|
+
parts.append(segment)
|
|
55
|
+
return "/" + "/".join(parts)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _container_name(compose_project_name, res_name):
|
|
59
|
+
"""Docker Compose's own naming convention: <project>-<service>-<replica>.
|
|
60
|
+
|
|
61
|
+
Confirmed empirically against a live Flisk container (analytics-autogenerated
|
|
62
|
+
-data-governance-api-1) -- see design.md D2 Context. Compose projects are now
|
|
63
|
+
<project>-<stack>-autogenerated, so the name starts with the Flisk project too
|
|
64
|
+
(tdk-erp-system-analytics-autogenerated-data-governance-api-1). Always replica 1: a
|
|
65
|
+
deferred resource's replica count is unrelated to which single instance
|
|
66
|
+
the wake gateway needs to address."""
|
|
67
|
+
return compose_project_name + "-" + res_name + "-1"
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def generate_static_wake_route(
|
|
71
|
+
resource_entry_name,
|
|
72
|
+
compose_project_name,
|
|
73
|
+
manifest,
|
|
74
|
+
internal_port,
|
|
75
|
+
gateway_host,
|
|
76
|
+
gateway_port,
|
|
77
|
+
dependencies=None,
|
|
78
|
+
compose_files=None,
|
|
79
|
+
env_file="",
|
|
80
|
+
image="",
|
|
81
|
+
):
|
|
82
|
+
"""YAML for one resource's Traefik file-provider dynamic-config entry.
|
|
83
|
+
|
|
84
|
+
`dependencies` is a list of (res_name, compose_project_name) tuples for
|
|
85
|
+
the resource's required startup dependencies (D5) -- each may live in a
|
|
86
|
+
different compose project than the resource itself, so the project name
|
|
87
|
+
travels alongside the resource name rather than being assumed shared.
|
|
88
|
+
|
|
89
|
+
`compose_files` (absolute paths), `env_file` and `image` let the gateway
|
|
90
|
+
create the container itself with `docker compose up --no-build` when the
|
|
91
|
+
image already exists, instead of waiting in Tilt's build queue behind
|
|
92
|
+
`tilt trigger`. Omitted headers make the gateway use `tilt trigger` only.
|
|
93
|
+
|
|
94
|
+
Written to the directory PlatformDockerConstants.TRAEFIK_DYNAMIC_DIR_REL
|
|
95
|
+
mounts into the standalone Traefik container (traefik_standalone.star).
|
|
96
|
+
"""
|
|
97
|
+
dependencies = dependencies or []
|
|
98
|
+
|
|
99
|
+
rule = project_backend_rule(manifest, resource_entry_name)
|
|
100
|
+
api_path = cli_api_path(resource_entry_name, manifest)
|
|
101
|
+
entrypoints = build_entrypoints(TRAEFIK_BACKEND_ENABLE_HTTP, TRAEFIK_BACKEND_ENABLE_HTTPS)
|
|
102
|
+
router_name = resource_entry_name + "-wake"
|
|
103
|
+
headers_middleware_name = resource_entry_name + "-wake-headers"
|
|
104
|
+
strip_middleware_name = resource_entry_name + "-wake-strip"
|
|
105
|
+
service_name = resource_entry_name + "-wake-gateway"
|
|
106
|
+
container_name = _container_name(compose_project_name, resource_entry_name)
|
|
107
|
+
deps_header = ",".join([
|
|
108
|
+
dep_res_name + "=" + _container_name(dep_project_name, dep_res_name)
|
|
109
|
+
for dep_res_name, dep_project_name in dependencies
|
|
110
|
+
])
|
|
111
|
+
compose_headers = ""
|
|
112
|
+
if compose_files and image:
|
|
113
|
+
compose_headers = (
|
|
114
|
+
'\n X-Wake-Compose-Project: "' + compose_project_name + '"'
|
|
115
|
+
+ '\n X-Wake-Compose-Files: "' + ",".join(compose_files) + '"'
|
|
116
|
+
+ '\n X-Wake-Env-File: "' + env_file + '"'
|
|
117
|
+
+ '\n X-Wake-Image: "' + image + '"'
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return """# SYSTEM-GENERATED - DO NOT EDIT (sablier.deferStart static wake route)
|
|
121
|
+
http:
|
|
122
|
+
routers:
|
|
123
|
+
{router_name}:
|
|
124
|
+
rule: "{rule}"
|
|
125
|
+
entryPoints:
|
|
126
|
+
- {entrypoint}
|
|
127
|
+
service: {service_name}
|
|
128
|
+
middlewares:
|
|
129
|
+
- {strip_middleware_name}
|
|
130
|
+
- {headers_middleware_name}
|
|
131
|
+
priority: {priority}
|
|
132
|
+
middlewares:
|
|
133
|
+
{strip_middleware_name}:
|
|
134
|
+
stripPrefix:
|
|
135
|
+
prefixes:
|
|
136
|
+
- "{api_path}"
|
|
137
|
+
{headers_middleware_name}:
|
|
138
|
+
headers:
|
|
139
|
+
customRequestHeaders:
|
|
140
|
+
X-Wake-Resource: "{resource_entry_name}"
|
|
141
|
+
X-Wake-Container: "{container_name}"
|
|
142
|
+
X-Wake-Deps: "{deps_header}"
|
|
143
|
+
X-Wake-Proxy-Port: "{internal_port}"{compose_headers}
|
|
144
|
+
services:
|
|
145
|
+
{service_name}:
|
|
146
|
+
loadBalancer:
|
|
147
|
+
servers:
|
|
148
|
+
- url: "http://{gateway_host}:{gateway_port}"
|
|
149
|
+
""".format(
|
|
150
|
+
router_name=router_name,
|
|
151
|
+
rule=rule,
|
|
152
|
+
entrypoint=entrypoints.split(",")[0],
|
|
153
|
+
service_name=service_name,
|
|
154
|
+
strip_middleware_name=strip_middleware_name,
|
|
155
|
+
headers_middleware_name=headers_middleware_name,
|
|
156
|
+
api_path=api_path,
|
|
157
|
+
priority=STATIC_ROUTE_PRIORITY,
|
|
158
|
+
resource_entry_name=resource_entry_name,
|
|
159
|
+
container_name=container_name,
|
|
160
|
+
deps_header=deps_header,
|
|
161
|
+
internal_port=internal_port,
|
|
162
|
+
compose_headers=compose_headers,
|
|
163
|
+
gateway_host=gateway_host,
|
|
164
|
+
gateway_port=gateway_port,
|
|
165
|
+
)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Copyright (c) 2026 Flisk contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# 🔑 SECRETS FROM THE PROJECT .env
|
|
5
|
+
# =============================================================================
|
|
6
|
+
# Purpose: Make `secrets.required` / `secrets.optional` in service.json real for local development.
|
|
7
|
+
#
|
|
8
|
+
# The default provider is `env-file`: a secret's value lives in the project `.env` (gitignored) and reaches the container through
|
|
9
|
+
# Docker Compose's own `${NAME}` interpolation, so nothing secret is ever written to a generated, committed file. A required secret
|
|
10
|
+
# uses `${NAME:?message}`, so Compose refuses to start the service when the name is missing; an optional one defaults to empty.
|
|
11
|
+
#
|
|
12
|
+
# `TDK_SECRET_PROVIDER=infisical` leaves the names to Infisical instead, and nothing is injected here.
|
|
13
|
+
# =============================================================================
|
|
14
|
+
|
|
15
|
+
DEFAULT_SECRET_PROVIDER = 'env-file'
|
|
16
|
+
|
|
17
|
+
_NAME_FIRST = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_'
|
|
18
|
+
_NAME_REST = _NAME_FIRST + '0123456789'
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_secret_provider():
|
|
22
|
+
"""The selected provider: `env-file` (default) or `infisical`."""
|
|
23
|
+
provider = str(os.environ.get('TDK_SECRET_PROVIDER', '')).strip().lower()
|
|
24
|
+
return provider if provider else DEFAULT_SECRET_PROVIDER
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _is_valid_env_name(name):
|
|
28
|
+
if type(name) != 'string' or not name:
|
|
29
|
+
return False
|
|
30
|
+
if name[0] not in _NAME_FIRST:
|
|
31
|
+
return False
|
|
32
|
+
for i in range(len(name)):
|
|
33
|
+
if name[i] not in _NAME_REST:
|
|
34
|
+
return False
|
|
35
|
+
return True
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _names(manifest, resource_name, kind):
|
|
39
|
+
secrets = manifest.get('secrets') or {}
|
|
40
|
+
names = secrets.get(kind) or []
|
|
41
|
+
if type(names) != 'list':
|
|
42
|
+
fail("{}: secrets.{} must be a list of environment variable names".format(resource_name, kind))
|
|
43
|
+
for name in names:
|
|
44
|
+
if not _is_valid_env_name(name):
|
|
45
|
+
fail("{}: invalid secret name '{}' in secrets.{}: use letters, digits and underscores, not starting with a digit".format(resource_name, name, kind))
|
|
46
|
+
return names
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def get_secret_environment_lines(manifest, resource_name):
|
|
50
|
+
"""Compose `environment:` list lines (each starting with a newline) for a resource's secrets, or '' when there are none.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
manifest: The service manifest (reads secrets.required and secrets.optional)
|
|
54
|
+
resource_name: Used in error messages and in the text Compose shows for a missing required secret
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
str: Lines to append to the Compose environment block
|
|
58
|
+
"""
|
|
59
|
+
if not manifest or not manifest.get('secrets'):
|
|
60
|
+
return ''
|
|
61
|
+
|
|
62
|
+
required = _names(manifest, resource_name, 'required')
|
|
63
|
+
optional = _names(manifest, resource_name, 'optional')
|
|
64
|
+
|
|
65
|
+
if get_secret_provider() != DEFAULT_SECRET_PROVIDER:
|
|
66
|
+
return ''
|
|
67
|
+
|
|
68
|
+
lines = ''
|
|
69
|
+
for name in required:
|
|
70
|
+
lines += '\n - {name}=${{{name}:?{name} is required by {resource}. Add it to the project .env}}'.format(name=name, resource=resource_name)
|
|
71
|
+
for name in optional:
|
|
72
|
+
if name not in required:
|
|
73
|
+
lines += '\n - {name}=${{{name}:-}}'.format(name=name)
|
|
74
|
+
return lines
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Copyright (c) 2026 Flisk contributors
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
# =============================================================================
|
|
4
|
+
# 🔐 LOCAL ENVIRONMENT GENERATOR
|
|
5
|
+
# =============================================================================
|
|
6
|
+
# Free-tier service env injection. Premium overlays may replace this module with
|
|
7
|
+
# Infisical-backed secret injection.
|
|
8
|
+
# =============================================================================
|
|
9
|
+
#
|
|
10
|
+
# This module provides:
|
|
11
|
+
# - Environment variable generation for docker-compose/.env injection
|
|
12
|
+
# - No external secret manager required in the public/free engine
|
|
13
|
+
#
|
|
14
|
+
# Usage:
|
|
15
|
+
# load("../secrets/infisical.star", "InfisicalEnv")
|
|
16
|
+
# env_vars = InfisicalEnv.get_for_service("my-service")
|
|
17
|
+
# =============================================================================
|
|
18
|
+
|
|
19
|
+
load("../constants.star", "PlatformDockerConstants")
|
|
20
|
+
|
|
21
|
+
def _get_infisical_base_url():
|
|
22
|
+
"""Get the Infisical base URL."""
|
|
23
|
+
return "http://{}-infisical:8080".format(PlatformDockerConstants.PROJECT_NAME)
|
|
24
|
+
|
|
25
|
+
def get_infisical_environment_vars(as_array=True, resource_name=None, resource_type="backend"):
|
|
26
|
+
"""
|
|
27
|
+
Generate environment variables for local Compose/.env injection.
|
|
28
|
+
|
|
29
|
+
Kept under the historical function name so existing Starlark callers do not
|
|
30
|
+
break. The free engine intentionally avoids Infisical credentials; premium
|
|
31
|
+
overlays can replace this implementation with a real secret-provider bridge.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
as_array: If True, return as YAML array format; else as dict format
|
|
35
|
+
resource_name: Optional service name for service-specific configuration
|
|
36
|
+
resource_type: Service type for path generation
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
String with environment variables in YAML format
|
|
40
|
+
"""
|
|
41
|
+
env = {
|
|
42
|
+
"TDK_SECRET_PROVIDER": "${TDK_SECRET_PROVIDER:-env-file}",
|
|
43
|
+
"TDK_ENV": "${TILT_ENV:-development}",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if resource_name:
|
|
47
|
+
env["TDK_RESOURCE_NAME"] = resource_name
|
|
48
|
+
env["TDK_RESOURCE_TYPE"] = resource_type
|
|
49
|
+
|
|
50
|
+
if as_array:
|
|
51
|
+
lines = []
|
|
52
|
+
for key, value in env.items():
|
|
53
|
+
lines.append(" - {}={}".format(key, value))
|
|
54
|
+
return "\n".join(lines)
|
|
55
|
+
else:
|
|
56
|
+
lines = []
|
|
57
|
+
for key, value in env.items():
|
|
58
|
+
lines.append(" {}: {}".format(key, value))
|
|
59
|
+
return "\n".join(lines)
|
|
60
|
+
|
|
61
|
+
def get_for_service(resource_name, resource_type="backend", as_array=True):
|
|
62
|
+
"""
|
|
63
|
+
Get Infisical environment variables for a specific service.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
resource_name: Name of the service
|
|
67
|
+
resource_type: Type of service
|
|
68
|
+
as_array: Return format (array or dict style)
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
String with environment variables
|
|
72
|
+
"""
|
|
73
|
+
return get_infisical_environment_vars(
|
|
74
|
+
as_array=as_array,
|
|
75
|
+
resource_name=resource_name,
|
|
76
|
+
resource_type=resource_type,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
def get_batch_for_services(resource_configs):
|
|
80
|
+
"""
|
|
81
|
+
Get Infisical environment variables for multiple services.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
resource_configs: List of dicts with 'name' and optional 'type'
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Dict mapping service names to environment variable strings
|
|
88
|
+
"""
|
|
89
|
+
results = {}
|
|
90
|
+
|
|
91
|
+
for config in resource_configs:
|
|
92
|
+
name = config.get("name")
|
|
93
|
+
svc_type = config.get("type", "backend")
|
|
94
|
+
|
|
95
|
+
if name:
|
|
96
|
+
results[name] = get_for_service(name, svc_type)
|
|
97
|
+
|
|
98
|
+
return results
|
|
99
|
+
|
|
100
|
+
# =============================================================================
|
|
101
|
+
# Public API
|
|
102
|
+
# =============================================================================
|
|
103
|
+
|
|
104
|
+
InfisicalEnv = struct(
|
|
105
|
+
get_base_url=_get_infisical_base_url,
|
|
106
|
+
get_infisical_environment_vars=get_infisical_environment_vars,
|
|
107
|
+
get_for_service=get_for_service,
|
|
108
|
+
get_batch_for_services=get_batch_for_services,
|
|
109
|
+
)
|