@tdk-landscape/tdk-cli-core 1.3.121 → 1.3.123

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +13 -8
  3. package/cli/dist/cli.js +1 -1
  4. package/cli/dist/commands/doctor.js +64 -7
  5. package/cli/dist/commands/help.js +17 -1
  6. package/cli/dist/commands/logs.js +28 -7
  7. package/cli/dist/commands/stack.js +94 -22
  8. package/cli/dist/commands/ui.js +81 -6
  9. package/cli/dist/commands/up.js +17 -3
  10. package/cli/dist/components/TabBar.js +3 -2
  11. package/cli/dist/generator/__tests__/golden-helpers.js +42 -0
  12. package/cli/dist/generator/template-engine.js +1 -1
  13. package/cli/dist/utils/bun-floor.js +8 -0
  14. package/cli/dist/utils/cold-preflight.js +6 -4
  15. package/cli/dist/utils/doctor-runtime.js +4 -1
  16. package/cli/dist/utils/doctor-wiring.js +62 -1
  17. package/cli/dist/utils/host-port-plan.js +3 -0
  18. package/cli/dist/utils/port-conflict-fix.js +24 -0
  19. package/cli/dist/utils/port-listener-probe.js +19 -0
  20. package/cli/dist/utils/secret-redaction.js +55 -0
  21. package/cli/dist/utils/service-config-checks.js +188 -0
  22. package/cli/dist/utils/startup-report.js +6 -1
  23. package/cli/dist/utils/tilt-events.js +195 -0
  24. package/cli/dist/utils/tilt-unreachable-message.js +8 -0
  25. package/cli/package.json +1 -1
  26. package/cli/templates/TILT_TECH_STACK.star.hbs +4 -4
  27. package/engine/topologies/platform/docker/compose/compose.star +1 -86
  28. package/engine/topologies/platform/docker/compose/traefik_standalone.star +4 -4
  29. package/engine/topologies/platform/docker/networking/traefik.star +40 -7
  30. package/engine/topologies/platform/docker/networking/traefik_helpers.star +1 -1
  31. package/engine/topologies/tilt/resources/infra-loader.star +3 -2
  32. package/engine/topologies/tilt/resources/orchestrator/apply_compose_resource_registration.star +20 -0
  33. package/package.json +1 -1
@@ -64,7 +64,7 @@ def frontend_rule(res_name, base_path, traefik_host):
64
64
 
65
65
  def backend_rule(traefik_host, traefik_path):
66
66
  parts = []
67
- if TRAEFIK_ENABLE_BACKEND_HOST_RULE:
67
+ if TRAEFIK_ENABLE_BACKEND_HOST_RULE and traefik_host:
68
68
  parts.append("Host(`{host}`)".format(host=traefik_host))
69
69
  if TRAEFIK_ENABLE_BACKEND_PATH_RULE and traefik_path:
70
70
  parts.append("PathPrefix(`{path}`)".format(path=traefik_path))
@@ -70,7 +70,7 @@ services:
70
70
  POSTGRES_PASSWORD: ${{DB_PASSWORD}}
71
71
  POSTGRES_DB: postgres
72
72
  ports:
73
- - "{host_port}:5432"
73
+ - "{bind_address}:{host_port}:5432"
74
74
  volumes:
75
75
  - {name}_postgres_data:/var/lib/postgresql/data
76
76
  networks:
@@ -88,7 +88,7 @@ networks:
88
88
 
89
89
  volumes:
90
90
  {name}_postgres_data:
91
- """.format(name=name, database_network=database_network, host_port=os.environ.get('TDK_POSTGRES_PORT', '15432'))
91
+ """.format(name=name, database_network=database_network, host_port=os.environ.get('TDK_POSTGRES_PORT', '15432'), bind_address=os.environ.get('TDK_BIND_ADDRESS', '127.0.0.1'))
92
92
 
93
93
 
94
94
  def _ensure_database_management_compose(root_prefix, write_fn):
@@ -236,6 +236,7 @@ def _load_standalone_traefik(root_prefix, env_file, write_fn):
236
236
  sablier_enabled,
237
237
  os.environ.get('TDK_HTTP_PORT', '8080'),
238
238
  os.environ.get('TDK_HTTPS_PORT', '8443'),
239
+ os.environ.get('TDK_BIND_ADDRESS', '127.0.0.1'),
239
240
  )
240
241
  if write_fn:
241
242
  write_fn(compose_rel, content)
@@ -632,6 +632,21 @@ def _build_resource_config(res, manifest, resource_config, full_res_path, infra_
632
632
  }
633
633
 
634
634
 
635
+ def count_routable_backends_by_stack(resource_config, resource_manifests, default_stack):
636
+ """Count the backends of each stack that get a Traefik route (workers, frontends, SDKs, libraries and unproxied BYO do not)."""
637
+ counts = {}
638
+ for resource in resource_config.get('resources', []):
639
+ manifest = resource_manifests.get(resource['name'], {})
640
+ app_type = manifest.get('appType', 'backend')
641
+ if resource.get('frontend', False) or app_type in ['frontend', 'worker', 'library', 'sdk', 'infra']:
642
+ continue
643
+ if app_type == 'bring-your-own' and not manifest.get('exposeViaProxy', True):
644
+ continue
645
+ stack = manifest.get('stack', default_stack)
646
+ counts[stack] = counts.get(stack, 0) + 1
647
+ return counts
648
+
649
+
635
650
  def register_compose_resources(resource_config, ctx, runtime_flags, manifest_state):
636
651
  """Register all compose resources for a service."""
637
652
  resource_name = resource_config.get('name', '')
@@ -695,6 +710,7 @@ def register_compose_resources(resource_config, ctx, runtime_flags, manifest_sta
695
710
 
696
711
  resource_entries = []
697
712
  resource_configs = []
713
+ stack_backend_counts = count_routable_backends_by_stack(resource_config, resource_manifests, resource_name)
698
714
 
699
715
  for res in resource_config.get('resources', []):
700
716
  if _should_skip_frontend(res, should_enable):
@@ -702,6 +718,10 @@ def register_compose_resources(resource_config, ctx, runtime_flags, manifest_sta
702
718
 
703
719
  full_res_path = res.get('_resource_path', resource_path + '/' + res['name'])
704
720
  manifest = resource_manifests.get(res['name'], {})
721
+ if manifest:
722
+ # Tell the Traefik label generator how many routable backends share this stack (see _stack_is_shared in networking/traefik.star).
723
+ manifest = dict(manifest)
724
+ manifest['_stackBackendCount'] = stack_backend_counts.get(manifest.get('stack', resource_name), 1)
705
725
 
706
726
  # Skip non-app resources - they don't use the golden app Dockerfile pipeline.
707
727
  # infra (e.g. verdaccio) is loaded via registries/verdaccio_loader.star instead.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tdk-landscape/tdk-cli-core",
3
- "version": "1.3.121",
3
+ "version": "1.3.123",
4
4
  "description": "TDK CLI — start services on your laptop.",
5
5
  "homepage": "https://tdk-landscape.github.io/tdk-website",
6
6
  "repository": {