I am looking for some ideas on how to start up my "Thin" Rails server automatically, whenever the machine where it resides reboots.
The problem is that when the machine reboots, "Thin" needs to be started up manually, which causes issues with the Rails sites being down until someone starts up "Thin" by hand.
/var/www/app_directory# thin start --ssl -e production
Details
Ruby: 1.9.2
Rails: v3.2.1
Thin: v1.5.0
Machine: Debian 6 "Squeeze"
I know that apache runs as it's own user on the box. Not sure if that same approach makes sense with my particular problem.
Thanks
Best Answer
I used the instructions here: http://jordanhollinger.com/2011/04/22/how-to-use-thin-effectivly
to create a configuration file and start thin as a normal service at server boot. To get started, one would run:
It should set up a start up file in hopefully the proper directory, and tell you where it is. For me, in CentOS/Fedora I had to move the thin file from /etc/rc.d to /etc/rc.d/init.d
You then add it to chkconfig, or similar facility in your system, and turn it on for the right run levels (3,4,5). I did:
And you can start or restart thin with: