capistrano-pumaio 0.0.18 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d0b0c672da288bee3d70d326acbda3cf7fc7711f
4
+ data.tar.gz: 9ecea6e95e311556c76033c4713b49c2c2335cc3
5
+ SHA512:
6
+ metadata.gz: 1b5ae3786a9a677258da54f03ff75f0e752c50f5ee8fd33eaef252d1586403f5ef18e560bca01d2084012734ee3826589d91fe2c9fa9c0a182d2b14930a41ed9
7
+ data.tar.gz: f6ae8aaafc0a4a1003738e521eb5940233fa4817bb95d696779a13f5cce40e39a4a2ea45525497b4e724ae87bb7683346d5fb32b57225d7223463e31a9de01ce
data/Gemfile CHANGED
@@ -1,9 +1,10 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem "capistrano", ">= 2.15.5"
4
- gem 'capistrano-base_helper', ">= 0.0.11"
3
+ gem 'capistrano', '~> 3.4'
4
+ gem 'activesupport', '>= 3.0'
5
+ gem 'capistrano-monit_runit', '~> 3.0.1'
5
6
 
6
7
  group :development do
7
- gem "bundler", ">= 1.3.0"
8
- gem "jeweler", "~> 1.8.6"
8
+ gem 'bundler', '~> 1.7'
9
+ gem 'jeweler', '~> 2.0'
9
10
  end
data/Gemfile.lock CHANGED
@@ -1,69 +1,82 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.3.5)
4
+ activesupport (4.2.0)
5
+ i18n (~> 0.7)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
+ thread_safe (~> 0.3, >= 0.3.4)
9
+ tzinfo (~> 1.1)
10
+ addressable (2.3.7)
5
11
  builder (3.2.2)
6
- capistrano (2.15.5)
7
- highline
8
- net-scp (>= 1.0.0)
9
- net-sftp (>= 2.0.0)
10
- net-ssh (>= 2.0.14)
11
- net-ssh-gateway (>= 1.1.0)
12
- capistrano-base_helper (0.0.11)
13
- capistrano (>= 2.15.5)
14
- faraday (0.8.8)
15
- multipart-post (~> 1.2.0)
16
- git (1.2.5)
17
- github_api (0.10.1)
18
- addressable
19
- faraday (~> 0.8.1)
20
- hashie (>= 1.2)
21
- multi_json (~> 1.4)
22
- nokogiri (~> 1.5.2)
12
+ capistrano (3.4.0)
13
+ i18n
14
+ rake (>= 10.0.0)
15
+ sshkit (~> 1.3)
16
+ capistrano-monit_runit (3.0.1)
17
+ activesupport (>= 3.0)
18
+ capistrano (~> 3.4)
19
+ colorize (0.7.5)
20
+ descendants_tracker (0.0.4)
21
+ thread_safe (~> 0.3, >= 0.3.1)
22
+ faraday (0.9.1)
23
+ multipart-post (>= 1.2, < 3)
24
+ git (1.2.9.1)
25
+ github_api (0.12.3)
26
+ addressable (~> 2.3)
27
+ descendants_tracker (~> 0.0.4)
28
+ faraday (~> 0.8, < 0.10)
29
+ hashie (>= 3.3)
30
+ multi_json (>= 1.7.5, < 2.0)
31
+ nokogiri (~> 1.6.3)
23
32
  oauth2
24
- hashie (2.0.5)
25
- highline (1.6.19)
26
- httpauth (0.2.0)
27
- jeweler (1.8.6)
33
+ hashie (3.4.0)
34
+ highline (1.7.1)
35
+ i18n (0.7.0)
36
+ jeweler (2.0.1)
28
37
  builder
29
- bundler (~> 1.0)
38
+ bundler (>= 1.0)
30
39
  git (>= 1.2.5)
31
- github_api (= 0.10.1)
40
+ github_api
32
41
  highline (>= 1.6.15)
33
- nokogiri (= 1.5.10)
42
+ nokogiri (>= 1.5.10)
34
43
  rake
35
44
  rdoc
36
- json (1.8.0)
37
- jwt (0.1.8)
38
- multi_json (>= 1.5)
39
- multi_json (1.7.7)
40
- multi_xml (0.5.4)
41
- multipart-post (1.2.0)
42
- net-scp (1.1.2)
45
+ json (1.8.2)
46
+ jwt (1.4.1)
47
+ mini_portile (0.6.2)
48
+ minitest (5.5.1)
49
+ multi_json (1.11.0)
50
+ multi_xml (0.5.5)
51
+ multipart-post (2.0.0)
52
+ net-scp (1.2.1)
43
53
  net-ssh (>= 2.6.5)
