-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose-redis.yml
More file actions
230 lines (228 loc) · 11 KB
/
docker-compose-redis.yml
File metadata and controls
230 lines (228 loc) · 11 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# ***************************************************************************************************************************************
# * docker-compose-redis.yml *
# **************************************************************************************************************************************
# * *
# * @License Starts *
# * *
# * Copyright © 2023. MongoExpUser. All Rights Reserved. *
# * *
# * License: MIT - https://github.com/MongoExpUser/Ubuntu-Redis-Stack-Server-Image-and-Containers/blob/main/LICENSE *
# * *
# * @License Ends *
# **************************************************************************************************************************************
# * *
# * Project: Ubuntu-Redis-Stack Image & Container Project *
# * *
# * This docker compose file deploys: *
# * * *
# * 1) Redis Stack Server: 1 primary instance and 2 replica instances *
# * *
# * 2) Redis Sentinel (monitor) for Automatic Failover: 3 instances *
# * *
# * Versions: *
# * *
# * 1) Redis Stack Server (v6.2.6-v7) *
# * *
# * 2) Redis Sentinel (v2) *
# * *
# * Images name: iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest *
# * *
# * Redis Stack Server's Modules include: JSON, Timeseries, Graph, Search & Bloom Filters *
# * * *
# * *
# ***************************************************************************************************************************************
version: "3.9"
services:
redis-node1:
image: iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest
command: redis-server /etc/redis-stack.conf && --appenddirname appendonlydir
container_name: redis-node1
restart: always
volumes:
# map config file(s) from source dir
- ./source-sid-1/redis-stack.conf:/etc/redis-stack.conf
# map server and client tls certs from tls dir
- ./tls/server.crt:/etc/ssl/certs/server.crt
- ./tls/server.key:/etc/ssl/certs/server.key
- ./tls/root.crt:/etc/ssl/certs/root.crt
- ./tls/client.crt:/etc/ssl/certs/client.crt
- ./tls/client.key:/etc/ssl/certs/client.key
# map app dir
- ./app:/home/app
# create redis-stack's data, log & pid dirs/volumes
- data1:/var/lib/redis-stack
- log1:/var/log
- pid1:/var/run
# map AI module from source dir/volume
#./source-sid-1/redisai.so:/opt/redis-stack/lib/redisai.so - Add AI module later
ports:
- 6379:6379
networks:
- redis-network
redis-node2:
image: iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest
depends_on:
- redis-node1
command: redis-server /etc/redis-stack.conf && --appenddirname appendonlydir
container_name: redis-node2
restart: always
volumes:
# map config file(s) from source dir
- ./replica-sid-2/redis-stack.conf:/etc/redis-stack.conf
# map server and client tls certs from tls dir
- ./tls/server.crt:/etc/ssl/certs/server.crt
- ./tls/server.key:/etc/ssl/certs/server.key
- ./tls/root.crt:/etc/ssl/certs/root.crt
- ./tls/client.crt:/etc/ssl/certs/client.crt
- ./tls/client.key:/etc/ssl/certs/client.key
# map app dir
- ./app:/home/app
# create redis-stack's data, log & pid dirs/volumes
- data2:/var/lib/redis-stack
- log2:/var/log
- pid2:/var/run
ports:
- 6380:6379
networks:
- redis-network
redis-node3:
image: iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest
depends_on:
- redis-node2
command: redis-server /etc/redis-stack.conf && --appenddirname appendonlydir
container_name: redis-node3
restart: always
volumes:
# map config file(s) from source dir
- ./replica-sid-3/redis-stack.conf:/etc/redis-stack.conf
# map server and client tls certs from tls dir
- ./tls/server.crt:/etc/ssl/certs/server.crt
- ./tls/server.key:/etc/ssl/certs/server.key
- ./tls/root.crt:/etc/ssl/certs/root.crt
- ./tls/client.crt:/etc/ssl/certs/client.crt
- ./tls/client.key:/etc/ssl/certs/client.key
# map app dir
- ./app:/home/app
# create redis-stack's data, log & pid dirs/volumes
- data3:/var/lib/redis-stack
- log3:/var/log
- pid3:/var/run
ports:
- 6381:6379
networks:
- redis-network
sentinel-node1:
image: iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest
depends_on:
- redis-node3
command: redis-server /etc/redis/sentinel.conf --sentinel
container_name: sentinel-node1
restart: always
volumes:
# map config file(s) from source dir
- ./source-sid-1/sentinel.conf:/etc/redis/sentinel.conf
# map server and client tls certs from tls dir
- ./tls/server.crt:/etc/ssl/certs/server.crt
- ./tls/server.key:/etc/ssl/certs/server.key
- ./tls/root.crt:/etc/ssl/certs/root.crt
- ./tls/client.crt:/etc/ssl/certs/client.crt
- ./tls/client.key:/etc/ssl/certs/client.key
# create sentinel's data, log & pid dirs/volumes
- data1_sentinel:/var/lib/redis
- log1_sentinel:/var/log/redis
- pid1_sentinel:/run/sentinel
ports:
- 26379:26379
networks:
- redis-network
sentinel-node2:
image: iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest
depends_on:
- sentinel-node1
command: redis-server /etc/redis/sentinel.conf --sentinel
container_name: sentinel-node2
restart: always
volumes:
# map config file(s) from source dir
- ./replica-sid-2/sentinel.conf:/etc/redis/sentinel.conf
# map server and client tls certs from tls dir
- ./tls/server.crt:/etc/ssl/certs/server.crt
- ./tls/server.key:/etc/ssl/certs/server.key
- ./tls/root.crt:/etc/ssl/certs/root.crt
- ./tls/client.crt:/etc/ssl/certs/client.crt
- ./tls/client.key:/etc/ssl/certs/client.key
# create sentinel's data, log & pid dirs/volumes
- data2_sentinel:/var/lib/redis
- log2_sentinel:/var/log/redis
- pid2_sentinel:/run/sentinel
ports:
- 26380:26379
networks:
- redis-network
sentinel-node3:
image: iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest
depends_on:
- sentinel-node2
command: redis-server /etc/redis/sentinel.conf --sentinel
container_name: sentinel-node3
restart: always
volumes:
# map config file(s) from source dir
- ./replica-sid-3/sentinel.conf:/etc/redis/sentinel.conf
# map server and client tls certs from tls dir
- ./tls/server.crt:/etc/ssl/certs/server.crt
- ./tls/server.key:/etc/ssl/certs/server.key
- ./tls/root.crt:/etc/ssl/certs/root.crt
- ./tls/client.crt:/etc/ssl/certs/client.crt
- ./tls/client.key:/etc/ssl/certs/client.key
# create sentinel's data, log & pid dirs/volumes
- data3_sentinel:/var/lib/redis
- log3_sentinel:/var/log/redis
- pid3_sentinel:/run/sentinel
ports:
- 26381:26379
networks:
- redis-network
app-node:
image: iot/ubuntu-22.04-redis-stack-server-6.2.6-v7:latest
# set 'max-old-space-size' based on available memory
# see: https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes
command: sudo node --max-old-space-size=4096 /home/app/app.js
depends_on:
- sentinel-node3
container_name: app-node
restart: always
volumes:
- ./app:/home/app
ports:
- 8080:80
networks:
- redis-network
networks:
redis-network:
name: redis-net
volumes:
# redis-node1-vol
data1:
log1:
pid1:
# redis-node2-vol
data2:
log2:
pid2:
# redis-node3-vol
data3:
log3:
pid3:
# sentinel-node1-vol
data1_sentinel:
log1_sentinel:
pid1_sentinel:
# sentinel-node2-vol
data2_sentinel:
log2_sentinel:
pid2_sentinel:
# sentinel-node3-vol
data3_sentinel:
log3_sentinel:
pid3_sentinel: