forked from autopilotpattern/wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
113 lines (107 loc) · 2.67 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
103
104
105
106
107
108
109
110
111
112
113
# An demo version of WordPress for easy scaling
wordpress:
image: autopilotpattern/wordpress:latest
restart: always
mem_limit: 1g
env_file: _env
environment:
- CONSUL_AGENT=1
ports:
- 80
- 9090
labels:
# Setting the CNS service name
- triton.cns.services=wordpress
# Soft anti-affinity to avoid other WordPress instances
- com.docker.swarm.affinities=["container!=~*wordpress*"]
# Consul is the service catalog that helps discovery between the components
# Change "-bootstrap" to "-bootstrap-expect 3", then scale to 3 or more to
# turn this into an HA Consul raft.
consul:
image: autopilotpattern/consul:latest
command: >
/usr/local/bin/containerpilot
/bin/consul agent -server
-bootstrap
-config-dir=/etc/consul
-ui-dir /ui
restart: always
mem_limit: 128m
env_file: _env
ports:
- 8500
dns:
- 127.0.0.1
labels:
- triton.cns.services=consul
- com.docker.swarm.affinities=["container!=~*"]
# NFS is used to store user uploads
nfs:
image: autopilotpattern/nfsserver:latest
restart: always
mem_limit: 256m
env_file: _env
environment:
- CONSUL_AGENT=1
expose:
- 111
- 1892
- 2049
labels:
- triton.cns.services=nfs
# Soft anti-affinity to avoid all other containers
- com.docker.swarm.affinities=["container!=~*"]
# The MySQL database will automatically cluster and scale
# see https://www.joyent.com/blog/dbaas-simplicity-no-lock-in
mysql:
image: autopilotpattern/mysql:latest
restart: always
mem_limit: 4g
env_file: _env
environment:
- CONSUL_AGENT=1
expose:
- 3306
labels:
- triton.cns.services=mysql
- com.docker.swarm.affinities=["container!=~*mysql*"]
# Memcached is a high performance object cache
memcached:
image: autopilotpattern/memcached:latest
restart: always
mem_limit: 512m
env_file: _env
environment:
- CONSUL_AGENT=1
ports:
- 11211
labels:
- triton.cns.services=memcached
- com.docker.swarm.affinities=["container!=~*memcached*"]
# Nginx as a load-balancing tier and reverse proxy
nginx:
image: autopilotpattern/wordpress-nginx:latest
restart: always
mem_limit: 512m
ports:
- 80
- 443
- 9090
env_file: _env
environment:
- CONSUL_AGENT=1
labels:
- triton.cns.services=nginx
- com.docker.swarm.affinities=["container!=~*nginx*"]
# Prometheus is an open source performance monitoring tool
# it is included here for demo purposes and is not required
prometheus:
image: autopilotpattern/prometheus:latest
restart: always
mem_limit: 1g
env_file: _env
ports:
- 9090
labels:
- triton.cns.services=prometheus
- com.docker.swarm.affinities=["container!=~*prometheus*"]