aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-05-16 00:22:13 +0200
committerJakub Jirutka <jakub@jirutka.cz>2018-05-16 00:29:44 +0200
commitc28bfa6688edf662275b96f0fec3042098f4defb (patch)
treeeae74e61374527046e95837582ca41654293dfe3
parent9eb6b73c74302111d40228d99cc9ee789b226497 (diff)
downloadaports-c28bfa6688edf662275b96f0fec3042098f4defb.tar.gz
aports-c28bfa6688edf662275b96f0fec3042098f4defb.tar.bz2
aports-c28bfa6688edf662275b96f0fec3042098f4defb.tar.xz
main/redis: add init script and config for sentinel
Ref #8877 (https://bugs.alpinelinux.org/issues/8877)
-rw-r--r--main/redis/APKBUILD14
-rw-r--r--main/redis/redis-sentinel.initd33
-rw-r--r--main/redis/redis.logrotate2
-rw-r--r--main/redis/sentinel.conf.patch13
4 files changed, 58 insertions, 4 deletions
diff --git a/main/redis/APKBUILD b/main/redis/APKBUILD
index dfb221f207..082e85a96e 100644
--- a/main/redis/APKBUILD
+++ b/main/redis/APKBUILD
@@ -15,9 +15,11 @@ install="$pkgname.pre-install"
subpackages="$pkgname-openrc"
source="http://download.redis.io/releases/$pkgname-$pkgver.tar.gz
redis.conf.patch
+ sentinel.conf.patch
$pkgname.initd
- $pkgname.logrotate
$pkgname.confd
+ $pkgname-sentinel.initd
+ $pkgname.logrotate
"
builddir="$srcdir/$pkgname-$pkgver"
@@ -55,7 +57,11 @@ package() {
install -D -m 644 "$builddir"/redis.conf etc/redis.conf
+ # This file must be writable for redis, otherwise Sentinel fails to start.
+ install -D -m 644 -o redis -g redis "$builddir"/sentinel.conf etc/sentinel.conf
+
install -D -m 755 "$srcdir"/redis.initd etc/init.d/redis
+ install -D -m 755 "$srcdir"/redis-sentinel.initd etc/init.d/redis-sentinel
install -D -m 644 "$srcdir"/redis.confd etc/conf.d/redis
install -D -m 644 "$srcdir"/redis.logrotate etc/logrotate.d/redis
@@ -66,6 +72,8 @@ package() {
sha512sums="a6cf63cb361f0a87da3955ba628190dc04cad342f7a664d18e44416ee67dd86ed6e3a46b9701e994f1417e56b819b3c6fc595f363c10bb4b83d5033919d29598 redis-4.0.9.tar.gz
c8a35e3c30be99fef8678acb2502f424bcca478dcc1ef1750f8c8c8e9e9c462f97586159f32ebba84b6a4eb398a9d568e3200241fb0de1f96293c9fdaafb06c9 redis.conf.patch
+d9bbb3fcc69022633d7fea3227c41d8777422ce9778623efb6aa539468fc51d2d1de09d364e21c7c8b45c61e7bbc7aaaf22745257d60ea937f77a8673facf286 sentinel.conf.patch
a56fdf8ac3f649ae1fa74005158be7d758a670ea02224519bc0000e7ce78e0c0f65a6166ced028f558461d03eba377fa37437d5e610b5ec3ed005d9e62eae25b redis.initd
-6d17d169b40a7e23a0a2894eff0f3e2fe8e4461b36f2a9d45468f0abd84ea1035d679b4c0a34029bce093147f9c7bb697e843c113c17769d38c934d4a78a5848 redis.logrotate
-6752e99df632b14d62a3266929e80c3d667be5c270e4f34e0dcf2b7f9b1754fe0ce9d4569fa413dbbe207e406ff2848a64e0c47629997536ae1d14ca84ebd56b redis.confd"
+6752e99df632b14d62a3266929e80c3d667be5c270e4f34e0dcf2b7f9b1754fe0ce9d4569fa413dbbe207e406ff2848a64e0c47629997536ae1d14ca84ebd56b redis.confd
+e7a60a090df53eef05d58d73709f07536135a93efb34e48ad933e3859d3d1c0f476975a3232df18f57476bf7fc3b0548471e1c86445878457ac8507b3da71384 redis-sentinel.initd
+bf2def2077a989047e9bfff8a7f754bcdf96e020fd4a470f8967ee1fca601e11f044cfb3742f00e932cc013e0d0b199045d78c8878a0e529715c9f77786d353f redis.logrotate"
diff --git a/main/redis/redis-sentinel.initd b/main/redis/redis-sentinel.initd
new file mode 100644
index 0000000000..f5d2a371c5
--- /dev/null
+++ b/main/redis/redis-sentinel.initd
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+
+name="Redis Sentinel"
+
+: ${cfgfile:="/etc/sentinel.conf"}
+: ${command_user:="redis:redis"}
+: ${retry:=30}
+
+command="/usr/bin/redis-sentinel"
+command_args="$cfgfile --daemonize no $command_args"
+command_background="yes"
+
+pidfile="/run/$RC_SVCNAME.pid"
+
+required_files="$cfgfile"
+
+depend() {
+ use net localmount logger
+ after keepalived firewall redis
+}
+
+start_pre() {
+ # Sets start-start-daemon's --chdir.
+ directory=$(config_get 'dir' '/var/lib/redis')
+}
+
+config_get() {
+ local key="$1"
+ local default="${2:-}"
+
+ local value=$(awk "\$1 == \"$key\" { print \$2 }" "$cfgfile")
+ printf '%s\n' "${value:-$default}"
+}
diff --git a/main/redis/redis.logrotate b/main/redis/redis.logrotate
index c77c9a0e88..5281d38117 100644
--- a/main/redis/redis.logrotate
+++ b/main/redis/redis.logrotate
@@ -1,4 +1,4 @@
-/var/log/redis/redis.log {
+/var/log/redis/*.log {
notifempty
missingok
}
diff --git a/main/redis/sentinel.conf.patch b/main/redis/sentinel.conf.patch
new file mode 100644
index 0000000000..ce092b63c1
--- /dev/null
+++ b/main/redis/sentinel.conf.patch
@@ -0,0 +1,13 @@
+--- a/sentinel.conf
++++ b/sentinel.conf
+@@ -20,6 +20,10 @@
+ # The port that this sentinel instance will run on
+ port 26379
+
++# Specify the log file name. Also the empty string can be used to force
++# Redis to log on the standard output.
++logfile /var/log/redis/sentinel.log
++
+ # sentinel announce-ip <ip>
+ # sentinel announce-port <port>
+ #