Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
170 lines (162 loc) · 4.02 KB
/
Copy pathdocker-compose.yml
File metadata and controls
170 lines (162 loc) · 4.02 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
version: '3.8'
services:
# MariaDB Database
db:
image: mariadb:10.11
container_name: huduglue-db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-changeme_root}
MYSQL_DATABASE: ${DB_NAME:-huduglue}
MYSQL_USER: ${DB_USER:-huduglue}
MYSQL_PASSWORD: ${DB_PASSWORD:-changeme}
MYSQL_CHARSET: utf8mb4
MYSQL_COLLATION: utf8mb4_unicode_ci
volumes:
- mariadb_data:/var/lib/mysql
- ./docker/mariadb/conf.d:/etc/mysql/conf.d:ro
networks:
- huduglue-network
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
command: >
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
--max_allowed_packet=256M
--innodb_buffer_pool_size=512M
# Redis Cache (optional - for future use)
redis:
image: redis:7-alpine
container_name: huduglue-redis
restart: unless-stopped
volumes:
- redis_data:/data
networks:
- huduglue-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
command: redis-server --appendonly yes
# HuduGlue Application
web:
build:
context: .
dockerfile: Dockerfile
container_name: huduglue-web
restart: unless-stopped
env_file:
- .env
environment:
- DB_HOST=db
- DB_PORT=3306
- REDIS_URL=redis://redis:6379/0
volumes:
- ./logs:/app/logs
- media_files:/app/media
- static_files:/app/static_collected
ports:
- "${WEB_PORT:-8000}:8000"
networks:
- huduglue-network
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Nginx Reverse Proxy (optional)
nginx:
image: nginx:alpine
container_name: huduglue-nginx
restart: unless-stopped
ports:
- "${NGINX_HTTP_PORT:-80}:80"
- "${NGINX_HTTPS_PORT:-443}:443"
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/conf.d:/etc/nginx/conf.d:ro
- ./docker/nginx/ssl:/etc/nginx/ssl:ro
- static_files:/app/static:ro
- media_files:/app/media:ro
networks:
- huduglue-network
depends_on:
- web
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health/"]
interval: 30s
timeout: 10s
retries: 3
# Celery Worker (for background tasks - optional for future use)
celery:
build:
context: .
dockerfile: Dockerfile
container_name: huduglue-celery
restart: unless-stopped
env_file:
- .env
environment:
- DB_HOST=db
- DB_PORT=3306
- REDIS_URL=redis://redis:6379/0
volumes:
- ./logs:/app/logs
- media_files:/app/media
networks:
- huduglue-network
depends_on:
- db
- redis
- web
command: celery -A config worker -l info
profiles:
- celery
# Celery Beat Scheduler (for periodic tasks - optional for future use)
celery-beat:
build:
context: .
dockerfile: Dockerfile
container_name: huduglue-celery-beat
restart: unless-stopped
env_file:
- .env
environment:
- DB_HOST=db
- DB_PORT=3306
- REDIS_URL=redis://redis:6379/0
volumes:
- ./logs:/app/logs
networks:
- huduglue-network
depends_on:
- db
- redis
- web
command: celery -A config beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
profiles:
- celery
volumes:
mariadb_data:
name: huduglue-mariadb-data
redis_data:
name: huduglue-redis-data
media_files:
name: huduglue-media
static_files:
name: huduglue-static
networks:
huduglue-network:
name: huduglue-network
driver: bridge