- Replace primaryKey constraints with uniqueIndex where needed - Fix schema for Auth, Contacts, Exchange Rates, Expense Participants, and Accounts tables - Add missing import for uniqueIndex - Switch from postgres.js to node-postgres (pg) for Drizzle - Add proper type safety with TypeScript - Add graceful shutdown of database connections
74 lines
1.6 KiB
YAML
74 lines
1.6 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL database
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: splitwise-postgres
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: splitwise
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Database migration service
|
|
migration:
|
|
build:
|
|
context: ./backend
|
|
target: migration
|
|
container_name: splitwise-migration
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
DATABASE_URL: postgres://postgres:postgres@postgres:5432/splitwise
|
|
profiles:
|
|
- migration
|
|
|
|
# Drizzle Studio for database management
|
|
drizzle-studio:
|
|
build:
|
|
context: ./backend
|
|
target: development
|
|
container_name: splitwise-drizzle-studio
|
|
command: bun run db:studio
|
|
ports:
|
|
- "4000:4000"
|
|
environment:
|
|
DATABASE_URL: postgres://postgres:postgres@postgres:5432/splitwise
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
profiles:
|
|
- studio
|
|
|
|
# Backend service
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
target: development
|
|
container_name: splitwise-backend
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- ./backend:/app
|
|
- /app/node_modules
|
|
environment:
|
|
DATABASE_URL: postgres://postgres:postgres@postgres:5432/splitwise
|
|
PORT: 3000
|
|
NODE_ENV: development
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres-data: |