| 1 | run: |
| 2 | - file: |
| 3 | path: /etc/service/redis/run |
| 4 | chmod: "+x" |
| 5 | contents: | |
| 6 | #!/bin/sh |
| 7 | exec 2>&1 |
| 8 | exec thpoff chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf |
| 9 | - file: |
| 10 | path: /etc/service/redis/log/run |
| 11 | chmod: "+x" |
| 12 | contents: | |
| 13 | #!/bin/sh |
| 14 | mkdir -p /var/log/redis |
| 15 | exec svlogd /var/log/redis |
| 16 | - file: |
| 17 | path: /etc/runit/3.d/10-redis |
| 18 | chmod: "+x" |
| 19 | contents: | |
| 20 | #!/bin/bash |
| 21 | sv stop redis |
| 22 | |
| 23 | - replace: |
| 24 | filename: "/etc/redis/redis.conf" |
| 25 | from: "daemonize yes" |
| 26 | to: "" |
| 27 | - replace: |
| 28 | filename: "/etc/redis/redis.conf" |
| 29 | from: /^pidfile.*$/ |
| 30 | to: "" |
| 31 | |
| 32 | - exec: |
| 33 | cmd: |
| 34 | - install -d -m 0755 -o redis -g redis /shared/redis_data |
| 35 | |
| 36 | - replace: |
| 37 | filename: "/etc/redis/redis.conf" |
| 38 | from: /^logfile.*$/ |
| 39 | to: "logfile \"\"" |
| 40 | |
| 41 | - replace: |
| 42 | filename: "/etc/redis/redis.conf" |
| 43 | from: /^bind .*$/ |
| 44 | to: "" |
| 45 | |
| 46 | - replace: |
| 47 | filename: "/etc/redis/redis.conf" |
| 48 | from: /^dir .*$/ |
| 49 | to: "dir /shared/redis_data" |
| 50 | |
| 51 | - exec: |
| 52 | cmd: echo redis installed |
| 53 | hook: redis |
| 54 | - exec: cat /etc/redis/redis.conf | grep logfile |
| 55 | |
| 56 | - exec: |
| 57 | background: true |
| 58 | cmd: exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf |
| 59 | |
| 60 | - exec: sleep 10 |
| 61 | |
| 62 | # we can not migrate without redis, launch it if needed |
| 63 | hooks: |
| 64 | before_code: |
| 65 | - exec: |
| 66 | background: true |
| 67 | cmd: exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf |
| 68 | after_code: |
| 69 | - replace: |
| 70 | filename: /etc/service/unicorn/run |
| 71 | from: "# redis" |
| 72 | to: sv start redis || exit 1 |