create-svc 0.1.84 → 0.1.85

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-svc",
3
- "version": "0.1.84",
3
+ "version": "0.1.85",
4
4
  "description": "Local microservice bootstrap CLI for Cloud Run and Workers services with Neon-backed data.",
5
5
  "module": "index.ts",
6
6
  "type": "module",
@@ -71,6 +71,7 @@ test("scaffolds all runtime/framework variants with shared cloudrun config", asy
71
71
  expect(serviceConfig).toContain('"project_mode": "create_new"');
72
72
  expect(serviceConfig).toContain('"quota_project_id": "anmho-infra-prod"');
73
73
  expect(serviceConfig).toContain('"artifact_repository": "cloud-run"');
74
+ expect(serviceConfig).toContain('"worker_min_instances": 0');
74
75
  expect(serviceConfig).not.toContain("cloudbuild.googleapis.com");
75
76
  expect(serviceConfig).toContain('"jwks_url": "https://auth.anmho.com/api/auth/jwks"');
76
77
  expect(serviceConfig).toContain('"git": {');
@@ -97,6 +98,7 @@ test("scaffolds all runtime/framework variants with shared cloudrun config", asy
97
98
  expect(manifest).toContain("${AUTH_AUDIENCE}");
98
99
  expect(manifest).toContain("managed_by: create-service");
99
100
  expect(manifest).toContain("service_id: ${SERVICE_ID}");
101
+ expect(manifest).toContain('autoscaling.knative.dev/minScale: "${SERVICE_MIN_SCALE}"');
100
102
  expect(manifest).not.toContain("CLERK_SECRET_KEY");
101
103
  expect(manifest).not.toContain("STRIPE_SECRET_KEY");
102
104
  expect(manifest).not.toContain("REVENUECAT_API_KEY");
@@ -14,6 +14,7 @@ export const config = {
14
14
  region: cloudrun.region,
15
15
  artifactRepository: cloudrun.artifact_repository,
16
16
  runtimeServiceAccount: cloudrun.service_account,
17
+ workerMinInstances: Number(cloudrun.worker_min_instances ?? 0),
17
18
  project: {
18
19
  mode: cloudrun.project_mode,
19
20
  id: cloudrun.project_id,
@@ -518,6 +518,7 @@ export async function renderManifest(image: string, target: DeploymentTarget, pr
518
518
  SERVICE_ID: config.serviceName,
519
519
  SERVICE_ROLE: process,
520
520
  SERVICE_INGRESS: process === "worker" ? "internal" : "all",
521
+ SERVICE_MIN_SCALE: process === "worker" ? String(config.workerMinInstances) : "0",
521
522
  CONTAINER_COMMAND: renderContainerCommand(process),
522
523
  RUNTIME_SERVICE_ACCOUNT: config.runtimeServiceAccount,
523
524
  IMAGE_URL: image,
@@ -88,6 +88,11 @@ with real connection settings before the worker can run:
88
88
  - `TEMPORAL_NAMESPACE`
89
89
  - any TLS certificate/key or API-key settings used by your worker code
90
90
 
91
+ Cloud Run worker min instances are controlled by
92
+ `cloudrun.worker_min_instances` in `service.jsonc`. The generated default is
93
+ `0`; set it to `1` for production services that must keep a Temporal poller
94
+ warm for scheduled workflows.
95
+
91
96
  If a service does not need Temporal, opt out with:
92
97
 
93
98
  ```bash
@@ -107,6 +107,7 @@
107
107
  "region": "{{REGION}}",
108
108
  "artifact_repository": "cloud-run",
109
109
  "service_account": "{{RUNTIME_SERVICE_ACCOUNT}}",
110
+ "worker_min_instances": 0,
110
111
  "required_apis": [
111
112
  "run.googleapis.com",
112
113
  "artifactregistry.googleapis.com",
@@ -15,6 +15,8 @@ spec:
15
15
  managed_by: create-service
16
16
  service_id: ${SERVICE_ID}
17
17
  service_role: ${SERVICE_ROLE}
18
+ annotations:
19
+ autoscaling.knative.dev/minScale: "${SERVICE_MIN_SCALE}"
18
20
  spec:
19
21
  serviceAccountName: ${RUNTIME_SERVICE_ACCOUNT}
20
22
  containers: