Hello,
I've created a fork to test a concept. We're using Foreman primarily in development to run Redis, a Resque worker and a Resque scheduler. These worker and scheduler depend on Redis to be started and in some cases fail because of that.
The version at https://github.com/rvanlieshout/foreman supports the defenition of dependency in the Procfile. For now it only uses a delay of 5 seconds to allow a parent to get started. A procfile could look like:
mongodb: mongod --quiet --dbpath=db/mongo/
| redis: redis-server /opt/local/etc/redis.conf
| | worker: bundle exec rake environment resque:work QUEUE=* VERBOSE=1 RAILS_ENV=development
| | scheduler: bundle exec rake resque:scheduler QUEUE=* VERBOSE=1 RAILS_ENV=development
post_office: post_office --smtp 10025 --pop3 10110
(Note: Redis does not depend on Mongo here... just to demonstrate)
When a "foreman start" is executed it starts Mongo and PostOffice first, followed by Redis after 5 seconds and the worker and scheduler after 10.
This version of Foreman is backwards compatible, but raises some other issues / questions:
So... Have you had questions related to dependency before? Do you think this solution might be something that is to be included in a future version of Foreman?
And... thanks for this project! It really helps us improving our development workflow.
There isn't really any way to tell when something is "ready" other than detecting if it has bound to its assigned port. Not all processes bind to a port, and I'd rather not introduce this rather complex relationship into foreman.
If you were feeling so inclined you could have your processes wrapped with a script that watched for something else to become available before starting the intended process.
Cheers,
David
I would love this :( - I have a bunch of RTSPProxy and RTSPClient processes and I want to delay starting the clients.
Is it implemented yet?