Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 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:

thin install

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:

chkconfig --add thin
chkconfig --level 345 thin on
chkconfig --level 2 thin off

And you can start or restart thin with:

service thin start
service thin restart
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.