Set busy_timeout before journal_mode=WAL in db.ts so SQLite retries for 10s instead of failing immediately with the default 0ms timeout. Extract migration into a dedicated Docker Compose service so both jetstream and api wait for it to complete before opening the database.
38 lines
785 B
YAML
38 lines
785 B
YAML
services:
|
|
migrate:
|
|
build: .
|
|
command: ["deno", "task", "migrate"]
|
|
volumes:
|
|
- ${DATA_VOLUME:-data}:/data
|
|
|
|
jetstream:
|
|
build: .
|
|
restart: unless-stopped
|
|
command: ["deno", "task", "jetstream:prod"]
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
volumes:
|
|
- ${DATA_VOLUME:-data}:/data
|
|
|
|
api:
|
|
build: .
|
|
restart: unless-stopped
|
|
command: ["deno", "task", "server:prod"]
|
|
depends_on:
|
|
migrate:
|
|
condition: service_completed_successfully
|
|
expose:
|
|
- "8080"
|
|
volumes:
|
|
- ${DATA_VOLUME:-data}:/data
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 10m
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 15s
|
|
|
|
volumes:
|
|
data:
|