-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
102 lines (93 loc) · 2.44 KB
/
docker-compose.yml
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
version: '3.8'
services:
# Application
app:
build:
context: .
dockerfile: docker/app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
depends_on:
- "database"
deploy:
mode: replicated
replicas: 2
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
# DB Balancer
db_balancer:
image: nginx:1.21
working_dir: /var/www
volumes:
- ./:/var/www
- ./docker/nginx/db_balancer.conf:/etc/nginx/conf.d/default.conf
- ./docker/nginx/db_balancer/logs/:/var/log/nginx/
depends_on:
- "app"
ports:
- "80"
# Web Server
web:
image: nginx:1.21
working_dir: /var/www
volumes:
- ./:/var/www
- ./docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- ./docker/nginx/logs/:/var/log/nginx/
depends_on:
- "app"
deploy:
mode: replicated
replicas: 2
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
# Web Balancer
web_balancer:
image: nginx:1.21
working_dir: /var/www
volumes:
- ./:/var/www
- ./docker/nginx/web_balancer.conf:/etc/nginx/conf.d/default.conf
- ./docker/nginx/web_balancer/logs/:/var/log/nginx/
depends_on:
- "web"
ports:
- "80"
# Database
database:
image: mysql:8.0
volumes:
- dbdata:/var/lib/mysql
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_USER: ${DB_USERNAME}
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
ports:
- "3306"
# Database management
pma:
image: phpmyadmin:5.1
environment:
PMA_HOST: database
PMA_PORT: ${DB_PORT}
depends_on:
- database
ports:
- "80"
volumes:
dbdata: