rocketeers / rocketeer

Send your projects up in the clouds
http://rocketeer.autopergamene.eu/
MIT License
2.66k stars 217 forks source link

Run task on only one server of a multiserver connection #577

Open adamlevenson opened 9 years ago

adamlevenson commented 9 years ago

Is there a way to run a task on ONLY one of the servers in a multi-server setup? For example we deploy code to 3 servers but need to update cron configuration only on the first server.

nicolas-bastien commented 9 years ago

Any answer ?

Same example with two front server and want to run database migration on the main only

mjanda commented 9 years ago

There is use_roles and db_role (for migrations) in config.php. Comment:

    /*
     * In most multiserver scenarios, migrations must be run in an exclusive server.
     * In the event of not having a separate database server (in which case it can
     * be handled through connections), you can assign a 'db_role' => true to the
     * server's configuration and it will only run the migrations in that specific
     * server at the time of deployment.
     */

Not sure how that works in practice.

adamlevenson commented 9 years ago

Yeah and it doesn't help me as the application is not laravel so I am trying to run it a different way than via a db migration. I have a couple other ideas to hack it, but might just do it right. :)

mjanda commented 9 years ago

Check rocketeer source code to see how it's used...seems pretty straightforward.