44
- net-sftp (2.1.2)
45
- net-ssh (>= 2.6.5)
46
- net-ssh (2.6.8)
47
- net-ssh-gateway (1.2.0)
48
- net-ssh (>= 2.6.5)
49
- nokogiri (1.5.10)
50
- oauth2 (0.9.2)
51
- faraday (~> 0.8)
52
- httpauth (~> 0.2)
53
- jwt (~> 0.1.4)
54
- multi_json (~> 1.0)
54
+ net-ssh (2.9.2)
55
+ nokogiri (1.6.6.2)
56
+ mini_portile (~> 0.6.0)
57
+ oauth2 (1.0.0)
58
+ faraday (>= 0.8, < 0.10)
59
+ jwt (~> 1.0)
60
+ multi_json (~> 1.3)
55
61
  multi_xml (~> 0.5)
56
62
  rack (~> 1.2)
57
- rack (1.5.2)
58
- rake (10.1.0)
59
- rdoc (4.0.1)
60
- json (~> 1.4)
63
+ rack (1.6.0)
64
+ rake (10.4.2)
65
+ rdoc (4.2.0)
66
+ sshkit (1.7.1)
67
+ colorize (>= 0.7.0)
68
+ net-scp (>= 1.1.2)
69
+ net-ssh (>= 2.8.0)
70
+ thread_safe (0.3.5)
71
+ tzinfo (1.2.2)
72
+ thread_safe (~> 0.1)
61
73
 
62
74
  PLATFORMS
63
75
  ruby
64
76
 
65
77
  DEPENDENCIES
66
- bundler (>= 1.3.0)
67
- capistrano (>= 2.15.5)
68
- capistrano-base_helper (>= 0.0.11)
69
- jeweler (~> 1.8.6)
78
+ activesupport (>= 3.0)
79
+ bundler (~> 1.7)
80
+ capistrano (~> 3.4)
81
+ capistrano-monit_runit (~> 3.0.1)
82
+ jeweler (~> 2.0)
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Leif Ringstad
1
+ Copyright (c) 2013-2015 Leif Ringstad
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,22 +1,37 @@
1
1
  # Capistrano Recipes for Puma
2
2
 
3
- This gem provides recipes for [Puma](http://puma.io) to setup [runit](smarden.org/runit/), [monit](http://mmonit.com/monit) and [nginx](http://nginx.org) for both running and monitoring puma and a nginx site connected to a puma socket
3
+ This gem provides recipes for [Puma](http://puma.io) to setup [runit](http://smarden.org/runit/), [monit](http://mmonit.com/monit) and [nginx](http://nginx.org) for both running and monitoring puma and a nginx site connected to a puma socket
4
+
5
+ ## Versioning
6
+
7
+ Use 3.x for capistrano 3
8
+
9
+ For capistrano2, see the capistrano2 branch (will not be updated)
4
10
 
5
11
  ## Usage
6
12
 
7
13
 
8
- Add it to your Gemfile without requiring it
14
+ Add it to your Gemfile in the development section.
9
15
 
10
16
  ```ruby
11
- gem 'capistrano-pumaio'
17
+ gem 'capistrano-pumaio', require: false
12
18
  ```
13
19
 
14
- In your deploy.rb:
20
+ Now run ```bundle install```
21
+
22
+ Add this to your Capfile:
15
23
 
16
24
  ```ruby
17
25
  require 'capistrano/puma'
18
26
  ```
19
27
 
28
+ Create a new file in in /etc/sudoers.d/ and add the output of the following commands:
29
+
30
+ ```
31
+ cap production runit:sudoers
32
+ cap production monit:sudoers
33
+ cap production puma:nginx:sudoers
34
+ ```
20
35
 
21
36
  ### Monit
22
37
 
@@ -108,7 +123,7 @@ See nginx.rb for configuration options.
108
123
  #### Notes when using nginx
109
124
 
110
125
 
111
- puma:nginx:setup is setup to run automatically after deploy:setup, and you will be asked if you want to enable the site.
126
+ You have to run ``` cap production puma:nginx:setup ``` to automatically setup nginx.
112
127
 
113
128
  If you do not enable the site during setup, be sure to run the following two commands when you want to enable your site:
114
129
 
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ begin
6
6
  Bundler.setup(:default, :development)
7
7
  rescue Bundler::BundlerError => e
8
8
  $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
9
+ $stderr.puts 'Run `bundle install` to install missing gems'
10
10
  exit e.status_code
11
11
  end
12
12
  require 'rake'
@@ -14,24 +14,26 @@ require 'rake'
14
14
  require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "capistrano-pumaio"
18
- gem.homepage = "https://github.com/leifcr/capistrano-puma"
19
- gem.license = "MIT"
20
- gem.summary = %Q{Capistrano recipes for puma using runit and monit}
21
- gem.description = %Q{Capistrano recipes for puma using runit and monit.}
22
- gem.email = "leifcr@gmail.com"
23
- gem.authors = ["Leif Ringstad"]
24
- gem.files.exclude ".ruby-*"
17
+ gem.name = 'capistrano-pumaio'
18
+ gem.homepage = 'https://github.com/leifcr/capistrano-puma'
19
+ gem.license = 'MIT'
20
+ gem.summary = 'Capistrano recipes for puma using runit and monit'
21
+ gem.description = 'Capistrano recipes for puma using runit and monit. Includes nginx recipes for the app server.'
22
+ gem.email = 'leifcr@gmail.com'
23
+ gem.authors = ['Leif Ringstad']
24
+ gem.files.exclude '.ruby-*'
25
+ gem.files.exclude '*.sublime-project'
26
+ gem.files.exclude '.rubocop.yml'
25
27
  # dependencies defined in Gemfile
26
28
  end
27
29
  Jeweler::RubygemsDotOrgTasks.new
28
30
 
29
31
  # require 'rdoc/task'
30
32
  # Rake::RDocTask.new do |rdoc|
31
- # version = File.exist?('VERSION') ? File.read('VERSION') : ""
33
+ # version = File.exist?('VERSION') ? File.read('VERSION') : ''
32
34
 
33
35
  # rdoc.rdoc_dir = 'rdoc'
34
- # rdoc.title = "capistrano-empty #{version}"
36
+ # rdoc.title = 'capistrano-empty #{version}'
35
37
  # rdoc.rdoc_files.include('README*')
36
38
  # rdoc.rdoc_files.include('lib/**/*.rb')
37
39
  # end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.18
1
+ 3.0.0
@@ -2,15 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: capistrano-pumaio 3.0.0 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "capistrano-pumaio"
8
- s.version = "0.0.18"
9
+ s.version = "3.0.0"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Leif Ringstad"]
12
- s.date = "2013-08-01"
13
- s.description = "Capistrano recipes for puma using runit and monit."
14
+ s.date = "2015-03-26"
15
+ s.description = "Capistrano recipes for puma using runit and monit. Includes nginx recipes for the app server."
14
16
  s.email = "leifcr@gmail.com"
15
17
  s.extra_rdoc_files = [
16
18
  "LICENSE",
@@ -24,45 +26,51 @@ Gem::Specification.new do |s|
24
26
  "Rakefile",
25
27
  "VERSION",
26
28
  "capistrano-pumaio.gemspec",
29
+ "lib/capistrano/helpers/puma/monit.rb",
30
+ "lib/capistrano/helpers/puma/nginx.rb",
31
+ "lib/capistrano/helpers/puma/template_paths.rb",
27
32
  "lib/capistrano/puma.rb",
28
- "lib/capistrano/puma/config.rb",
29
- "lib/capistrano/puma/monit.rb",
30
- "lib/capistrano/puma/nginx.rb",
31
- "lib/capistrano/puma/runit.rb",
33
+ "lib/capistrano/tasks/config.rake",
34
+ "lib/capistrano/tasks/monit.rake",
35
+ "lib/capistrano/tasks/nginx.rake",
36
+ "lib/capistrano/tasks/nginx_config.rake",
37
+ "lib/capistrano/tasks/runit.rake",
32
38
  "templates/monit/puma.conf.erb",
33
39
  "templates/nginx/application.conf.erb",
34
40
  "templates/nginx/htpasswd.erb",
35
- "templates/runit/config.rb.erb",
36
- "templates/runit/control-q.erb",
41
+ "templates/puma-config.rb.erb",
42
+ "templates/runit/control/q.erb",
37
43
  "templates/runit/finish.erb",
38
- "templates/runit/log-run.erb",
44
+ "templates/runit/log/run.erb",
39
45
  "templates/runit/run.erb"
40
46
  ]
41
47
  s.homepage = "https://github.com/leifcr/capistrano-puma"
42
48
  s.licenses = ["MIT"]
43
- s.require_paths = ["lib"]
44
- s.rubygems_version = "1.8.25"
49
+ s.rubygems_version = "2.4.6"
45
50
  s.summary = "Capistrano recipes for puma using runit and monit"
46
51
 
47
52
  if s.respond_to? :specification_version then
48
- s.specification_version = 3
53
+ s.specification_version = 4
49
54
 
50
55
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<capistrano>, [">= 2.15.5"])
52
- s.add_runtime_dependency(%q<capistrano-base_helper>, [">= 0.0.11"])
53
- s.add_development_dependency(%q<bundler>, [">= 1.3.0"])
54
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.6"])
56
+ s.add_runtime_dependency(%q<capistrano>, ["~> 3.4"])
57
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
58
+ s.add_runtime_dependency(%q<capistrano-monit_runit>, ["~> 3.0.1"])
59
+ s.add_development_dependency(%q<bundler>, ["~> 1.7"])
60
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
55
61
  else
56
- s.add_dependency(%q<capistrano>, [">= 2.15.5"])
57
- s.add_dependency(%q<capistrano-base_helper>, [">= 0.0.11"])
58
- s.add_dependency(%q<bundler>, [">= 1.3.0"])
59
- s.add_dependency(%q<jeweler>, ["~> 1.8.6"])
62
+ s.add_dependency(%q<capistrano>, ["~> 3.4"])
63
+ s.add_dependency(%q<activesupport>, [">= 3.0"])
64
+ s.add_dependency(%q<capistrano-monit_runit>, ["~> 3.0.1"])
65
+ s.add_dependency(%q<bundler>, ["~> 1.7"])
66
+ s.add_dependency(%q<jeweler>, ["~> 2.0"])
60
67
  end
61
68
  else
62
- s.add_dependency(%q<capistrano>, [">= 2.15.5"])
63
- s.add_dependency(%q<capistrano-base_helper>, [">= 0.0.11"])
64
- s.add_dependency(%q<bundler>, [">= 1.3.0"])
65
- s.add_dependency(%q<jeweler>, ["~> 1.8.6"])
69
+ s.add_dependency(%q<capistrano>, ["~> 3.4"])
70
+ s.add_dependency(%q<activesupport>, [">= 3.0"])
71
+ s.add_dependency(%q<capistrano-monit_runit>, ["~> 3.0.1"])
72
+ s.add_dependency(%q<bundler>, ["~> 1.7"])
73
+ s.add_dependency(%q<jeweler>, ["~> 2.0"])
66
74
  end
67
75
  end
68
76
 
@@ -0,0 +1,20 @@
1
+ module Capistrano
2
+ module Helpers
3
+ module Puma
4
+ ##
5
+ # Module Monit provides helpers for Monit/Puma combination
6
+ ##
7
+ module Monit
8
+ module_function
9
+
10
+ def available_configuration_with_path
11
+ File.join(fetch(:monit_available_path), "#{fetch(:puma_runit_service_name)}.conf")
12
+ end
13
+
14
+ def available_configuration_file
15
+ "#{fetch(:puma_runit_service_name)}.conf"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ module Capistrano
2
+ module Helpers
3
+ module Puma
4
+ module Nginx
5
+ def default_pw_generator
6
+ pw = SecureRandom.random_number(36**10).to_s(36).rjust(10, '0')
7
+ info "Random password generated: #{pw}"
8
+ pw
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ module Capistrano
2
+ module Helpers
3
+ module Puma
4
+ ##
5
+ # Paths for templates
6
+ #
7
+ module TemplatePaths
8
+ module_function
9
+
10
+ def template_base_path
11
+ File.expand_path(File.join(File.dirname(__FILE__), '../../../../templates'))
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -6,6 +6,16 @@ def try_require(library)
6
6
  end
7
7
  end
8
8
 
9
- try_require 'capistrano/puma/config'
10
- try_require 'capistrano/puma/runit'
11
- try_require 'capistrano/puma/monit'
9
+ # try_require 'tasks/config.rake'
10
+ # try_require 'tasks/monit.rake'
11
+ # try_require 'tasks/runit.rake'
12
+ # try_require 'tasks/nginx_config.rake'
13
+ # try_require 'tasks/nginx.rake'
14
+ # try_require 'tasks/.rake'
15
+ try_require 'capistrano/monit'
16
+ try_require 'capistrano/runit'
17
+ load File.expand_path('../tasks/config.rake', __FILE__)
18
+ load File.expand_path('../tasks/monit.rake', __FILE__)
19
+ load File.expand_path('../tasks/runit.rake', __FILE__)
20
+ load File.expand_path('../tasks/nginx_config.rake', __FILE__)
21
+ load File.expand_path('../tasks/nginx.rake', __FILE__)
@@ -0,0 +1,68 @@
1
+ require 'capistrano/runit'
2
+ require 'capistrano/helpers/puma/template_paths'
3
+ include Capistrano::DSL::BasePaths
4
+ include Capistrano::DSL::RunitPaths
5
+ include Capistrano::Helpers::Base
6
+ include Capistrano::Helpers::Runit
7
+
8
+ namespace :load do
9
+ task :defaults do
10
+ # Puma Configuration
11
+ set :puma_runit_service_name, 'puma'
12
+ set :puma_workers, 2 # Must use a minimum of 1 worker (cluster mode, else restart/stop fails in the state file?)
13
+ set :puma_min_threads, 8
14
+ set :puma_max_threads, 8
15
+
16
+ set :puma_bin, 'bundle exec puma'
17
+ set :puma_control, 'bundle exec pumactl'
18
+
19
+ # Control files
20
+ set :puma_socket_file, proc { "#{File.join(fetch(:sockets_path), 'puma.sock')}" }
21
+ set :puma_socket_url, proc { "unix://#{fetch(:puma_socket_file)}" }
22
+ set :puma_pid_file, proc { File.join(fetch(:pids_path), 'puma.pid') }
23
+ set :puma_state_file, proc { File.join(fetch(:sockets_path), 'puma.state') }
24
+ set :puma_control_file, proc { "#{File.join(fetch(:sockets_path), 'pumactl.sock')}" }
25
+ set :puma_control_url, proc { "unix://#{fetch(:puma_control_file)}" }
26
+
27
+ # This must be set to false if phased restarts should be used
28
+ set :puma_use_preload_app, false
29
+
30
+ set :pruma_prune_bundler, true
31
+
32
+ set :puma_activate_control_app, true
33
+
34
+ set :puma_on_restart_active, true
35
+
36
+ # Logging to path
37
+ set :puma_log_path, proc { runit_var_log_service_single_service_path(fetch(:puma_runit_service_name)) }
38
+
39
+ # Configuration files
40
+ set :puma_config_template, File.join(Capistrano::Helpers::Puma::TemplatePaths.template_base_path, 'puma-config.rb.erb')
41
+
42
+ # The remote location of puma's config file. Used by runit when starting puma
43
+ set :puma_remote_config_folder, proc { shared_path.join('config') }
44
+ set :puma_config_file, proc { File.join(fetch(:puma_remote_config_folder), 'puma.rb') }
45
+
46
+ # runit defaults
47
+ set :puma_restart_interval, proc { fetch(:runit_restart_interval) }
48
+ set :puma_restart_count, proc { fetch(:runit_restart_count) }
49
+ set :puma_autorestart_clear_interval, proc { fetch(:runit_autorestart_clear_interval) }
50
+
51
+ # runit paths
52
+ set :puma_runit_run_template, File.join(Capistrano::Helpers::Puma::TemplatePaths.template_base_path, 'runit', 'run.erb')
53
+ set :puma_runit_finish_template, File.join(Capistrano::Helpers::Puma::TemplatePaths.template_base_path, 'runit', 'finish.erb') # rubocop:disable Metrics/LineLength
54
+ set :puma_runit_control_q_template, File.join(Capistrano::Helpers::Puma::TemplatePaths.template_base_path, 'runit', 'control', 'q.erb') # rubocop:disable Metrics/LineLength
55
+ set :puma_runit_log_run_template, File.join(Capistrano::Helpers::Puma::TemplatePaths.template_base_path, 'runit', 'log', 'run.erb') # rubocop:disable Metrics/LineLength
56
+
57
+ # monit configuration
58
+ set :puma_monit_service_name, proc { "#{user_app_env_underscore}_puma" }
59
+ set :puma_monit_start_command, proc { "/bin/bash -c '[ ! -h #{runit_service_path(fetch(:puma_runit_service_name))}/run ] || /usr/bin/sv start #{runit_service_path(fetch(:puma_runit_service_name))}'" } # rubocop:disable Metrics/LineLength
60
+ set :puma_monit_stop_command, proc { "/usr/bin/sv -w 12 force-stop #{runit_service_path(fetch(:puma_runit_service_name))}" } # rubocop:disable Metrics/LineLength
61
+ set :puma_monit_memory_alert_threshold, '150.0 MB for 2 cycles'
62
+ set :puma_monit_memory_restart_threshold, '175.0 MB for 3 cycles'
63
+ set :puma_monit_cpu_alert_threshold, '90% for 2 cycles'
64
+ set :puma_monit_cpu_restart_threshold, '95% for 5 cycles'
65
+
66
+ set :puma_monit_config_template, File.join(Capistrano::Helpers::Puma::TemplatePaths.template_base_path, 'monit', 'puma.conf.erb') # rubocop:disable Metrics/LineLength
67
+ end
68
+ end