forked from quantified-uncertainty/roast-my-post
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
137 lines (125 loc) · 3.71 KB
/
Copy pathdocker-compose.yml
File metadata and controls
137 lines (125 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: roastmypost-db
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: roastmypost
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# Next.js Web Application
web:
build:
context: .
dockerfile: Dockerfile
container_name: roastmypost-web
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
# Database
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/roastmypost?schema=public
# NextAuth (generate your own secrets for production!)
NEXTAUTH_URL: http://localhost:3000
AUTH_SECRET: development-secret-change-in-production
# AI/LLM Keys (add your actual keys)
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
# Email (for authentication)
EMAIL_FROM: ${EMAIL_FROM:-noreply@localhost}
# Node settings
NODE_ENV: production
NODE_OPTIONS: "--max-old-space-size=1024"
ports:
- "3000:3000"
# volumes:
# # Mount for hot reload in development (optional)
# # - ./src:/app/src
# # - ./public:/app/public
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/api/health', (res) => res.statusCode === 200 ? process.exit(0) : process.exit(1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Background Worker Process
worker:
build:
context: .
dockerfile: Dockerfile.worker
container_name: roastmypost-worker
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
command: ["pnpm", "--filter", "@roast/web", "run", "process-jobs-adaptive"]
environment:
# Same environment as web service
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/roastmypost?schema=public
AUTH_SECRET: development-secret-change-in-production
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
NODE_ENV: production
# Worker-specific settings
WORKER_CONCURRENCY: 2
JOB_BATCH_SIZE: 10
JOB_RETRY_ATTEMPTS: 3
# Database migrations (one-time runner)
migrate:
build:
context: .
dockerfile: Dockerfile.worker
container_name: roastmypost-migrate
depends_on:
postgres:
condition: service_healthy
command: ["pnpm", "--filter", "@roast/db", "run", "db:migrate:deploy"]
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/roastmypost?schema=public
restart: "no"
# Optional: pgAdmin for database management
pgadmin:
image: dpage/pgadmin4:latest
container_name: roastmypost-pgadmin
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: admin@localhost
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_CONFIG_SERVER_MODE: 'False'
ports:
- "5050:80"
depends_on:
- postgres
profiles:
- debug
# Optional: Redis for caching/sessions (uncomment if needed)
# redis:
# image: redis:7-alpine
# container_name: roastmypost-redis
# restart: unless-stopped
# ports:
# - "6379:6379"
# volumes:
# - redis_data:/data
# healthcheck:
# test: ["CMD", "redis-cli", "ping"]
# interval: 10s
# timeout: 5s
# retries: 5
volumes:
postgres_data:
# redis_data:
networks:
default:
name: roastmypost-network