capistrano-cookbook 5.0.1 → 5.0.2
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/capistrano/cookbook.rb +3 -2
- data/lib/capistrano/cookbook/certbot.rb +1 -0
- data/lib/capistrano/cookbook/tasks/certbot.cap +9 -0
- data/lib/capistrano/cookbook/tasks/setup_config.cap +1 -0
- data/lib/capistrano/cookbook/version.rb +1 -1
- data/lib/generators/capistrano/reliably_deploying_rails/bootstrap_generator.rb +8 -0
- data/lib/generators/capistrano/reliably_deploying_rails/templates/deploy.rb.erb +6 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 460d15f3368c78001b83e7796c72a59fa79aa94343c38f3da70c3b3ff96d9638
|
4
|
+
data.tar.gz: 8d0dcdb74815085641a8261ec3e70ad9c0f89479afdb5912f6384e2479320260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ca03266e0bbf51396d2c5d761c6150ff12a2693f2d107e5f6b8b82efd37aa82d54e44011c14f501d20d929e0538c9a6818d579e6881f0aa0f012a340beaf6a0
|
7
|
+
data.tar.gz: db4ec41d34d1686705b6bd2e2dd7eb19bca928339106d76c6ab63336f7ece0461868ac7ba3c539b96c756170b366bbb6b00839158c761f0ef43a4f11b985253b
|
data/CHANGELOG.md
CHANGED
data/lib/capistrano/cookbook.rb
CHANGED
@@ -2,14 +2,15 @@ require "capistrano/cookbook/version"
|
|
2
2
|
|
3
3
|
module Capistrano
|
4
4
|
module Cookbook
|
5
|
+
require 'capistrano/cookbook/certbot'
|
5
6
|
require 'capistrano/cookbook/check_revision'
|
7
|
+
require 'capistrano/cookbook/create_database'
|
6
8
|
require 'capistrano/cookbook/logs'
|
7
9
|
require 'capistrano/cookbook/monit'
|
8
10
|
require 'capistrano/cookbook/nginx'
|
11
|
+
require 'capistrano/cookbook/puma_systemd'
|
9
12
|
require 'capistrano/cookbook/run_tests'
|
10
13
|
require 'capistrano/cookbook/setup_config'
|
11
|
-
require 'capistrano/cookbook/create_database'
|
12
|
-
require 'capistrano/cookbook/puma_systemd'
|
13
14
|
require 'capistrano/cookbook/sidekiq_systemd'
|
14
15
|
end
|
15
16
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("tasks/certbot.cap", File.dirname(__FILE__))
|
@@ -0,0 +1,9 @@
|
|
1
|
+
namespace :certbot do
|
2
|
+
desc "Setup certbot certificate for the domain defined in `nginx_server_name` in the stage file"
|
3
|
+
task :install do
|
4
|
+
on roles(:app) do
|
5
|
+
return unless fetch(:certbot_enable_ssl)
|
6
|
+
sudo "certbot --nginx -d #{fetch(:nginx_server_name)} --non-interactive --agree-tos --email #{fetch(:certbot_email)} #{fetch(:certbot_redirect_to_https) ? '--redirect' : ''} #{fetch(:certbot_use_acme_staging) ? '--dry-run' : ''}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -57,6 +57,7 @@ after 'deploy:setup_config', 'puma:nginx_config'
|
|
57
57
|
after 'deploy:setup_config', 'puma:monit:config'
|
58
58
|
after 'deploy:setup_config', 'puma:systemd:config'
|
59
59
|
after 'deploy:setup_config', 'puma:systemd:enable'
|
60
|
+
after 'deploy:setup_config', 'certbot:install'
|
60
61
|
|
61
62
|
# Enable the sidekiq systemd service so that it's started automatically on (re)boot
|
62
63
|
after 'deploy:setup_config', 'sidekiq:systemd:enable' if (defined?(Capistrano::Sidekiq) == 'constant' && Capistrano::Sidekiq.class == Class)
|
@@ -9,11 +9,19 @@ module Capistrano
|
|
9
9
|
class_option :sidekiq, type: :boolean, default: false
|
10
10
|
class_option :production_hostname, type: :string, default: nil
|
11
11
|
class_option :production_server_address, type: :string, default: nil
|
12
|
+
class_option :certbot_enable, type: :boolean, default: false
|
13
|
+
class_option :certbot_email, type: :string
|
12
14
|
|
13
15
|
def setup
|
14
16
|
@production_hostname = options[:production_hostname] || 'YOUR_PRODUCTION_HOSTNAME'
|
15
17
|
@production_server_address = options[:production_server_address] || 'YOUR_PRODUCTION_SERVER_ADDRESS'
|
16
18
|
@generate_sidekiq = options[:sidekiq]
|
19
|
+
@certbot_enable = options[:certbot_enable]
|
20
|
+
@certbot_email = options[:certbot_email]
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_domain
|
24
|
+
raise 'The `_` chatacter is not valid in domain names' if @production_hostname.include?('_')
|
17
25
|
end
|
18
26
|
|
19
27
|
def create_capfile
|
@@ -13,6 +13,12 @@ set :rbenv_ruby, '3.0.0'
|
|
13
13
|
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
|
14
14
|
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
|
15
15
|
|
16
|
+
# setup certbot for SSL via letsencrypt
|
17
|
+
set :certbot_enable_ssl, <%= @certbot_enable %>
|
18
|
+
set :certbot_redirect_to_https, true
|
19
|
+
set :certbot_email, "<%= @certbot_email %>"
|
20
|
+
set :certbot_use_acme_staging, false
|
21
|
+
|
16
22
|
# setup puma to operate in clustered mode, required for zero downtime deploys
|
17
23
|
set :puma_preload_app, false
|
18
24
|
set :puma_init_active_record, true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-cookbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Dixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/capistrano/.DS_Store
|
98
98
|
- lib/capistrano/cookbook.rb
|
99
99
|
- lib/capistrano/cookbook/.DS_Store
|
100
|
+
- lib/capistrano/cookbook/certbot.rb
|
100
101
|
- lib/capistrano/cookbook/check_revision.rb
|
101
102
|
- lib/capistrano/cookbook/compile_assets_locally.rb
|
102
103
|
- lib/capistrano/cookbook/create_database.rb
|
@@ -110,6 +111,7 @@ files:
|
|
110
111
|
- lib/capistrano/cookbook/run_tests.rb
|
111
112
|
- lib/capistrano/cookbook/setup_config.rb
|
112
113
|
- lib/capistrano/cookbook/sidekiq_systemd.rb
|
114
|
+
- lib/capistrano/cookbook/tasks/certbot.cap
|
113
115
|
- lib/capistrano/cookbook/tasks/check_revision.cap
|
114
116
|
- lib/capistrano/cookbook/tasks/compile_assets_locally.cap
|
115
117
|
- lib/capistrano/cookbook/tasks/create_database.cap
|