1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- REDIS_VERSION: =7.2.4
15+ REDIS_VERSION: =7.2.5
16+ PROJECT? =redis
17+ GH_ORG? =redis
1618SPRING_PROFILE? =ci
1719SHELL =/bin/bash -euo pipefail
1820
1921# ######
2022# Redis
2123# ######
22- .PRECIOUS : work/redis -% .conf
24+ .PRECIOUS : work/$( PROJECT ) -% .conf
2325
24- work/redis -% .conf :
26+ work/$( PROJECT ) -% .conf :
2527 @mkdir -p $(@D )
2628
2729 echo port $* >> $@
2830 echo daemonize yes >> $@
2931 echo protected-mode no >> $@
3032 echo bind 0.0.0.0 >> $@
3133 echo notify-keyspace-events Ex >> $@
32- echo pidfile $(shell pwd)/work/redis -$*.pid >> $@
33- echo logfile $(shell pwd)/work/redis -$*.log >> $@
34- echo unixsocket $(shell pwd)/work/redis -$*.sock >> $@
34+ echo pidfile $(shell pwd)/work/$(PROJECT) -$*.pid >> $@
35+ echo logfile $(shell pwd)/work/$(PROJECT) -$*.log >> $@
36+ echo unixsocket $(shell pwd)/work/$(PROJECT) -$*.sock >> $@
3537 echo unixsocketperm 755 >> $@
3638 echo save \"\" >> $@
3739 echo slaveof 127.0.0.1 6379 >> $@
3840
3941# Handled separately because it's a node with authentication. User: spring, password: data. Default password: foobared
40- work/redis -6382.conf :
42+ work/$( PROJECT ) -6382.conf :
4143 @mkdir -p $(@D )
4244
4345 echo port 6382 >> $@
4446 echo daemonize yes >> $@
4547 echo protected-mode no >> $@
4648 echo bind 0.0.0.0 >> $@
4749 echo notify-keyspace-events Ex >> $@
48- echo pidfile $(shell pwd)/work/redis -6382.pid >> $@
49- echo logfile $(shell pwd)/work/redis -6382.log >> $@
50- echo unixsocket $(shell pwd)/work/redis -6382.sock >> $@
50+ echo pidfile $(shell pwd)/work/$(PROJECT) -6382.pid >> $@
51+ echo logfile $(shell pwd)/work/$(PROJECT) -6382.log >> $@
52+ echo unixsocket $(shell pwd)/work/$(PROJECT) -6382.sock >> $@
5153 echo unixsocketperm 755 >> $@
5254 echo "requirepass foobared" >> $@
5355 echo "user default on # 1b58ee375b42e41f0e48ef2ff27d10a5b1f6924a9acdcdba7cae868e7adce6bf ~* +@all" >> $@
5456 echo "user spring on # 3a6eb0790f39ac87c94f3856b2dd2c5d110e6811602261a9a923d3bb23adc8b7 +@all" >> $@
5557 echo save \"\" >> $@
5658
5759# Handled separately because it's the master and all others are slaves
58- work/redis -6379.conf :
60+ work/$( PROJECT ) -6379.conf :
5961 @mkdir -p $(@D )
6062
6163 echo port 6379 >> $@
6264 echo daemonize yes >> $@
6365 echo protected-mode no >> $@
6466 echo bind 0.0.0.0 >> $@
6567 echo notify-keyspace-events Ex >> $@
66- echo pidfile $(shell pwd)/work/redis -6379.pid >> $@
67- echo logfile $(shell pwd)/work/redis -6379.log >> $@
68- echo unixsocket $(shell pwd)/work/redis -6379.sock >> $@
68+ echo pidfile $(shell pwd)/work/$(PROJECT) -6379.pid >> $@
69+ echo logfile $(shell pwd)/work/$(PROJECT) -6379.log >> $@
70+ echo unixsocket $(shell pwd)/work/$(PROJECT) -6379.sock >> $@
6971 echo unixsocketperm 755 >> $@
7072 echo save \"\" >> $@
7173
72- work/redis -% .pid : work/redis -% .conf work/redis /bin/redis -server
73- work/redis /bin/redis -server $<
74+ work/$( PROJECT ) -% .pid : work/$( PROJECT ) -% .conf work/$( PROJECT ) /bin/$( PROJECT ) -server
75+ work/$( PROJECT ) /bin/$( PROJECT ) -server $<
7476
75- redis -start : work/redis -6379.pid work/redis -6380.pid work/redis -6381.pid work/redis -6382.pid
77+ server -start : work/$( PROJECT ) -6379.pid work/$( PROJECT ) -6380.pid work/$( PROJECT ) -6381.pid work/$( PROJECT ) -6382.pid
7678
77- redis -stop : stop-6379 stop-6380 stop-6381 stop-6382
79+ server -stop : stop-6379 stop-6380 stop-6381 stop-6382
7880
7981# #########
8082# Sentinel
@@ -110,8 +112,8 @@ work/sentinel-26382.conf:
110112 echo sentinel monitor mymaster 127.0.0.1 6382 2 >> $@
111113 echo sentinel auth-pass mymaster foobared >> $@
112114
113- work/sentinel-% .pid : work/sentinel-% .conf work/redis -6379.pid work/redis /bin/redis -server
114- work/redis /bin/redis -server $< --sentinel
115+ work/sentinel-% .pid : work/sentinel-% .conf work/$( PROJECT ) -6379.pid work/$( PROJECT ) /bin/$( PROJECT ) -server
116+ work/$( PROJECT ) /bin/$( PROJECT ) -server $< --sentinel
115117
116118sentinel-start : work/sentinel-26379.pid work/sentinel-26380.pid work/sentinel-26381.pid work/sentinel-26382.pid
117119
@@ -136,30 +138,30 @@ work/cluster-%.conf:
136138 echo logfile $(shell pwd)/work/cluster-$*.log >> $@
137139 echo save \"\" >> $@
138140
139- work/cluster-% .pid : work/cluster-% .conf work/redis /bin/redis -server
140- work/redis /bin/redis -server $< &
141+ work/cluster-% .pid : work/cluster-% .conf work/$( PROJECT ) /bin/$( PROJECT ) -server
142+ work/$( PROJECT ) /bin/$( PROJECT ) -server $< &
141143
142144cluster-start : work/cluster-7379.pid work/cluster-7380.pid work/cluster-7381.pid work/cluster-7382.pid
143145 sleep 1
144146
145147work/meet-% :
146- -work/redis /bin/redis -cli -p $* cluster meet 127.0.0.1 7379
148+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -p $* cluster meet 127.0.0.1 7379
147149
148150# Handled separately because this node is a replica
149151work/meet-7382 :
150- -work/redis /bin/redis -cli -p 7382 cluster meet 127.0.0.1 7379
152+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -p 7382 cluster meet 127.0.0.1 7379
151153 sleep 2
152- -work/redis /bin/redis -cli -p 7382 cluster replicate $(shell work/redis /bin/redis -cli -p 7379 cluster myid)
154+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -p 7382 cluster replicate $(shell work/$( PROJECT ) /bin/$( PROJECT ) -cli -p 7379 cluster myid)
153155
154156cluster-meet : work/meet-7380 work/meet-7381 work/meet-7382
155157 sleep 1
156158
157159cluster-stop : stop-7379 stop-7380 stop-7381 stop-7382
158160
159161cluster-slots :
160- -work/redis /bin/redis -cli -p 7379 cluster addslots $(shell seq 0 5460)
161- -work/redis /bin/redis -cli -p 7380 cluster addslots $(shell seq 5461 10922)
162- -work/redis /bin/redis -cli -p 7381 cluster addslots $(shell seq 10923 16383)
162+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -p 7379 cluster addslots $(shell seq 0 5460)
163+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -p 7380 cluster addslots $(shell seq 5461 10922)
164+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -p 7381 cluster addslots $(shell seq 10923 16383)
163165
164166cluster-init : cluster-start cluster-meet cluster-slots
165167
@@ -172,26 +174,26 @@ clean:
172174clobber :
173175 rm -rf work
174176
175- work/redis /bin/redis -cli work/redis /bin/redis -server :
176- @mkdir -p work/redis
177+ work/$( PROJECT ) /bin/$( PROJECT ) -cli work/$( PROJECT ) /bin/$( PROJECT ) -server :
178+ @mkdir -p work/$( PROJECT )
177179
178- curl -sSL https://github.com/redis/redis /archive/$(REDIS_VERSION).tar.gz | tar xzf - -C work
179- $(MAKE) -C work/redis -$(REDIS_VERSION) -j
180- $(MAKE) -C work/redis -$(REDIS_VERSION) PREFIX=$(shell pwd)/work/redis install
181- rm -rf work/redis -$(REDIS_VERSION)
180+ curl -sSL https://github.com/$(GH_ORG)/$(PROJECT) /archive/refs/tags /$(REDIS_VERSION).tar.gz | tar xzf - -C work
181+ $(MAKE) -C work/$(PROJECT) -$(REDIS_VERSION) -j
182+ $(MAKE) -C work/$(PROJECT) -$(REDIS_VERSION) PREFIX=$(shell pwd)/work/$(PROJECT) install
183+ rm -rf work/$(PROJECT) -$(REDIS_VERSION)
182184
183- start : redis -start sentinel-start cluster-init
185+ start : server -start sentinel-start cluster-init
184186
185- stop-% : work/redis /bin/redis -cli
186- -work/redis /bin/redis -cli -p $* shutdown
187+ stop-% : work/$( PROJECT ) /bin/$( PROJECT ) -cli
188+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -p $* shutdown
187189
188- stop-6382 : work/redis /bin/redis -cli
189- -work/redis /bin/redis -cli -a foobared -p 6382 shutdown
190+ stop-6382 : work/$( PROJECT ) /bin/$( PROJECT ) -cli
191+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -a foobared -p 6382 shutdown
190192
191- stop-26382 : work/redis /bin/redis -cli
192- -work/redis /bin/redis -cli -a foobared -p 26382 shutdown
193+ stop-26382 : work/$( PROJECT ) /bin/$( PROJECT ) -cli
194+ -work/$( PROJECT ) /bin/$( PROJECT ) -cli -a foobared -p 26382 shutdown
193195
194- stop : redis -stop sentinel-stop cluster-stop
196+ stop : server -stop sentinel-stop cluster-stop
195197
196198test :
197199 $(MAKE ) start
0 commit comments