-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdocker-compose.yaml
110 lines (102 loc) · 2.17 KB
/
docker-compose.yaml
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
version: "3.3"
services:
# Redis configuration file example
# https://raw.githubusercontent.com/antirez/redis/4.0/redis.conf
master:
image: redis:4.0.8-alpine
ports:
- 6379:6379
volumes:
- type: volume
source: master-data
target: /data
command: [
'--requirepass "${REDIS_PWD}"',
'--masterauth "${REDIS_PWD}"',
'--maxmemory 512mb',
'--maxmemory-policy volatile-ttl',
'--save ""',
]
node-1: &node
image: redis:4.0.8-alpine
depends_on:
- master
ports:
- 6380:6380
volumes:
- type: volume
source: node-1-data
target: /data
- type: volume
source: node-1-data
target: /tmp
command: [
'--port 6380',
'--requirepass "${REDIS_PWD}"',
'--slaveof master 6379',
'--masterauth "${REDIS_PWD}"',
'--save ""',
]
links:
- master:${SENTINEL_MASTER_NAME}
node-2:
<<: *node
ports:
- 6381:6381
volumes:
- type: volume
source: node-2-data
target: /data
- type: volume
source: node-2-data
target: /tmp
command: [
'--port 6381',
'--requirepass "${REDIS_PWD}"',
'--slaveof master 6379',
'--masterauth "${REDIS_PWD}"',
'--save ""',
]
sentinel-1: &sentinel
build:
context: ./sentinel
dockerfile: Dockerfile-sentinel
image: redis-sentinel:dev
environment:
- SENTINEL_REDIS_PWD=${REDIS_PWD}
- SENTINEL_REDIS_IP=${SENTINEL_MASTER_NAME}
- SENTINEL_QUORUM=2
- SENTINEL_DOWN_AFTER=3000
command: [
'${SENTINEL_CONF_PATH}',
'--sentinel'
]
depends_on:
- master
- node-1
- node-2
links:
- master:${SENTINEL_MASTER_NAME}
- node-1
- node-2
sentinel-2:
<<: *sentinel
sentinel-3:
<<: *sentinel
nginx:
image: nginx:1.13.9-alpine
ports:
- 26379:26379
volumes:
- type: bind
source: ./nginx/nginx.conf
target: /etc/nginx/nginx.conf
read_only: true
depends_on:
- sentinel-1
- sentinel-2
- sentinel-3
volumes:
master-data:
node-1-data:
node-2-data: