capistrano-cable 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6b994fb2900c73d5d4afe2a12e7a7432e2a53611fd37ad2ac4534031a3bbd65
4
- data.tar.gz: bc7ee8750a36a2d613eaf7c9e8379da3d4d21cf5d69dffb40c5347eb0e8a8b07
3
+ metadata.gz: f72bb2750201ab8daf11827c5ebbbb6b95f876133ec9c41d0f84390a8a20f66e
4
+ data.tar.gz: 5279ffa62302ffb85b4b568c79243532fa66c950fb067bd23b73b318800602ec
5
5
  SHA512:
6
- metadata.gz: 78ddf453aeeadee09e1bfe8418f7435fbc8565fdfbb9131f47b4e8d8a1d06f6f57f4245ee0cf0d8b77450aab013a8ab9f9b46e82095572843e961bfe701dc7d8
7
- data.tar.gz: c094d0a7acda838ad3c219a29deee9226765213099a41a03d0176a98a75a0782ce6e57ae0f902904f4d71998abea30afea634a16d7e94a9a7645180790435f5b
6
+ metadata.gz: c5253f0c54f48c44f284be7a93497e40487af8585e4cd3fe27bb1cd45c9a67ced5cc84ce6fbf83495b7ce2e274e8bbbe28692205d582d9e1e9b43edd82455fd7
7
+ data.tar.gz: 931ab55287a48561c83d4c576c77caa5e8132da512807b276b9f563bf57ca1fb1d5de62eeb4a42ec78a0a3e3ea6c3c257c53b39feaa352ccb5d20fa91f701acf
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Capistrano::Cable
2
2
 
3
3
  **Capistrano::Cable** helps to deploy standalone ActionCable server with Puma over `systemd`.
4
+ It doesn't use a specific `puma.rb` for Puma configuration, it relies on given options.
4
5
 
5
6
  ## Installation
6
7
 
@@ -38,28 +39,29 @@ install_plugin Capistrano::Cable
38
39
  ```
39
40
 
40
41
  ### Config
42
+ Many options are available to customize the cable server configuration. Here are the main ones:
41
43
 
42
44
  ```ruby
43
45
  # config/deploy.rb or config/deploy/<stage>.rb
44
46
  set :cable_role, :web
47
+ set :cable_port, 29292
48
+ # set :cable_ssl_certificate
49
+ # set :cable_ssl_certificate_key
50
+ set :cable_rackup_file, 'cable/config.ru'
51
+ set :cable_dir, -> { File.join(release_path, "cable") }
52
+ set :cable_pidfile, -> { File.join(shared_path, "tmp", "pids", "cable.pid") }
45
53
  set :cable_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
46
- set :cable_access_log, -> { File.join(shared_path, 'log', 'cable.log') }
47
- set :cable_error_log, -> { File.join(shared_path, 'log', 'cable.log') }
48
-
49
- set :cable_systemctl_bin, -> { fetch(:systemctl_bin, '/bin/systemctl') }
50
- set :cable_service_unit_name, -> { "#{fetch(:application)}_cable_#{fetch(:stage)}" }
51
- set :cable_enable_socket_service, false
52
- # set :cable_bind, ... # Example: ->{ "unix:/path/to/cable.sock" }
53
-
54
+ set :cable_access_log, -> { File.join(shared_path, "log", "cable.access.log") }
55
+ set :cable_error_log, -> { File.join(shared_path, "log", "cable.error.log") }
56
+ set :cable_phased_restart, true
54
57
  set :cable_service_unit_env_files, -> { fetch(:service_unit_env_files, []) }
55
58
  set :cable_service_unit_env_vars, -> { fetch(:service_unit_env_vars, []) }
