-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-stack.yml
93 lines (86 loc) · 1.96 KB
/
docker-stack.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
version: "3.9"
services:
# MariaDB Galera Cluster
wpdbcluster:
image: mariadb:10.11
networks:
- backend
deploy:
mode: global
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
environment:
MYSQL_ROOT_PASSWORD: ChangeME
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: ChangeME
volumes:
- ./mariadb-init:/docker-entrypoint-initdb.d
command: --wsrep-new-cluster --wsrep-cluster-address=gcomm://
# WordPress service
wordpress:
image: wordpress:6.2
networks:
- backend
- frontend
deploy:
replicas: 2
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
labels:
- traefik.enable=true
- traefik.http.routers.wordpress.rule=Host(`wordpress.example.com`)
- traefik.http.services.wordpress.loadbalancer.server.port=80
environment:
WORDPRESS_DB_HOST: wpdbcluster
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ChangeME
depends_on:
- wpdbcluster
# Traefik load balancer
traefik:
image: traefik:v2.9
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker
- --providers.docker.swarmMode
- --providers.docker.exposedbydefault=false
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
placement:
constraints:
- node.role == manager
networks:
- frontend
# Redis service
redis:
image: redis:7.0
networks:
- backend
deploy:
replicas: 1
# Nginx service
nginx:
image: nginx:1.25
networks:
- frontend
- backend
deploy:
replicas: 1
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
networks:
frontend:
backend: