@webjsdev/cli 0.10.2 → 0.10.3
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 +1 -1
- package/templates/AGENTS.md +11 -6
- package/templates/Dockerfile +11 -0
- package/templates/compose.yaml +8 -0
package/package.json
CHANGED
package/templates/AGENTS.md
CHANGED
|
@@ -318,12 +318,17 @@ Fully warm means the deterministic analysis AND the first vendor attempt have
|
|
|
318
318
|
both completed, so the importmap and its build id are settled. Point your
|
|
319
319
|
platform's readiness check at `/__webjs/ready` so it holds traffic off a
|
|
320
320
|
not-yet-warmed instance instead of routing the first user request into the cold
|
|
321
|
-
analysis or the brief window where the importmap is still resolving.
|
|
322
|
-
|
|
323
|
-
`
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
analysis or the brief window where the importmap is still resolving. The
|
|
322
|
+
scaffolded `Dockerfile` and `compose.yaml` already wire this up with a
|
|
323
|
+
`HEALTHCHECK` that probes `/__webjs/ready`, so any Docker-based deploy gets the
|
|
324
|
+
gate with no extra config. On a platform that reads its own config instead,
|
|
325
|
+
point its equivalent knob at the same path: Railway `"healthcheckPath":
|
|
326
|
+
"/__webjs/ready"`, Render `healthCheckPath: /__webjs/ready`, Fly a
|
|
327
|
+
`[[http_service.checks]]` on `/__webjs/ready`, or a Kubernetes `readinessProbe`
|
|
328
|
+
with `httpGet.path: /__webjs/ready`. For dependency-aware readiness (gate on a
|
|
329
|
+
live DB ping), add an optional `readiness.{js,ts}` at the app root that
|
|
330
|
+
default-exports an async check; `/__webjs/ready` runs it once warm and reports
|
|
331
|
+
503 if it returns `false` or throws.
|
|
327
332
|
|
|
328
333
|
Scripts:
|
|
329
334
|
|
package/templates/Dockerfile
CHANGED
|
@@ -33,6 +33,17 @@ ENV NODE_ENV=production
|
|
|
33
33
|
ENV PORT=8080
|
|
34
34
|
EXPOSE 8080
|
|
35
35
|
|
|
36
|
+
# Platform-neutral readiness gate. webjs answers /__webjs/ready with 503 until
|
|
37
|
+
# the instance is fully warm (analysis + first vendor attempt), then 200. This
|
|
38
|
+
# HEALTHCHECK is honoured by Docker, compose, and most Docker-based platforms,
|
|
39
|
+
# so the gate works the same everywhere instead of needing a per-platform file.
|
|
40
|
+
# The probe is dependency-free (Node 24's built-in fetch, no curl/wget). For
|
|
41
|
+
# platforms that read their own config, point the equivalent knob at the same
|
|
42
|
+
# path (Railway healthcheckPath, Render healthCheckPath, Fly [checks], k8s
|
|
43
|
+
# readinessProbe); see AGENTS.md "Health and readiness probes".
|
|
44
|
+
HEALTHCHECK --interval=15s --timeout=3s --start-period=40s --retries=5 \
|
|
45
|
+
CMD ["node", "-e", "fetch('http://127.0.0.1:'+(process.env.PORT||8080)+'/__webjs/ready').then(r=>process.exit(r.ok?0:1),()=>process.exit(1))"]
|
|
46
|
+
|
|
36
47
|
# `npm start` runs `prestart: prisma migrate deploy` (idempotent, a no-op when
|
|
37
48
|
# there are no migrations yet) and then `webjs start`, which serves on $PORT.
|
|
38
49
|
CMD ["npm", "start"]
|
package/templates/compose.yaml
CHANGED
|
@@ -23,6 +23,14 @@ services:
|
|
|
23
23
|
# REDIS_URL: redis://redis:6379
|
|
24
24
|
volumes:
|
|
25
25
|
- app-data:/data
|
|
26
|
+
# Readiness gate: hold the service "starting" until /__webjs/ready returns
|
|
27
|
+
# 200 (fully warm). Same probe as the Dockerfile HEALTHCHECK; dependency-free.
|
|
28
|
+
healthcheck:
|
|
29
|
+
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:'+(process.env.PORT||8080)+'/__webjs/ready').then(r=>process.exit(r.ok?0:1),()=>process.exit(1))"]
|
|
30
|
+
interval: 15s
|
|
31
|
+
timeout: 3s
|
|
32
|
+
start_period: 40s
|
|
33
|
+
retries: 5
|
|
26
34
|
|
|
27
35
|
volumes:
|
|
28
36
|
app-data:
|