run: - file: path: /etc/service/redis/run chmod: "+x" contents: | #!/bin/sh exec 2>&1 exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf - file: path: /etc/service/redis/log/run chmod: "+x" contents: | #!/bin/sh mkdir -p /var/log/redis exec svlogd /var/log/redis - file: path: /etc/runit/3.d/10-redis chmod: "+x" contents: | #!/bin/bash sv stop redis - replace: filename: "/etc/redis/redis.conf" from: "daemonize yes" to: "" - replace: filename: "/etc/redis/redis.conf" from: /^pidfile.*$/ to: "" - exec: cmd: - install -d -m 0755 -o redis -g redis /shared/redis_data - replace: filename: "/etc/redis/redis.conf" from: /^logfile.*$/ to: "logfile \"\"" - replace: filename: "/etc/redis/redis.conf" from: /^bind .*$/ to: "" - replace: filename: "/etc/redis/redis.conf" from: /^dir .*$/ to: "dir /shared/redis_data" - exec: cmd: echo redis installed hook: redis - exec: cat /etc/redis/redis.conf | grep logfile - exec: background: true cmd: exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf - exec: sleep 10 # we can not migrate without redis, launch it if needed hooks: before_code: - exec: background: true cmd: exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf after_code: - replace: filename: /etc/service/unicorn/run from: "# redis" to: sv start redis || exit 1