-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathdocker-compose.yml
114 lines (108 loc) · 2.89 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
114
# An demo version of WordPress for easy scaling
wordpress:
image: autopilotpattern/wordpress:latest
restart: always
env_file: _env
environment:
- CONSUL_AGENT=1
ports:
- 80
- 9090
labels:
# Setting the CNS service name
- triton.cns.services=wp-wordpress
# Soft anti-affinity to avoid other WordPress instances
- com.docker.swarm.affinities=["container!=~*wordpress*"]
# Set the package
- com.joyent.package=g4-highcpu-1G
# 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
env_file: _env
ports:
- 8500
dns:
- 127.0.0.1
labels:
- triton.cns.services=wp-consul
# Soft anti-affinity to avoid all other containers
- com.docker.swarm.affinities=["container!=~*"]
- com.joyent.package=g4-highcpu-128M
# NFS is used to store user uploads
nfs:
image: autopilotpattern/nfsserver:latest
restart: always
env_file: _env
environment:
- CONSUL_AGENT=1
expose:
- 111
- 1892
- 2049
labels:
- triton.cns.services=wp-nfs
- com.docker.swarm.affinities=["container!=~*"]
- com.joyent.package=g4-highcpu-256M
# 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
env_file: _env
environment:
- CONSUL_AGENT=1
expose:
- 3306
labels:
- triton.cns.services=wp-mysql
- com.docker.swarm.affinities=["container!=~*mysql*"]
- com.joyent.package=g4-highcpu-4G
# Memcached is a high performance object cache
memcached:
image: autopilotpattern/memcached:latest
restart: always
env_file: _env
environment:
- CONSUL_AGENT=1
ports:
- 11211
labels:
- triton.cns.services=wp-memcached
- com.docker.swarm.affinities=["container!=~*memcached*"]
- com.joyent.package=g4-highcpu-512M
# Nginx as a load-balancing tier and reverse proxy
nginx:
image: autopilotpattern/wordpress-nginx:latest
restart: always
ports:
- 80
- 443
- 9090
env_file: _env
environment:
- CONSUL_AGENT=1
labels:
- triton.cns.services=wp-nginx,nginx
- com.docker.swarm.affinities=["container!=~*nginx*"]
- com.joyent.package=g4-highcpu-512M
# Prometheus is an open source performance monitoring tool
# it is included here for demo purposes and is not required
prometheus:
image: autopilotpattern/prometheus:branch-triton-support
restart: always
env_file: _env
ports:
- 9090
labels:
- triton.cns.services=wp-prometheus
- com.docker.swarm.affinities=["container!=~*prometheus*"]
- com.joyent.package=g4-highcpu-1G