Capistrano Systemd integration for SolidQueue
Adds the following capistrano commands:
solid_queue:generate # Generate locally solid_queue systemd service unit file
solid_queue:disable # Disable solid_queue systemd service
solid_queue:enable # Enable solid_queue systemd service
solid_queue:install # Install solid_queue systemd service
solid_queue:reload # Reload solid_queue service via systemd
solid_queue:quiet # Quiet solid_queue service via systemd
solid_queue:restart # Restart solid_queue service via systemd
solid_queue:start # Start solid_queue service via systemd
solid_queue:status # Get solid_queue service status via systemd
solid_queue:stop # Stop solid_queue service via systemd
solid_queue:uninstall # Uninstall solid_queue systemd service
Installation
Add this line to your application's Gemfile:
group :development do
gem 'capistrano-solid_queue', require: false
end
And then execute:
$ bundle
# Capfile
require 'capistrano/solid_queue'
install_plugin Capistrano::SolidQueue::Systemd
To prevent loading the hooks of the plugin, add false to the load_hooks param.
# Capfile
install_plugin Capistrano::SolidQueue, load_hooks: false
Then run once
bundle exec cap production solid_queue:install
for the initial setup. This will copy a systemd
service definition to ~/.config/systemd/user/<application>_solid_queue_<stage>.service
on your server marked with Capistrano role db
.
It will also enable
it in systemd
, allowing to to then run commands such as:
systemctl --user status your_app_solid_queue_production
systemctl --user start your_app_solid_queue_production
systemctl --user stop your_app_solid_queue_production
systemctl --user reload your_app_solid_queue_production
systemctl --user restart your_app_solid_queue_production
through their Capistrano counterparts, ex: bundle exec cap solid_queue:restart
.
Usage
The plugin has registered a Capistrano hook
to run bundle exec cap solid_queue:restart
after deploy.
See #register_hooks
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/codeur/capistrano-solid_queue.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Capistrano::SolidQueue project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Credits
The structure and code of the gem are heavily inspired by capistrano-good_job
's systemd
tasks
and (How I) Deploy Solid Queue with Capistrano article from Rob Zolkos.