Add templated redis

This commit is contained in:
2025-06-14 22:13:48 +02:00
parent 22994bb869
commit 21efcfc5ef
26 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,7 @@
#!/bin/execlineb -P
redirfd -w 2 /dev/null
getcwd -E CWD
backtick -E port { basename $CWD }
backtick -En PING { redis-cli -p $port ping }
eltest $PING = PONG

1
rc.redis/redis/template/env/CMD vendored Normal file
View File

@ -0,0 +1 @@
redis-server

1
rc.redis/redis/template/env/CMD_OPTS vendored Normal file
View File

@ -0,0 +1 @@
/etc/redis/${port}.conf

1
rc.redis/redis/template/log/env/CMD vendored Normal file
View File

@ -0,0 +1 @@
s6-log

View File

@ -0,0 +1 @@
-d3

View File

@ -0,0 +1,2 @@
root
# Logging directory group ownership

View File

@ -0,0 +1,2 @@
root
# Logging directory owner

View File

@ -0,0 +1,2 @@
/var/log/redis/${port}
# Logging directory path

View File

@ -0,0 +1,2 @@
750
# Logging directory access rights in octal

View File

@ -0,0 +1,2 @@
n4 s500000 T $LOGDIR_PATH
# Logging script used by s6-log

View File

@ -0,0 +1 @@
3

25
rc.redis/redis/template/log/run Executable file
View File

@ -0,0 +1,25 @@
#!/bin/execlineb -WS1
###############################################
# Start a logging daemon for the redis daemon #
###############################################
s6-envdir env
multisubstitute {
importas -iu LOGDIR_OWNER LOGDIR_OWNER
importas -iu LOGDIR_GROUP LOGDIR_GROUP
importas -iu LOGDIR_PERMS LOGDIR_PERMS
importas -iu CMD CMD
importas -usCd" " CMD_OPTS CMD_OPTS
importas -iusCd" " LOG_SCRIPT LOG_SCRIPT
}
s6-envuidgid -Bi ${LOGDIR_OWNER}:${LOGDIR_GROUP}
multisubstitute {
importas -iu LOGDIR_PATH LOGDIR_PATH
importas -iu UID UID
importas -iu GID GID
}
backtick -E port { dirname $1 }
if { install -dm $LOGDIR_PERMS -o $UID -g $GID $LOGDIR_PATH }
s6-setuidgid ${UID}:${GID}
exec -c $CMD $CMD_OPTS -- $LOG_SCRIPT

View File

@ -0,0 +1 @@
longrun

View File

@ -0,0 +1 @@
3

17
rc.redis/redis/template/run Executable file
View File

@ -0,0 +1,17 @@
#!/bin/execlineb -WS1
#################################
# Start redis (key-value store) #
#################################
fdmove -c 2 1
s6-envdir env
multisubstitute {
importas -iu CMD CMD
importas -usCd" " CMD_OPTS CMD_OPTS
}
prlimit --nofile=8192
define port $1
s6-notifyoncheck -d
s6-setuidgid redis
exec -c $CMD $CMD_OPTS

View File

@ -0,0 +1 @@
longrun