Runit Setup - rubyists/tiny_call_center GitHub Wiki
Runit Setup on Arch Linux
Prerequisites
Mandatory
- yaourt, or the AUR helper of your choice, examples will use yaourt.
- Arch Linux install
- Sudo installed and configured to allow youruser access
Update
<youruser@yourhost ~>$ yaourt -Syu --aur
Install runit-run-git
<youruser@yourhost ~>$ yaourt -S runit-run-git
IMPORTANT
This package will replace your system's SYSV init scheme with the runit supervisor system. If you are working on this system remotely, make sure you have taken steps to ensure sshd starts on boot (either via a service, or by the existing rc.conf DAEMONS infrastructure.) The default runit-run installation will provide two virtual consoles on ttyV2 and ttyV3.
You will need to restart the system using the following command:
<root@yourhost ~># /sbin/init.sysv 6
After this, /sbin/runit-init will run as PID1, and start runsvdir on /var/service, where your service directory symlinks are expected to reside.
Create a user for the callcenter application to run in.
<youruser@yourhost ~>$ sudo adduser callcenter
Do NOT run tiny_call_center as root! After you have done created this user, you can set up service directory for the callcenter user like so.
Set up the home service for the callcenter user
<youruser@yourhost ~>$ sudo su -
<root@yourhost ~># mkdir ~callcenter/service
<root@yourhost ~># chown callcenter ~callcenter/service
<root@yourhost ~># mkdir -p /etc/sv/homes/callcenter
<root@yourhost ~># vim /etc/sv/homes/callcenter/run
Contents of the 'run' file:
#!/bin/sh
export PATH=/home/callcenter/bin:$PATH
exec 2>&1
exec sudo -H -u callcenter runsvdir -P /home/callcenter/service 'log:...................................................................................................................................'
After you have written the file, you need to make it executable, and symlink the service into /service:
<root@yourhost ~># chmod 755 /etc/sv/homes/callcenter/run
<root@yourhost ~># ln -s /etc/sv/homes/callcenter /service
Once you have completed these steps, you can confirm the service is working by issuing the following
<root@yourhost ~># sv s /service/callcenter
You should see a response similar to this:
run: /service/callcenter: (pid 2105) 3s
If you get a response with down: or down; want up, then your script is failing. Check for errors before you continue.