-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.production.yml
More file actions
150 lines (141 loc) · 4.46 KB
/
docker-compose.production.yml
File metadata and controls
150 lines (141 loc) · 4.46 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
138
139
140
141
142
143
144
145
146
147
148
149
150
version: "3.8"
# MultiWA Production Stack
# Usage: docker compose -f docker-compose.production.yml up -d
# Ensure .env.production exists alongside this file
services:
# ─── Database ───────────────────────────────────
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER:-multiwa}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME:-multiwa}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-multiwa}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- internal
# ─── Cache / Queue ──────────────────────────────
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD} --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- internal
# ─── Object Storage ─────────────────────────────
minio:
image: minio/minio:latest
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${S3_ACCESS_KEY}
MINIO_ROOT_PASSWORD: ${S3_SECRET_KEY}
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 30s
timeout: 10s
retries: 3
networks:
- internal
# ─── API Server ─────────────────────────────────
api:
build:
context: .
dockerfile: docker/Dockerfile.api
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
environment:
NODE_ENV: production
DATABASE_URL: postgresql://${DB_USER:-multiwa}:${DB_PASSWORD}@postgres:5432/${DB_NAME:-multiwa}
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379
API_PORT: 3000
API_HOST: 0.0.0.0
JWT_SECRET: ${JWT_SECRET}
JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET}
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
ADMIN_URL: ${ADMIN_URL:-https://wa.yourdomain.com}
S3_ENDPOINT: http://minio:9000
S3_PORT: 9000
S3_USE_SSL: "false"
S3_ACCESS_KEY: ${S3_ACCESS_KEY}
S3_SECRET_KEY: ${S3_SECRET_KEY}
S3_BUCKET: ${S3_BUCKET:-multiwa}
S3_REGION: ${S3_REGION:-us-east-1}
WHATSAPP_ENGINE: ${WHATSAPP_ENGINE:-whatsapp-web.js}
CHROMIUM_PATH: /usr/bin/chromium
volumes:
- wa_sessions:/app/.wwebjs_auth
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://localhost:3000/api/v1/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
- internal
# ─── Admin Dashboard ────────────────────────────
admin:
build:
context: .
dockerfile: docker/Dockerfile.admin
args:
NEXT_PUBLIC_API_URL: ${API_URL:-https://api.yourdomain.com}
restart: unless-stopped
depends_on:
api:
condition: service_started
environment:
NODE_ENV: production
NEXT_PUBLIC_API_URL: ${API_URL:-https://api.yourdomain.com}
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://localhost:3001').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 30s
timeout: 10s
retries: 3
networks:
- internal
# ─── Reverse Proxy ──────────────────────────────
nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/ssl:/etc/nginx/ssl:ro
depends_on:
api:
condition: service_started
admin:
condition: service_started
networks:
- internal
volumes:
postgres_data:
redis_data:
minio_data:
wa_sessions:
networks:
internal:
driver: bridge