-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
599 lines (550 loc) · 14.3 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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
PATH := ./valkey-git/src:${PATH}
STUNNEL_BIN := $(shell which stunnel)
define VALKEY1_CONF
daemonize yes
protected-mode no
port 6379
requirepass foobared
user acljedis on allcommands allkeys >fizzbuzz
pidfile /tmp/valkey1.pid
logfile /tmp/valkey1.log
save ""
appendonly no
enable-module-command yes
client-output-buffer-limit pubsub 256k 128k 5
extended-redis-compatibility yes
endef
define VALKEY2_CONF
daemonize yes
protected-mode no
port 6380
requirepass foobared
pidfile /tmp/valkey2.pid
logfile /tmp/valkey2.log
save ""
appendonly no
extended-redis-compatibility yes
endef
define VALKEY3_CONF
daemonize yes
protected-mode no
port 6381
requirepass foobared
masterauth foobared
pidfile /tmp/valkey3.pid
logfile /tmp/valkey3.log
save ""
appendonly no
extended-redis-compatibility yes
endef
define VALKEY4_CONF
daemonize yes
protected-mode no
port 6382
requirepass foobared
masterauth foobared
pidfile /tmp/valkey4.pid
logfile /tmp/valkey4.log
save ""
appendonly no
slaveof localhost 6381
extended-redis-compatibility yes
endef
define VALKEY5_CONF
daemonize yes
protected-mode no
port 6383
requirepass foobared
masterauth foobared
pidfile /tmp/valkey5.pid
logfile /tmp/valkey5.log
save ""
appendonly no
slaveof localhost 6379
extended-redis-compatibility yes
endef
define VALKEY6_CONF
daemonize yes
protected-mode no
port 6384
requirepass foobared
masterauth foobared
pidfile /tmp/valkey6.pid
logfile /tmp/valkey6.log
save ""
appendonly no
extended-redis-compatibility yes
endef
define VALKEY7_CONF
daemonize yes
protected-mode no
port 6385
requirepass foobared
masterauth foobared
pidfile /tmp/valkey7.pid
logfile /tmp/valkey7.log
save ""
appendonly no
slaveof localhost 6384
extended-redis-compatibility yes
endef
define VALKEY8_CONF
daemonize yes
protected-mode no
port 6386
pidfile /tmp/valkey8.pid
logfile /tmp/valkey8.log
save ""
appendonly no
maxmemory-policy allkeys-lfu
extended-redis-compatibility yes
endef
define VALKEY9_CONF
daemonize yes
protected-mode no
port 6387
user default off
user acljedis on allcommands allkeys >fizzbuzz
pidfile /tmp/valkey9.pid
logfile /tmp/valkey9.log
save ""
appendonly no
client-output-buffer-limit pubsub 256k 128k 5
extended-redis-compatibility yes
endef
define VALKEY10_CONF
daemonize yes
protected-mode no
port 6388
pidfile /tmp/valkey10.pid
logfile /tmp/valkey10.log
save ""
appendonly no
extended-redis-compatibility yes
endef
define VALKEY11_CONF
daemonize yes
protected-mode no
port 6389
pidfile /tmp/valkey11.pid
logfile /tmp/valkey11.log
save ""
appendonly no
replicaof localhost 6388
extended-redis-compatibility yes
endef
define VALKEY12_CONF
daemonize yes
protected-mode no
port 6391
pidfile /tmp/valkey12.pid
logfile /tmp/valkey12.log
save ""
appendonly no
extended-redis-compatibility yes
endef
define VALKEY13_CONF
daemonize yes
protected-mode no
port 6392
pidfile /tmp/valkey13.pid
logfile /tmp/valkey13.log
save ""
appendonly no
replicaof localhost 6391
extended-redis-compatibility yes
endef
# SENTINELS
define VALKEY_SENTINEL1
port 26379
daemonize yes
protected-mode no
sentinel monitor mymaster 127.0.0.1 6379 1
sentinel auth-pass mymaster foobared
sentinel down-after-milliseconds mymaster 2000
sentinel failover-timeout mymaster 120000
sentinel parallel-syncs mymaster 1
pidfile /tmp/sentinel1.pid
logfile /tmp/sentinel1.log
endef
define VALKEY_SENTINEL2
port 26380
daemonize yes
protected-mode no
sentinel monitor mymaster 127.0.0.1 6381 1
sentinel auth-pass mymaster foobared
sentinel down-after-milliseconds mymaster 2000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 120000
pidfile /tmp/sentinel2.pid
logfile /tmp/sentinel2.log
endef
define VALKEY_SENTINEL3
port 26381
daemonize yes
protected-mode no
sentinel monitor mymasterfailover 127.0.0.1 6384 1
sentinel auth-pass mymasterfailover foobared
sentinel down-after-milliseconds mymasterfailover 2000
sentinel failover-timeout mymasterfailover 120000
sentinel parallel-syncs mymasterfailover 1
pidfile /tmp/sentinel3.pid
logfile /tmp/sentinel3.log
endef
define VALKEY_SENTINEL4
port 26382
daemonize yes
protected-mode no
sentinel monitor mymaster 127.0.0.1 6381 1
sentinel auth-pass mymaster foobared
sentinel down-after-milliseconds mymaster 2000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 120000
pidfile /tmp/sentinel4.pid
logfile /tmp/sentinel4.log
endef
define VALKEY_SENTINEL5
port 26383
daemonize yes
protected-mode no
user default off
user sentinel on allcommands allkeys allchannels >foobared
sentinel monitor aclmaster 127.0.0.1 6387 1
sentinel auth-user aclmaster acljedis
sentinel auth-pass aclmaster fizzbuzz
sentinel down-after-milliseconds aclmaster 2000
sentinel failover-timeout aclmaster 120000
sentinel parallel-syncs aclmaster 1
pidfile /tmp/sentinel5.pid
logfile /tmp/sentinel5.log
endef
# CLUSTER VALKEY NODES
define VALKEY_CLUSTER_NODE1_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7379
cluster-node-timeout 15000
pidfile /tmp/valkey_cluster_node1.pid
logfile /tmp/valkey_cluster_node1.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/valkey_cluster_node1.conf
extended-redis-compatibility yes
endef
define VALKEY_CLUSTER_NODE2_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7380
cluster-node-timeout 15000
pidfile /tmp/valkey_cluster_node2.pid
logfile /tmp/valkey_cluster_node2.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/valkey_cluster_node2.conf
extended-redis-compatibility yes
endef
define VALKEY_CLUSTER_NODE3_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7381
cluster-node-timeout 15000
pidfile /tmp/valkey_cluster_node3.pid
logfile /tmp/valkey_cluster_node3.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/valkey_cluster_node3.conf
extended-redis-compatibility yes
endef
define VALKEY_CLUSTER_NODE4_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7382
cluster-node-timeout 15000
pidfile /tmp/valkey_cluster_node4.pid
logfile /tmp/valkey_cluster_node4.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/valkey_cluster_node4.conf
extended-redis-compatibility yes
endef
define VALKEY_CLUSTER_NODE5_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7383
cluster-node-timeout 15000
pidfile /tmp/valkey_cluster_node5.pid
logfile /tmp/valkey_cluster_node5.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/valkey_cluster_node5.conf
extended-redis-compatibility yes
endef
# STABLE CLUSTER VALKEY NODES
# The structure of this cluster is not changed by the tests!
define VALKEY_STABLE_CLUSTER_NODE1_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7479
cluster-node-timeout 15000
pidfile /tmp/valkey_stable_cluster_node1.pid
logfile /tmp/valkey_stable_cluster_node1.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/valkey_stable_cluster_node1.conf
extended-redis-compatibility yes
endef
define VALKEY_STABLE_CLUSTER_NODE2_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7480
cluster-node-timeout 15000
pidfile /tmp/valkey_stable_cluster_node2.pid
logfile /tmp/valkey_stable_cluster_node2.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/valkey_stable_cluster_node2.conf
extended-redis-compatibility yes
endef
define VALKEY_STABLE_CLUSTER_NODE3_CONF
daemonize yes
protected-mode no
requirepass cluster
port 7481
cluster-node-timeout 15000
pidfile /tmp/valkey_stable_cluster_node3.pid
logfile /tmp/valkey_stable_cluster_node3.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/valkey_stable_cluster_node3.conf
extended-redis-compatibility yes
endef
# UDS VALKEY NODES
define VALKEY_UDS
daemonize yes
protected-mode no
port 0
pidfile /tmp/valkey_uds.pid
logfile /tmp/valkey_uds.log
unixsocket /tmp/valkey_uds.sock
unixsocketperm 777
save ""
appendonly no
extended-redis-compatibility yes
endef
# UNAVAILABLE VALKEY NODES
define VALKEY_UNAVAILABLE_CONF
daemonize yes
protected-mode no
port 6400
pidfile /tmp/valkey_unavailable.pid
logfile /tmp/valkey_unavailable.log
save ""
appendonly no
endef
#STUNNEL
define STUNNEL_CONF
cert = src/test/resources/private.pem
pid = /tmp/stunnel.pid
[valkey_1]
accept = 127.0.0.1:6390
connect = 127.0.0.1:6379
[valkey_3]
accept = 127.0.0.1:16381
connect = 127.0.0.1:6381
[valkey_4]
accept = 127.0.0.1:16382
connect = 127.0.0.1:6382
[valkey_9]
accept = 127.0.0.1:16387
connect = 127.0.0.1:6387
[valkey_cluster_1]
accept = 127.0.0.1:8379
connect = 127.0.0.1:7379
[valkey_cluster_2]
accept = 127.0.0.1:8380
connect = 127.0.001:7380
[valkey_cluster_3]
accept = 127.0.0.1:8381
connect = 127.0.001:7381
[valkey_cluster_4]
accept = 127.0.0.1:8382
connect = 127.0.0.1:7382
[valkey_cluster_5]
accept = 127.0.0.1:8383
connect = 127.0.0.1:7383
[valkey_sentinel_5]
accept = 127.0.0.1:36383
connect = 127.0.0.1:26383
endef
export VALKEY1_CONF
export VALKEY2_CONF
export VALKEY3_CONF
export VALKEY4_CONF
export VALKEY5_CONF
export VALKEY6_CONF
export VALKEY7_CONF
export VALKEY8_CONF
export VALKEY9_CONF
export VALKEY10_CONF
export VALKEY11_CONF
export VALKEY12_CONF
export VALKEY13_CONF
export VALKEY_SENTINEL1
export VALKEY_SENTINEL2
export VALKEY_SENTINEL3
export VALKEY_SENTINEL4
export VALKEY_SENTINEL5
export VALKEY_CLUSTER_NODE1_CONF
export VALKEY_CLUSTER_NODE2_CONF
export VALKEY_CLUSTER_NODE3_CONF
export VALKEY_CLUSTER_NODE4_CONF
export VALKEY_CLUSTER_NODE5_CONF
export VALKEY_STABLE_CLUSTER_NODE1_CONF
export VALKEY_STABLE_CLUSTER_NODE2_CONF
export VALKEY_STABLE_CLUSTER_NODE3_CONF
export VALKEY_UDS
export VALKEY_UNAVAILABLE_CONF
export STUNNEL_CONF
export STUNNEL_BIN
ifndef STUNNEL_BIN
SKIP_SSL := !SSL*,
endif
export SKIP_SSL
start: stunnel cleanup compile-module
echo "$$VALKEY1_CONF" | valkey-server -
echo "$$VALKEY2_CONF" | valkey-server -
echo "$$VALKEY3_CONF" | valkey-server -
echo "$$VALKEY4_CONF" | valkey-server -
echo "$$VALKEY5_CONF" | valkey-server -
echo "$$VALKEY6_CONF" | valkey-server -
echo "$$VALKEY7_CONF" | valkey-server -
echo "$$VALKEY8_CONF" | valkey-server -
echo "$$VALKEY9_CONF" | valkey-server -
echo "$$VALKEY10_CONF" | valkey-server -
echo "$$VALKEY11_CONF" | valkey-server -
echo "$$VALKEY12_CONF" | valkey-server -
echo "$$VALKEY13_CONF" | valkey-server -
echo "$$VALKEY_SENTINEL1" > /tmp/sentinel1.conf && valkey-server /tmp/sentinel1.conf --sentinel
@sleep 0.5
echo "$$VALKEY_SENTINEL2" > /tmp/sentinel2.conf && valkey-server /tmp/sentinel2.conf --sentinel
@sleep 0.5
echo "$$VALKEY_SENTINEL3" > /tmp/sentinel3.conf && valkey-server /tmp/sentinel3.conf --sentinel
@sleep 0.5
echo "$$VALKEY_SENTINEL4" > /tmp/sentinel4.conf && valkey-server /tmp/sentinel4.conf --sentinel
@sleep 0.5
echo "$$VALKEY_SENTINEL5" > /tmp/sentinel5.conf && valkey-server /tmp/sentinel5.conf --sentinel
@sleep 0.5
echo "$$VALKEY_CLUSTER_NODE1_CONF" | valkey-server -
echo "$$VALKEY_CLUSTER_NODE2_CONF" | valkey-server -
echo "$$VALKEY_CLUSTER_NODE3_CONF" | valkey-server -
echo "$$VALKEY_CLUSTER_NODE4_CONF" | valkey-server -
echo "$$VALKEY_CLUSTER_NODE5_CONF" | valkey-server -
echo "$$VALKEY_STABLE_CLUSTER_NODE1_CONF" | valkey-server -
echo "$$VALKEY_STABLE_CLUSTER_NODE2_CONF" | valkey-server -
echo "$$VALKEY_STABLE_CLUSTER_NODE3_CONF" | valkey-server -
echo "$$VALKEY_UDS" | valkey-server -
echo "$$VALKEY_UNAVAILABLE_CONF" | valkey-server -
@sleep 0.5
valkey-cli -a cluster --cluster create 127.0.0.1:7479 127.0.0.1:7480 127.0.0.1:7481 --cluster-yes
cleanup:
- rm -vf /tmp/valkey_cluster_node*.conf 2>/dev/null
- rm dump.rdb appendonly.aof - 2>/dev/null
stunnel:
@if [ -e "$$STUNNEL_BIN" ]; then\
echo "$$STUNNEL_CONF" | stunnel -fd 0;\
fi
stop:
kill `cat /tmp/valkey1.pid`
kill `cat /tmp/valkey2.pid`
kill `cat /tmp/valkey3.pid`
kill `cat /tmp/valkey4.pid`
kill `cat /tmp/valkey5.pid`
kill `cat /tmp/valkey6.pid`
kill `cat /tmp/valkey7.pid`
kill `cat /tmp/valkey8.pid`
kill `cat /tmp/valkey9.pid`
kill `cat /tmp/valkey10.pid`
kill `cat /tmp/valkey11.pid`
kill `cat /tmp/valkey12.pid`
kill `cat /tmp/valkey13.pid`
kill `cat /tmp/sentinel1.pid`
kill `cat /tmp/sentinel2.pid`
kill `cat /tmp/sentinel3.pid`
kill `cat /tmp/sentinel4.pid`
kill `cat /tmp/sentinel5.pid`
kill `cat /tmp/valkey_cluster_node1.pid` || true
kill `cat /tmp/valkey_cluster_node2.pid` || true
kill `cat /tmp/valkey_cluster_node3.pid` || true
kill `cat /tmp/valkey_cluster_node4.pid` || true
kill `cat /tmp/valkey_cluster_node5.pid` || true
kill `cat /tmp/valkey_stable_cluster_node1.pid`
kill `cat /tmp/valkey_stable_cluster_node2.pid`
kill `cat /tmp/valkey_stable_cluster_node3.pid`
kill `cat /tmp/valkey_uds.pid` || true
kill `cat /tmp/stunnel.pid` || true
[ -f /tmp/valkey_unavailable.pid ] && kill `cat /tmp/valkey_unavailable.pid` || true
rm -f /tmp/sentinel1.conf
rm -f /tmp/sentinel2.conf
rm -f /tmp/sentinel3.conf
rm -f /tmp/sentinel4.conf
rm -f /tmp/sentinel5.conf
rm -f /tmp/valkey_cluster_node1.conf
rm -f /tmp/valkey_cluster_node2.conf
rm -f /tmp/valkey_cluster_node3.conf
rm -f /tmp/valkey_cluster_node4.conf
rm -f /tmp/valkey_cluster_node5.conf
rm -f /tmp/valkey_stable_cluster_node1.conf
rm -f /tmp/valkey_stable_cluster_node2.conf
rm -f /tmp/valkey_stable_cluster_node3.conf
show-log:
echo "====== valkey1.log =======" && cat /tmp/valkey1.log
echo "====== valkey2.log =======" && cat /tmp/valkey2.log
echo "====== valkey3.log =======" && cat /tmp/valkey3.log
echo "====== valkey4.log =======" && cat /tmp/valkey4.log
echo "====== valkey5.log =======" && cat /tmp/valkey5.log
echo "====== valkey6.log =======" && cat /tmp/valkey6.log
echo "====== valkey7.log =======" && cat /tmp/valkey7.log
echo "====== valkey8.log =======" && cat /tmp/valkey8.log
echo "====== valkey9.log =======" && cat /tmp/valkey9.log
echo "====== valkey10.log =======" && cat /tmp/valkey10.log
echo "====== valkey11.log =======" && cat /tmp/valkey11.log
echo "====== valkey12.log =======" && cat /tmp/valkey12.log
echo "====== valkey13.log =======" && cat /tmp/valkey13.log
test: | start show-log mvn-test stop
mvn-test:
mvn -Dtest=${SKIP_SSL}${TEST} clean compile test
package: | start mvn-package stop
mvn-package:
mvn clean package
deploy: | start mvn-deploy stop
mvn-deploy:
mvn clean deploy
format:
mvn java-formatter:format
release: | start mvn-release stop
mvn-release:
mvn release:clean
mvn release:prepare
mvn release:perform -DskipTests
system-setup:
[ ! -e valkey-git ] && git clone https://github.com/valkey-io/valkey.git --branch unstable --single-branch valkey-git || true
$(MAKE) -C valkey-git clean
$(MAKE) -C valkey-git
compile-module:
gcc -shared -o /tmp/testmodule.so -fPIC src/test/resources/testmodule.c
.PHONY: test