Search code examples
ruby-on-railsrubyrakerails-migrationsrake-task

Rails: How to manage rake tasks likewise migrations


I have rails app deployed over multiple instances and had too many rake tasks to run over different instances so it is hard to manage which rake tasks is already run or which one remaining.

is there any way to manage it from db side, as schema_migrations table managed by migrations. if yes then, i want know how migrations exactly works?.

any suggestions?.


Solution

    1. Correct way: use deploy automation. Capistrano is a good choice. Then you'll never need to worry about things like running rake task
    2. I think the rake tasks should have no side effects if you execute it multiple times. If the task is implemented that way, then there's no need to worry about which has been done and which is not.
    3. I think if you want to get a status tracking for the Rake Task, a simple way is to implemented a model to record the execution status of the rake task, and update the model each time rake task is done.