forked from xprilion/OpenMLR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
118 lines (112 loc) · 2.9 KB
/
docker-compose.prod.yml
File metadata and controls
118 lines (112 loc) · 2.9 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
# OpenMLR - Production Docker Compose
# Docs: https://openmlr.dev/setup
#
# Usage:
# make up # Start production stack
# make logs # Watch logs
# make down # Stop services
#
# Uses pre-built images from Docker Hub (xprilion/openmlr:latest)
services:
# PostgreSQL database
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-openmlr}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-openmlr}
POSTGRES_DB: ${POSTGRES_DB:-openmlr}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "127.0.0.1:5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-openmlr}"]
interval: 5s
timeout: 5s
retries: 5
security_opt:
- no-new-privileges:true
restart: unless-stopped
# Redis for Celery broker and pub/sub
redis:
image: redis:7-alpine
ports:
- "127.0.0.1:6380:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
security_opt:
- no-new-privileges:true
restart: unless-stopped
# Main web application
web:
image: xprilion/openmlr:latest
build: .
ports:
- "3000:3000"
env_file:
- path: .env
required: false
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-openmlr}:${POSTGRES_PASSWORD:-openmlr}@db:5432/${POSTGRES_DB:-openmlr}
REDIS_URL: redis://redis:6379/0
USE_BACKGROUND_JOBS: "true"
USE_REDIS_PUBSUB: "true"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./backend/configs:/app/backend/configs
- ./.keys:/app/.keys
security_opt:
- no-new-privileges:true
restart: unless-stopped
# Celery worker for background jobs
worker:
image: xprilion/openmlr:latest
build: .
command: >
.venv/bin/celery -A openmlr.celery_app worker
--loglevel=info
--concurrency=2
-Q default,agent
working_dir: /app/backend
env_file:
- path: .env
required: false
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-openmlr}:${POSTGRES_PASSWORD:-openmlr}@db:5432/${POSTGRES_DB:-openmlr}
REDIS_URL: redis://redis:6379/0
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./backend/configs:/app/backend/configs
- ./.keys:/app/.keys
security_opt:
- no-new-privileges:true
restart: unless-stopped
# Documentation site (optional)
docs:
image: node:20-slim
working_dir: /app/site
command: sh -c "npm install && npm run dev -- --host 0.0.0.0 --port 4000"
ports:
- "127.0.0.1:4000:4000"
volumes:
- ./site:/app/site
profiles:
- docs
security_opt:
- no-new-privileges:true
volumes:
pgdata:
redisdata: