[Cialug] Starting two jobs at once

Eric Junker eric at eric.nu
Tue Nov 27 18:26:10 CST 2012


On 11/27/2012 2:35 PM, Matthew Nuzum wrote:
> As it turns out, some of my projects are getting more complex because
> instead of just launching a web server they might also need to launch
> more than one process to serve an app.

If you want to keep your dependencies to a minimum then doing something 
in shell script would be the way to go but if you don't mind a few extra 
dependencies then there are some Ruby based tools that could be useful.

Foerman http://ddollar.github.com/foreman/ is a tool that launches 
programs defined in a Procfile. What is a Procfile? It is just a file 
that lists all the commands you need to run for your app.

Here is an example Procfile:
compass: compass watch static
db:      postgres -D /usr/local/var/postgres
redis:   redis-server /usr/local/etc/redis.conf
web:     python ranking/manage.py runserver

Then you would just run "foreman start" and it would start up all programs.

Guard http://rubydoc.info/gems/guard/frames helps you with monitoring 
the filesystem for changes and then running a specified program. The 
most common use is for things like unit testing where if you change your 
code it runs the appropriate unit test or as you change your SASS it 
automatically compiles it to CSS.

Eric


More information about the Cialug mailing list