Capistrano::Cable helps to deploy standalone ActionCable server with Puma over systemd.
It doesn't use a specific puma.rb for Puma configuration, it relies on given options.
Install the gem and add to the application's Gemfile by executing:
$ bundle add capistrano-cable
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install capistrano-cable
# Capfilerequire'capistrano/cable'install_pluginCapistrano::Cable::SystemdTo prevent loading the hooks of the plugin, add false to the load_hooks param.
# Capfileinstall_pluginCapistrano::Cable,load_hooks: false# Default cable tasks without hooksTo make it work with rvm, rbenv and chruby, install the plugin after corresponding library inclusion.
# Capfilerequire'capistrano/rbenv'require'capistrano/cable'install_pluginCapistrano::CableMany options are available to customize the cable server configuration. Here are the main ones:
# config/deploy.rb or config/deploy/<stage>.rbset:cable_role,:webset:cable_port,29292# set :cable_limit_nofile, 65536 # optional, to customize if `Errno::EMFILE: Too many open files` happens# set :cable_ssl_certificate# set :cable_ssl_certificate_keyset:cable_rackup_file,'cable/config.ru'set:cable_dir,->{File.join(release_path,"cable")}set:cable_pidfile,->{File.join(shared_path,"tmp","pids","cable.pid")}set:cable_env,->{fetch(:rack_env,fetch(:rails_env,fetch(:stage)))}set:cable_access_log,->{File.join(shared_path,"log","cable.access.log")}set:cable_error_log,->{File.join(shared_path,"log","cable.error.log")}set:cable_phased_restart,->{true}set:cable_service_unit_env_files,->{fetch(:service_unit_env_files,[])}set:cable_service_unit_env_vars,->{fetch(:service_unit_env_vars,[])}set:cable_service_templates_path,fetch(:service_templates_path,"config/deploy/templates")See Capistrao::Cable::Systemd#set_defaults for more details.
To enable SSL, set the cable_ssl_certificate and cable_ssl_certificate_key options.
The both are required to enable SSL.
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.
Bug reports and pull requests are welcome on GitHub at https://github.com/codeur/capistrano-cable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Largely inspired from capistrano-puma gem.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Capistrano::Cable project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.