-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
126 lines (121 loc) · 3.45 KB
/
docker-compose.prod.yml
File metadata and controls
126 lines (121 loc) · 3.45 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
version: "3.9"
# =============================================================================
# Production Docker Compose Override
# =============================================================================
# This file provides production-specific configuration that overrides the
# base docker-compose.yml settings.
#
# Usage:
# docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
#
# Or set via environment:
# export COMPOSE_FILE=docker-compose.yml:docker-compose.prod.yml
# docker-compose up -d
#
# This file should be used for:
# - Railway deployments
# - Production environments
# - Staging environments
# =============================================================================
services:
postgres:
# Production PostgreSQL configuration
environment:
# Use strong passwords from environment/secrets
POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme}
volumes:
# Use named volume for data persistence
- pgdata-prod:/var/lib/postgresql/data
# Remove port exposure in production (internal only)
ports: []
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
deploy:
resources:
limits:
cpus: "2.0"
memory: 2G
reservations:
cpus: "1.0"
memory: 1G
api:
# Production API service configuration
environment:
# Production environment settings
- ENVIRONMENT=prod
- DEBUG=False
- LOG_LEVEL=20
- SERVER_HTTP_WORKERS=${SERVER_HTTP_WORKERS:-4}
- DB_POOL_DISABLE=False
- DB_URL=${DB_URL}
- SECRET_KEY=${SECRET_KEY}
- GITHUB_APP_ID=${GITHUB_APP_ID}
- GITHUB_APP_PRIVATE_KEY=${GITHUB_APP_PRIVATE_KEY}
- GITHUB_APP_CLIENT_ID=${GITHUB_APP_CLIENT_ID}
- GITHUB_APP_CLIENT_SECRET=${GITHUB_APP_CLIENT_SECRET}
# Remove volume mounts (no hot-reload in production)
volumes: []
# Production command without reload
command:
sh -c "alembic upgrade head && uvicorn byte_api.app:create_app --factory --host 0.0.0.0 --port 8000 --workers
${SERVER_HTTP_WORKERS:-4}"
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
deploy:
resources:
limits:
cpus: "2.0"
memory: 2G
reservations:
cpus: "0.5"
memory: 512M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
bot:
# Production bot service configuration
environment:
# Production environment settings
- DISCORD_TOKEN=${DISCORD_TOKEN}
- DISCORD_DEV_GUILD_ID=${DISCORD_DEV_GUILD_ID:-}
- DISCORD_DEV_USER_ID=${DISCORD_DEV_USER_ID:-}
- API_SERVICE_URL=http://api:8000
- ENVIRONMENT=prod
- LOG_LEVEL=20
# Remove volume mounts (no hot-reload in production)
volumes: []
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
deploy:
resources:
limits:
cpus: "1.0"
memory: 1G
reservations:
cpus: "0.25"
memory: 256M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
volumes:
pgdata-prod:
driver: local
driver_opts:
type: none
o: bind
# Bind to persistent storage location
# Update this path based on your deployment environment
device: /var/lib/byte/postgres-data