New thoughtsync.dbwait polls the DB (SELECT 1) up to 60×1s before startup, logging each attempt, so a briefly slow/unready database no longer crash- loops the container. Wired as `python -m thoughtsync.dbwait &&` ahead of `alembic upgrade head` in the image CMD and the dev compose command; exits non-zero after the window so a restart policy can take over. Prod compose gains restart: unless-stopped as the complementary piece. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
36 lines
908 B
YAML
36 lines
908 B
YAML
# Local two-service stack (app + Postgres). Provided for convenience — per family
|
|
# rule 12 the agent does NOT start this; run it yourself with `docker compose up`.
|
|
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: thoughtsync
|
|
POSTGRES_PASSWORD: thoughtsync
|
|
POSTGRES_DB: thoughtsync
|
|
volumes:
|
|
- thoughtsync-db:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U thoughtsync"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
app:
|
|
build: .
|
|
restart: unless-stopped
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
THOUGHTSYNC_DATABASE_URL: postgresql+asyncpg://thoughtsync:thoughtsync@db:5432/thoughtsync
|
|
volumes:
|
|
- thoughtsync-data:/var/thoughtsync
|
|
ports:
|
|
- "5000:5000"
|
|
|
|
volumes:
|
|
thoughtsync-db:
|
|
thoughtsync-data:
|