Runs Rails migrations in a Redis-backed mutex.
If you deploy your application to multiple servers and do not use a deployment tool like Capistrano, this gems makes sure that only one of your servers run the database migrations.
Running Rails migrations on multiple instance at the same time should not cause any real trouble, because they are run inside transactions, but can cause excessive DB load and Ruby exceptions.
Run rake db:migrate:mutex
instead of rake db:migrate
to ensure that the migrations
are only run on one server at the same time.
Add the gem to your Gemfile:
gem 'rails_migrate_mutex'
If Redis.current
does not contain a valid Redis connection, you might need to set it manually:
# config/initializers/redis_classy.rb
RedisClassy.redis = Redis.new(...)
Feel free to fork and submit pull requests!
MIT, see LICENSE.txt
.