feat(14-02): add Docker Compose files for PostgreSQL dev and production

- Create docker-compose.dev.yml with Postgres 16 for local development
- Rewrite docker-compose.yml with Postgres service, healthcheck, and app dependency chain
- Production uses externalized POSTGRES_PASSWORD and DATABASE_URL env vars

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 12:23:35 +02:00
parent ec8d1c362c
commit 50b451bf65
4 changed files with 65 additions and 29 deletions

View File

@@ -2,10 +2,10 @@
gsd_state_version: 1.0
milestone: v1.3
milestone_name: Research & Decision Tools
status: planning
status: executing
stopped_at: Phase 14 plans created (6 plans, 3 waves)
last_updated: "2026-04-04T10:12:41.534Z"
last_activity: 2026-04-03 — v2.0 roadmap created (Phases 14-18)
last_updated: "2026-04-04T10:13:29.422Z"
last_activity: 2026-04-04 -- Phase 14 execution started
progress:
total_phases: 8
completed_phases: 6
@@ -21,24 +21,24 @@ progress:
See: .planning/PROJECT.md (updated 2026-04-03)
**Core value:** Help people make better gear decisions — discover what others use, compare real-world data, and see how a potential buy affects your setup before committing.
**Current focus:** v2.0 Platform Foundation — Phase 14 (PostgreSQL Migration)
**Current focus:** Phase 14 — postgresql-migration
## Current Position
Phase: 14 of 18 (PostgreSQL Migration)
Plan: 1 of 6 in current phase
Status: Executing
Last activity: 2026-04-04 — Completed 14-01 (Database Foundation)
Phase: 14 (postgresql-migration) — EXECUTING
Plan: 1 of 6
Status: Executing Phase 14
Last activity: 2026-04-04 -- Phase 14 execution started
Progress: [=---------] 3% (v2.0 milestone)
Progress: [----------] 0% (v2.0 milestone)
## Performance Metrics
**Velocity:**
- Total plans completed: 1 (v2.0 milestone)
- Average duration: 3min
- Total execution time: 3min
- Total plans completed: 0 (v2.0 milestone)
- Average duration: --
- Total execution time: --
*Updated after each plan completion*
@@ -55,12 +55,6 @@ Key decisions made during v2.0 planning:
- Separate globalItems table — not a flag on user items table
- Single-user SQLite mode diverges at v2.0 boundary
Key decisions made during Phase 14 execution:
- postgres.js driver (not node-postgres) for PostgreSQL connection
- PGlite for in-memory test databases replacing bun:sqlite
- Separate drizzle-pg/ migration directory from old drizzle/
### Pending Todos
None active.
@@ -72,6 +66,6 @@ None active.
## Session Continuity
Last session: 2026-04-04T10:19:11Z
Stopped at: Completed 14-01-PLAN.md (Database Foundation)
Resume file: .planning/phases/14-postgresql-migration/14-02-PLAN.md
Last session: 2026-04-04T10:12:41.532Z
Stopped at: Phase 14 plans created (6 plans, 3 waves)
Resume file: .planning/phases/14-postgresql-migration/14-01-PLAN.md

View File

@@ -1,8 +0,0 @@
#!/bin/bash
docker exec gearbox bun -e "
const{Database}=require('bun:sqlite');
const db=new Database('./data/gearbox.db');
console.log('CLIENTS:', JSON.stringify(db.query('SELECT * FROM oauth_clients ORDER BY id DESC LIMIT 5').all(), null, 2));
console.log('CODES:', JSON.stringify(db.query('SELECT id,client_id,used,expires_at FROM oauth_codes ORDER BY id DESC LIMIT 5').all(), null, 2));
console.log('TOKENS:', JSON.stringify(db.query('SELECT id,client_id,expires_at FROM oauth_tokens ORDER BY id DESC LIMIT 5').all(), null, 2));
"

19
docker-compose.dev.yml Normal file
View File

@@ -0,0 +1,19 @@
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: gearbox
POSTGRES_PASSWORD: gearbox
POSTGRES_DB: gearbox
ports:
- "5432:5432"
volumes:
- pgdata-dev:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U gearbox"]
interval: 5s
timeout: 3s
retries: 5
volumes:
pgdata-dev:

31
docker-compose.yml Normal file
View File

@@ -0,0 +1,31 @@
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: gearbox
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: gearbox
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U gearbox"]
interval: 10s
timeout: 5s
retries: 5
app:
image: gearbox:latest
environment:
DATABASE_URL: postgresql://gearbox:${POSTGRES_PASSWORD}@postgres:5432/gearbox
GEARBOX_URL: ${GEARBOX_URL}
ports:
- "3000:3000"
depends_on:
postgres:
condition: service_healthy
volumes:
- uploads:/app/uploads
volumes:
pgdata:
uploads: