Foreman can help manage multiple processes that your Rails app depends upon when running in development. It also provides an export command to move them into production.
I have Foreman set up for Heroku, but didn't think of using it in my development environment. Is there a way to see the usual rails server logs? That's the only thing keeping me from switching my s alias from rails server to foreman start. Any ideas?
If you're using Guard you can also use the guard-process gem. It doesn't have all of the features Foreman has, but it does allow you to easily specify when your processes need to be restarted in standard Guard fashion.
You can easily have the best of both worlds -- I rather like Foreman's log presentation for the various processes, so I actually run Guard at the end of a Procfile, and use an environment variable to limit groups if I wish:
This way you could also employ guard-process as you mention for things that should restart when code is changed.
If you use your Procfile for production -- either on Heroku or to generate upstart/init files at deploy -- you'll want a separate Procfile for including Guard in development. I'm too lazy to type foreman -f config/dev/Procfile all the time so I wrap that in a rake dev task.
Here's another tip: Foreman runs anywhere. I currently use it in a non-Rails folder to get it to start up 2 Rails apps that need to run at the same time. Example:
yaml
web: cd site; bundle exec rails sworker: cd site; rake jobs:worksearch: cd site; bundle exec rake sunspot:solr:runscheduler: cd redirect; rake jobs:worklog: tail -f site/log/development.log
We use foreman with passenger (standalone) as our web server (in dev). Only problem is that you have to manually stop passenger after stopping foreman.
I've been using foreman for a while now to scale my various ruby processes in a centralized manner, and it is working perfectly for me .
Anyways I would like to have some feature to restart a process or even to give it more control like to kill a single process and start it again, in the current implementation when I kill one process the whole processes in the main foreman stops . any workaround or solution here ? thanks in advance
In my production server, I'm using ruby foreman to run multiple processes, I just want my application to keep working, even if one of the processes down, is there any tricky way to restart the processes or even not to stop all the other processes in case one went down ? I mean in production level I want the solution to be stable enough, is that possible without Upstart ?
Short and good intro to foreman. But a bit more explanation on the Procfile itself would have been good for many people i guess.
Because if you know that this is the prefered way to have heroku know about your processes it opens a whole new world ;-)
Here is a good Article about that: http://devcenter.heroku.com/articles/procfile
I was wondering wouldn't it be easier to just create a rake task (boot.rake)?
You can easily pass the environment type to your commands so you'll be able to use it on production / staging as well.
I have Foreman set up for Heroku, but didn't think of using it in my development environment. Is there a way to see the usual
rails server
logs? That's the only thing keeping me from switching mys
alias fromrails server
toforeman start
. Any ideas?What do you mean? Doesn't
fits your needs?
tailf
doesn't exist in OS X, usingtail -f -n 40 log/development.log
works tho.How do you think this compares to the terminitor gem...I have been using it to start up my environments.
If you're using Guard you can also use the guard-process gem. It doesn't have all of the features Foreman has, but it does allow you to easily specify when your processes need to be restarted in standard Guard fashion.
You can easily have the best of both worlds -- I rather like Foreman's log presentation for the various processes, so I actually run Guard at the end of a Procfile, and use an environment variable to limit groups if I wish:
This way you could also employ guard-process as you mention for things that should restart when code is changed.
If you use your Procfile for production -- either on Heroku or to generate upstart/init files at deploy -- you'll want a separate Procfile for including Guard in development. I'm too lazy to type
foreman -f config/dev/Procfile
all the time so I wrap that in arake dev
task.Here's another tip: Foreman runs anywhere. I currently use it in a non-Rails folder to get it to start up 2 Rails apps that need to run at the same time. Example:
After export to upstart and running this command
I am getting this error
I am using Ubuntu 10.4 LTS and logged in with root if it does matter.
I'm having this problem too. Anyone has some tips?
We use foreman with passenger (standalone) as our web server (in dev). Only problem is that you have to manually stop passenger after stopping foreman.
Is there a way to limit tasks to a given environment
ex:
development:
redis: redis-server
Juan, this guy has a good strategy for this, check out:
http://michaelvanrooijen.com/articles/2011/06/08-managing-and-monitoring-your-ruby-application-with-foreman-and-upstart/
I've been using foreman for a while now to scale my various ruby processes in a centralized manner, and it is working perfectly for me .
Anyways I would like to have some feature to restart a process or even to give it more control like to kill a single process and start it again, in the current implementation when I kill one process the whole processes in the main foreman stops . any workaround or solution here ? thanks in advance
In my production server, I'm using ruby foreman to run multiple processes, I just want my application to keep working, even if one of the processes down, is there any tricky way to restart the processes or even not to stop all the other processes in case one went down ? I mean in production level I want the solution to be stable enough, is that possible without Upstart ?
Any hint/help would be highly appreciated .
God might work for you. http://godrb.com/
How do I setup multiple environments in the .ENV file?