1 Jan 2017
I've been experimented with runit. It's a great way to supervise a long-lived application. I don't want to use
One thing I've learned from experimenting with runit is that process supervision is a solved problem. It doesn't make sense to solve it myself. I have been always inclined to create my own solution. That's not a good attitude. Because my solution is almost always inferior to a famous solution (where it has been tested for years). And my goal is not to solve process supervision; it's to build an application that solve user's problems. I need to remember that and learn to explore other people's solutions.
Here are what I've learned:
/etc/serviceto install the service. Yes, the folder contains the service's configuration.
execto run the process we want because
execrun the process using the same PID. runit executes
runand saves the PID. Therefore, if we didn't use
exec, our process would have a different PID.
scalaspawns a different process with different PID to run the
sbt stagefrom sbt-native-packager and run
./supervise. I configure an runit service through Ansible. Those files don't exist before a service is started. And if I touch those files first (with Ansible), then those files will be invalid, and the service won't start.