56
-
57
- set :cable_systemctl_user, -> { fetch(:systemctl_user, :user) }
58
- set :cable_enable_lingering, -> { fetch(:cable_systemctl_user) != :system }
59
- set :cable_lingering_user, -> { fetch(:lingering_user, fetch(:user)) }
60
-
61
- set :cable_service_templates_path, fetch(:service_templates_path, 'config/deploy/templates')
59
+ set :cable_service_templates_path, fetch(:service_templates_path, "config/deploy/templates")
62
60
  ```
61
+ See Capistrao::Cable::Systemd#set_defaults for more details.
62
+
63
+ To enable SSL, set the `cable_ssl_certificate` and `cable_ssl_certificate_key` options.
64
+ The both are required to enable SSL.
63
65
 
64
66
  ## Development
65
67
 
@@ -15,19 +15,13 @@ module Capistrano
15
15
  def set_defaults
16
16
  set_if_empty :cable_role, :web
17
17
  set_if_empty :cable_port, 29292
18
+ set_if_empty :cable_rackup_file, 'cable/config.ru'
18
19
  set_if_empty :cable_dir, -> { File.join(release_path, "cable") }
19
20
  set_if_empty :cable_pidfile, -> { File.join(shared_path, "tmp", "pids", "cable.pid") }
20
21
  set_if_empty :cable_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
21
22
  set_if_empty :cable_access_log, -> { File.join(shared_path, "log", "cable.access.log") }
22
23
  set_if_empty :cable_error_log, -> { File.join(shared_path, "log", "cable.error.log") }
23
-
24
- # Chruby, Rbenv and RVM integration
25
- append :chruby_map_bins, "puma", "pumactl" if fetch(:chruby_map_bins)
26
- append :rbenv_map_bins, "puma", "pumactl" if fetch(:rbenv_map_bins)
27
- append :rvm_map_bins, "puma", "pumactl" if fetch(:rvm_map_bins)
28
-
29
- # Bundler integration
30
- append :bundle_bins, "puma", "pumactl"
24
+ set_if_empty :cable_phased_restart, true
31
25
 
32
26
  set_if_empty :cable_systemctl_bin, -> { fetch(:systemctl_bin, "/bin/systemctl") }
33
27
  set_if_empty :cable_service_unit_name, -> { "#{fetch(:application)}_cable_#{fetch(:stage)}" }
@@ -43,6 +37,14 @@ module Capistrano
43
37
  set_if_empty :cable_lingering_user, -> { fetch(:lingering_user, fetch(:user)) }
44
38
 
45
39
  set_if_empty :cable_service_templates_path, fetch(:service_templates_path, "config/deploy/templates")
40
+
41
+ # Chruby, Rbenv and RVM integration
42
+ append :chruby_map_bins, "puma", "pumactl" if fetch(:chruby_map_bins)
43
+ append :rbenv_map_bins, "puma", "pumactl" if fetch(:rbenv_map_bins)
44
+ append :rvm_map_bins, "puma", "pumactl" if fetch(:rvm_map_bins)
45
+
46
+ # Bundler integration
47
+ append :bundle_bins, "puma", "pumactl"
46
48
  end
47
49
 
48
50
  def expanded_bundle_command
@@ -118,13 +120,12 @@ module Capistrano
118
120
  def puma_options
119
121
  options = []
120
122
  options << "--no-config"
121
- # options << "--dir #{fetch(:cable_dir)}" if fetch(:cable_dir) # or change WorkingDirectory in cable.service?
122
123
  if fetch(:cable_ssl_certificate) && fetch(:cable_ssl_certificate_key)
123
124
  options << "--bind 'ssl://0.0.0.0:#{fetch(:cable_port)}?key=#{fetch(:cable_ssl_certificate_key)}&cert=#{fetch(:cable_ssl_certificate)}'"
124
- # Can use: &verify_mode=none&ca=...
125
+ else
126
+ options << "--port #{fetch(:cable_port)}"
125
127
  end
126
128
  options << "--environment #{fetch(:cable_env)}"
127
- # options << "--port #{fetch(:cable_port)}"
128
129
  options << "--pidfile #{fetch(:cable_pidfile)}" if fetch(:cable_pidfile)
129
130
  options << "--threads #{fetch(:cable_threads)}" if fetch(:cable_threads)
130
131
  options << "--workers #{fetch(:cable_workers)}" if fetch(:cable_workers)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capistrano
4
4
  module Cable
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
@@ -20,7 +20,7 @@ WatchdogSec=30
20
20
  <%="User=#{cable_user(@role)}" if fetch(:cable_systemctl_user) == :system %>
21
21
  <%="PIDFile=#{fetch(:cable_pidfile)}" if fetch(:cable_pidfile) %>
22
22
  WorkingDirectory=<%= current_path %>
23
- ExecStart=<%= expanded_bundle_command %> exec puma <%= puma_options %> cable/config.ru
23
+ ExecStart=<%= expanded_bundle_command %> exec puma <%= puma_options %> <%= fetch(:cable_rackup_file) %>
24
24
  ExecReload=/bin/kill -USR1 $MAINPID
25
25
  Environment='RAILS_ENV=<%= fetch(:stage) %>'
26
26
  <% fetch(:default_env).reject{ |k, _| k.to_s == 'path' }.each do |variable, value| -%>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-cable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice TEXIER