Add templated redis
This commit is contained in:
5
rc.redis/redis-instances/dependencies
Normal file
5
rc.redis/redis-instances/dependencies
Normal file
@ -0,0 +1,5 @@
|
||||
redis
|
||||
# Comment out remount-root and uncomment local-fs
|
||||
# if you use separate partition for /tmp
|
||||
remount-root
|
||||
#local-fs
|
2
rc.redis/redis-instances/down
Normal file
2
rc.redis/redis-instances/down
Normal file
@ -0,0 +1,2 @@
|
||||
forbacktickx -E port { s6-instance-list /run/service/redis }
|
||||
s6-instance-delete /run/service/redis $port
|
1
rc.redis/redis-instances/type
Normal file
1
rc.redis/redis-instances/type
Normal file
@ -0,0 +1 @@
|
||||
oneshot
|
9
rc.redis/redis-instances/up
Normal file
9
rc.redis/redis-instances/up
Normal file
@ -0,0 +1,9 @@
|
||||
#########################################################
|
||||
# Create redis instances with existing configuration #
|
||||
# files. #
|
||||
#########################################################
|
||||
|
||||
elglob -0 configs /etc/redis/[0-9]*.conf
|
||||
forx -E config { $configs }
|
||||
backtick -E port { basename $config .conf }
|
||||
s6-instance-create /run/service/redis $port
|
5
rc.redis/redis/dependencies
Normal file
5
rc.redis/redis/dependencies
Normal file
@ -0,0 +1,5 @@
|
||||
network
|
||||
# Comment out "remount-root" and uncomment "local-fs"
|
||||
# if you use separate partition for /var
|
||||
remount-root
|
||||
#local-fs
|
1
rc.redis/redis/env/CMD
vendored
Normal file
1
rc.redis/redis/env/CMD
vendored
Normal file
@ -0,0 +1 @@
|
||||
s6-svscan
|
1
rc.redis/redis/env/CMD_OPTS
vendored
Normal file
1
rc.redis/redis/env/CMD_OPTS
vendored
Normal file
@ -0,0 +1 @@
|
||||
-d3 -c500
|
1
rc.redis/redis/notification-fd
Normal file
1
rc.redis/redis/notification-fd
Normal file
@ -0,0 +1 @@
|
||||
3
|
27
rc.redis/redis/run
Normal file
27
rc.redis/redis/run
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/execlineb -P
|
||||
|
||||
###########################################################################
|
||||
# Start redis instance supervisor #
|
||||
# #
|
||||
# The redis instances are run by the redis user. Database directory is #
|
||||
# owned by that user and the redis group. You can create these with: #
|
||||
# #
|
||||
# groupadd -g 121 redis #
|
||||
# useradd -u 121 -g 121 -d /var/lib/redis -s /sbin/nologin redis #
|
||||
# #
|
||||
# The configuration for redis instances is expected to be named same as #
|
||||
# port the instance will be running on. For example if redis should #
|
||||
# listen on 6379, there should be a configuration file in #
|
||||
# /etc/redis/6379.conf. Generic settings can be put in #
|
||||
# /etc/redis/redis.conf and included in other configurations. s6 instance #
|
||||
# name should be the port number as well, 6379 in this case. #
|
||||
###########################################################################
|
||||
|
||||
fdmove -c 2 1
|
||||
foreground { chown redis:redis /var/lib/redis }
|
||||
s6-envdir env
|
||||
multisubstitute {
|
||||
importas -u CMD CMD
|
||||
importas -usCd" " CMD_OPTS CMD_OPTS
|
||||
}
|
||||
emptyenv -p $CMD $CMD_OPTS -- instance
|
7
rc.redis/redis/template/data/check
Executable file
7
rc.redis/redis/template/data/check
Executable 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
1
rc.redis/redis/template/env/CMD
vendored
Normal file
@ -0,0 +1 @@
|
||||
redis-server
|
1
rc.redis/redis/template/env/CMD_OPTS
vendored
Normal file
1
rc.redis/redis/template/env/CMD_OPTS
vendored
Normal file
@ -0,0 +1 @@
|
||||
/etc/redis/${port}.conf
|
1
rc.redis/redis/template/log/env/CMD
vendored
Normal file
1
rc.redis/redis/template/log/env/CMD
vendored
Normal file
@ -0,0 +1 @@
|
||||
s6-log
|
1
rc.redis/redis/template/log/env/CMD_OPTS
vendored
Normal file
1
rc.redis/redis/template/log/env/CMD_OPTS
vendored
Normal file
@ -0,0 +1 @@
|
||||
-d3
|
2
rc.redis/redis/template/log/env/LOGDIR_GROUP
vendored
Normal file
2
rc.redis/redis/template/log/env/LOGDIR_GROUP
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
root
|
||||
# Logging directory group ownership
|
2
rc.redis/redis/template/log/env/LOGDIR_OWNER
vendored
Normal file
2
rc.redis/redis/template/log/env/LOGDIR_OWNER
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
root
|
||||
# Logging directory owner
|
2
rc.redis/redis/template/log/env/LOGDIR_PATH
vendored
Normal file
2
rc.redis/redis/template/log/env/LOGDIR_PATH
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/var/log/redis/${port}
|
||||
# Logging directory path
|
2
rc.redis/redis/template/log/env/LOGDIR_PERMS
vendored
Normal file
2
rc.redis/redis/template/log/env/LOGDIR_PERMS
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
750
|
||||
# Logging directory access rights in octal
|
2
rc.redis/redis/template/log/env/LOG_SCRIPT
vendored
Normal file
2
rc.redis/redis/template/log/env/LOG_SCRIPT
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
n4 s500000 T $LOGDIR_PATH
|
||||
# Logging script used by s6-log
|
1
rc.redis/redis/template/log/notification-fd
Normal file
1
rc.redis/redis/template/log/notification-fd
Normal file
@ -0,0 +1 @@
|
||||
3
|
25
rc.redis/redis/template/log/run
Executable file
25
rc.redis/redis/template/log/run
Executable 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
|
1
rc.redis/redis/template/log/type
Normal file
1
rc.redis/redis/template/log/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
1
rc.redis/redis/template/notification-fd
Normal file
1
rc.redis/redis/template/notification-fd
Normal file
@ -0,0 +1 @@
|
||||
3
|
17
rc.redis/redis/template/run
Executable file
17
rc.redis/redis/template/run
Executable 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
|
1
rc.redis/redis/template/type
Normal file
1
rc.redis/redis/template/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
1
rc.redis/redis/type
Normal file
1
rc.redis/redis/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
Reference in New Issue
Block a user