forked from redis/lettuce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
384 lines (335 loc) · 11 KB
/
Makefile
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
PATH := ./work/redis-git/src:${PATH}
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
STUNNEL_BIN := $(shell which stunnel)
BREW_BIN := $(shell which brew)
YUM_BIN := $(shell which yum)
APT_BIN := $(shell which apt-get)
define REDIS1_CONF
daemonize yes
port 6479
pidfile work/redis1-6479.pid
logfile work/redis1-6479.log
save ""
appendonly no
client-output-buffer-limit pubsub 256k 128k 5
unixsocket $(ROOT_DIR)/work/socket-6479
unixsocketperm 777
endef
define REDIS2_CONF
daemonize yes
port 6480
pidfile work/redis2-6480.pid
logfile work/redis2-6480.log
save ""
appendonly no
unixsocket $(ROOT_DIR)/work/socket-6480
unixsocketperm 777
endef
define REDIS3_CONF
daemonize yes
port 6481
pidfile work/redis3-6481.pid
logfile work/redis3-6481.log
save ""
appendonly no
unixsocket $(ROOT_DIR)/work/socket-6481
unixsocketperm 777
endef
# For debugSegfault test
define REDIS4_CONF
daemonize yes
port 6482
pidfile work/redis4-6482.pid
logfile work/redis4-6482.log
save ""
appendonly no
slaveof 127.0.0.1 6481
unixsocket $(ROOT_DIR)/work/socket-6482
unixsocketperm 777
endef
# For Shutdown test
define REDIS5_CONF
daemonize yes
port 6483
pidfile work/redis5-6483.pid
logfile work/redis5-6483.log
save ""
appendonly no
unixsocket $(ROOT_DIR)/work/socket-6483
unixsocketperm 777
endef
# Sentinel-monitored master
define REDIS6_CONF
daemonize yes
port 6484
pidfile work/redis6-6484.pid
logfile work/redis6-6484.log
save ""
appendonly no
unixsocket $(ROOT_DIR)/work/socket-6484
unixsocketperm 777
endef
# Sentinel-monitored slave
define REDIS7_CONF
daemonize yes
port 6485
pidfile work/redis7-6485.pid
logfile work/redis7-6485.log
save ""
appendonly no
slaveof 127.0.0.1 6484
unixsocket $(ROOT_DIR)/work/socket-6485
unixsocketperm 777
endef
# SENTINELS
define REDIS_SENTINEL1
port 26379
daemonize yes
sentinel monitor mymaster 127.0.0.1 6484 1
sentinel down-after-milliseconds mymaster 100
sentinel failover-timeout mymaster 100
sentinel parallel-syncs mymaster 1
pidfile work/sentinel1-26379.pid
logfile work/sentinel1-26379.log
unixsocket $(ROOT_DIR)/work/socket-26379
unixsocketperm 777
endef
define REDIS_SENTINEL2
port 26380
daemonize yes
sentinel monitor mymaster 127.0.0.1 6484 1
sentinel down-after-milliseconds mymaster 100
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 100
pidfile work/sentinel2-26380.pid
logfile work/sentinel2-26380.log
unixsocket $(ROOT_DIR)/work/socket-26380
unixsocketperm 777
endef
# CLUSTER REDIS NODES
define REDIS_CLUSTER_NODE1_CONF
daemonize yes
port 7379
cluster-node-timeout 50
pidfile work/redis-cluster-node1-7379.pid
logfile work/redis-cluster-node1-7379.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file work/redis-cluster-config1-7379.conf
unixsocket $(ROOT_DIR)/work/socket-7379
unixsocketperm 777
endef
define REDIS_CLUSTER_CONFIG1
adf7f86efa42d903bcd93c5bce72397fe52e91bb 127.0.0.1:7379 myself,master - 0 0 1 connected 0-6999 7001-7999 12001
d5b88e479928ebf3d4179717b28e81a0cac5f2b6 127.0.0.1:7380 master - 0 1401604930675 0 connected 8000-11999
94fa000647d2d1957fe33acecaecec1017eee38e 127.0.0.1:7381 master - 0 1401604930675 2 connected 7000 12000 12002-16383
7b88a83c90cabf372470b15548692dcd670d1b83 127.0.0.1:7382 master - 1401604930675 1401604930575 3 connected
vars currentEpoch 3 lastVoteEpoch 0
endef
define REDIS_CLUSTER_NODE2_CONF
daemonize yes
port 7380
cluster-node-timeout 50
pidfile work/redis-cluster-node2-7380.pid
logfile work/redis-cluster-node2-7380.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file work/redis-cluster-config2-7380.conf
unixsocket $(ROOT_DIR)/work/socket-7380
unixsocketperm 777
endef
define REDIS_CLUSTER_CONFIG2
adf7f86efa42d903bcd93c5bce72397fe52e91bb 127.0.0.1:7379 master - 1401604930525 1401604930354 1 connected 0-6999 7001-7999 12001
d5b88e479928ebf3d4179717b28e81a0cac5f2b6 127.0.0.1:7380 myself,master - 0 0 0 connected 8000-11999
94fa000647d2d1957fe33acecaecec1017eee38e 127.0.0.1:7381 master - 1401604930525 1401604930354 2 connected 7000 12000 12002-16383
7b88a83c90cabf372470b15548692dcd670d1b83 127.0.0.1:7382 master - 1401604930525 1401604930355 3 connected
vars currentEpoch 3 lastVoteEpoch 0
endef
define REDIS_CLUSTER_NODE3_CONF
daemonize yes
port 7381
cluster-node-timeout 50
pidfile work/redis-cluster-node3-7381.pid
logfile work/redis-cluster-node3-7381.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file work/redis-cluster-config3-7381.conf
unixsocket $(ROOT_DIR)/work/socket-7381
unixsocketperm 777
endef
define REDIS_CLUSTER_CONFIG3
adf7f86efa42d903bcd93c5bce72397fe52e91bb 127.0.0.1:7379 master - 0 1401604930425 1 connected 0-6999 7001-7999 12001
d5b88e479928ebf3d4179717b28e81a0cac5f2b6 127.0.0.1:7380 master - 1401604930425 1401604930325 0 connected 8000-11999
94fa000647d2d1957fe33acecaecec1017eee38e 127.0.0.1:7381 myself,master - 0 0 2 connected 7000 12000 12002-16383
7b88a83c90cabf372470b15548692dcd670d1b83 127.0.0.1:7382 master - 1401604930425 1401604930325 3 connected
vars currentEpoch 3 lastVoteEpoch 0
endef
define REDIS_CLUSTER_NODE4_CONF
daemonize yes
port 7382
cluster-node-timeout 50
pidfile work/redis-cluster-node4-7382.pid
logfile work/redis-cluster-node4-7382.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file work/redis-cluster-config4-7382.conf
unixsocket $(ROOT_DIR)/work/socket-7382
unixsocketperm 777
endef
define REDIS_CLUSTER_CONFIG4
adf7f86efa42d903bcd93c5bce72397fe52e91bb 127.0.0.1:7379 master - 0 1401604930688 1 connected 0-6999 7001-7999 12001
d5b88e479928ebf3d4179717b28e81a0cac5f2b6 127.0.0.1:7380 master - 0 1401604930688 0 connected 8000-11999
94fa000647d2d1957fe33acecaecec1017eee38e 127.0.0.1:7381 master - 1401604930687 1401604930574 2 connected 7000 12000 12002-16383
7b88a83c90cabf372470b15548692dcd670d1b83 127.0.0.1:7382 myself,master - 0 0 3 connected
vars currentEpoch 3 lastVoteEpoch 0
endef
define REDIS_CLUSTER_NODE5_CONF
daemonize yes
port 7383
cluster-node-timeout 50
pidfile work/redis-cluster-node5-7383.pid
logfile work/redis-cluster-node5-7383.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file work/redis-cluster-config5-7383.conf
unixsocket $(ROOT_DIR)/work/socket-7383
unixsocketperm 777
endef
define REDIS_CLUSTER_NODE6_CONF
daemonize yes
port 7384
cluster-node-timeout 50
pidfile work/redis-cluster-node6-7384.pid
logfile work/redis-cluster-node6-7384.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file work/redis-cluster-config6-7384.conf
unixsocket $(ROOT_DIR)/work/socket-7384
unixsocketperm 777
endef
define STUNNEL_CONF
cert=$(ROOT_DIR)/work/cert.pem
key=$(ROOT_DIR)/work/key.pem
capath=$(ROOT_DIR)/work/cert.pem
cafile=$(ROOT_DIR)/work/cert.pem
delay=yes
pid=$(ROOT_DIR)/work/stunnel.pid
foreground = no
[stunnel]
accept = 127.0.0.1:6443
connect = 127.0.0.1:6479
endef
export REDIS1_CONF
export REDIS2_CONF
export REDIS3_CONF
export REDIS4_CONF
export REDIS5_CONF
export REDIS6_CONF
export REDIS7_CONF
export REDIS_SENTINEL1
export REDIS_SENTINEL2
export REDIS_SENTINEL3
export REDIS_CLUSTER_NODE1_CONF
export REDIS_CLUSTER_CONFIG1
export REDIS_CLUSTER_NODE2_CONF
export REDIS_CLUSTER_CONFIG2
export REDIS_CLUSTER_NODE3_CONF
export REDIS_CLUSTER_CONFIG3
export REDIS_CLUSTER_NODE4_CONF
export REDIS_CLUSTER_CONFIG4
export REDIS_CLUSTER_NODE5_CONF
export REDIS_CLUSTER_NODE6_CONF
export STUNNEL_CONF
start: cleanup
echo "$$REDIS1_CONF" > work/redis1-6479.conf && redis-server work/redis1-6479.conf
echo "$$REDIS2_CONF" > work/redis2-6480.conf && redis-server work/redis2-6480.conf
echo "$$REDIS3_CONF" > work/redis3-6481.conf && redis-server work/redis3-6481.conf
echo "$$REDIS4_CONF" > work/redis3-6482.conf && redis-server work/redis3-6482.conf
echo "$$REDIS5_CONF" > work/redis2-6483.conf && redis-server work/redis2-6483.conf
echo "$$REDIS6_CONF" > work/redis2-6484.conf && redis-server work/redis2-6484.conf
echo "$$REDIS7_CONF" > work/redis2-6485.conf && redis-server work/redis2-6485.conf
echo "$$REDIS_SENTINEL1" > work/sentinel1-26379.conf && redis-server work/sentinel1-26379.conf --sentinel
@sleep 0.5
echo "$$REDIS_SENTINEL2" > work/sentinel2-26380.conf && redis-server work/sentinel2-26380.conf --sentinel
echo "$$REDIS_CLUSTER_CONFIG1" > work/redis-cluster-config1-7379.conf
echo "$$REDIS_CLUSTER_CONFIG2" > work/redis-cluster-config2-7380.conf
echo "$$REDIS_CLUSTER_CONFIG3" > work/redis-cluster-config3-7381.conf
echo "$$REDIS_CLUSTER_CONFIG4" > work/redis-cluster-config4-7382.conf
echo "$$REDIS_CLUSTER_NODE1_CONF" > work/redis-clusternode1-7379.conf && redis-server work/redis-clusternode1-7379.conf
echo "$$REDIS_CLUSTER_NODE2_CONF" > work/redis-clusternode2-7380.conf && redis-server work/redis-clusternode2-7380.conf
echo "$$REDIS_CLUSTER_NODE3_CONF" > work/redis-clusternode3-7381.conf && redis-server work/redis-clusternode3-7381.conf
echo "$$REDIS_CLUSTER_NODE4_CONF" > work/redis-clusternode4-7382.conf && redis-server work/redis-clusternode4-7382.conf
echo "$$REDIS_CLUSTER_NODE5_CONF" > work/redis-clusternode5-7383.conf && redis-server work/redis-clusternode5-7383.conf
echo "$$REDIS_CLUSTER_NODE6_CONF" > work/redis-clusternode6-7384.conf && redis-server work/redis-clusternode6-7384.conf
echo "$$STUNNEL_CONF" > work/stunnel.conf
which stunnel4 >/dev/null 2>&1 && stunnel4 work/stunnel.conf || stunnel work/stunnel.conf
cleanup: stop
- mkdir -p work
rm -f work/redis-cluster-node*.conf 2>/dev/null
rm -f work/*.rdb work/*.aof work/*.conf work/*.log 2>/dev/null
rm -f *.aof
rm -f *.rdb
ssl-keys:
- mkdir -p work
- rm -f work/keystore.jks
openssl genrsa -out work/key.pem 4096
openssl req -new -x509 -key work/key.pem -out work/cert.pem -days 365 -subj "/O=lettuce/ST=Some-State/C=DE/CN=lettuce-test"
chmod go-rwx work/key.pem
chmod go-rwx work/cert.pem
$$JAVA_HOME/bin/keytool -importcert -keystore work/keystore.jks -file work/cert.pem -noprompt -storepass changeit
stop:
pkill stunnel || true
pkill redis-server && sleep 1 || true
pkill redis-sentinel && sleep 1 || true
test-coveralls:
make start
mvn -B -DskipTests=false clean compile test jacoco:report coveralls:report
make stop
test: start
mvn -B -DskipTests=false clean compile test
make stop
prepare: stop
ifndef STUNNEL_BIN
ifeq ($(shell uname -s),Linux)
ifdef APT_BIN
sudo apt-get install -y stunnel
else
ifdef YUM_BIN
sudo yum install stunnel
else
@echo "Cannot install stunnel using yum/apt-get"
@exit 1
endif
endif
endif
ifeq ($(shell uname -s),Darwin)
ifndef BREW_BIN
@echo "Cannot install stunnel because missing brew.sh"
@exit 1
endif
brew install stunnel
endif
endif
[ ! -e work/redis-git ] && git clone https://github.com/antirez/redis.git --branch unstable --single-branch work/redis-git && cd work/redis-git|| true
[ -e work/redis-git ] && cd work/redis-git && git reset --hard && git pull && git checkout unstable || true
make -C work/redis-git clean
make -C work/redis-git -j4
clean:
rm -Rf work/
rm -Rf target/
release:
mvn release:clean
mvn release:prepare -Psonatype-oss-release
mvn release:perform -Psonatype-oss-release
ls target/checkout/target/*-bin.zip | xargs gpg -b -a
ls target/checkout/target/*-bin.tar.gz | xargs gpg -b -a
cd target/checkout && mvn site:site && mvn -o scm-publish:publish-scm -Dgithub.site.upload.skip=false
apidocs:
mvn site:site
./apidocs.sh