capistrano-cable 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6b994fb2900c73d5d4afe2a12e7a7432e2a53611fd37ad2ac4534031a3bbd65
4
- data.tar.gz: bc7ee8750a36a2d613eaf7c9e8379da3d4d21cf5d69dffb40c5347eb0e8a8b07
3
+ metadata.gz: 7e1a47bf59656cff6458c37414595512d8fee87ad11ce021fa959f55d8ff8d96
4
+ data.tar.gz: 8760656360a1e0e92413131b47e125f0ae0d00c7421896955644ca210767f502
5
5
  SHA512:
6
- metadata.gz: 78ddf453aeeadee09e1bfe8418f7435fbc8565fdfbb9131f47b4e8d8a1d06f6f57f4245ee0cf0d8b77450aab013a8ab9f9b46e82095572843e961bfe701dc7d8
7
- data.tar.gz: c094d0a7acda838ad3c219a29deee9226765213099a41a03d0176a98a75a0782ce6e57ae0f902904f4d71998abea30afea634a16d7e94a9a7645180790435f5b
6
+ metadata.gz: 2603c3875d4e470ef7c27d3360f7904584add2ca644f209d74d04eab98411c3f802ba91f8df1949965ebf809cea3c21a921562a4fc271304ad79aeee19abde7a
7
+ data.tar.gz: f4f5d9d77e6800ee48a958519d7554e906fefbbcb5b9291dfb293ff8adfddb0cc07f71d744bae5173fbe4591b6e42fa776496cee9f3a00c59dab6408ed169a22
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.2"
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice TEXIER