capistrano-passenger 0.0.2 → 0.2.1

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
- SHA1:
3
- metadata.gz: 4f8fd2477d085bb6bdc41b2a2eec100fa3a92b2e
4
- data.tar.gz: e4cf76f579ecb5d76c50d7da1d260335a1f6550e
2
+ SHA256:
3
+ metadata.gz: e2ad7cbc81a6b3ba09065f752e9d3f0d5dc0d082d0f728d6b47211c494d92442
4
+ data.tar.gz: 22793cd5dc2245698ded45b556472f93c41ffb7bb9e08f8339c1adc28e3dc6bd
5
5
  SHA512:
6
- metadata.gz: 948bf4c42d4cf7975a17e92479c1d2f055ecd9310a7cdf18a19d1c68f48d6154ea04ef0f18254983c15997589faaa2254a0c2c12e5df52ba04ff8afec4be2081
7
- data.tar.gz: 70b6e897b3e4ca05f2e9e16f5742964e54d5b56ec28f70400bffaca74e4c974aa241310d9c6175a0f5a934179b2fbb9352b577184a597a8fde240ce19d0de5fb
6
+ metadata.gz: 26633fb785143309de16735414d4d9e5c895a46e7fd6b8a721658a5159c291f4f0238176b7e7d129cc6fedfb11b6b57f3cf8d0f0c801fdad0f55f7609a6947dc
7
+ data.tar.gz: c2078c3c341b4f7adbf5a231ceae1968ff7c131d2730159a81fde57e05d62e758bf95f0fcd666e9788a65b115f01065f7d6b4bb90f151b4400311838592fc5f9
data/CHANGELOG.md CHANGED
@@ -1,7 +1,49 @@
1
+ # Not released yet
2
+
3
+ # 0.2.1 (5 Apr 2021)
4
+ * Made passenger-status use the same Command Map prefixes as passenger and passenger-config.
5
+ Even though it's not used in this project by default, it may be useful in some cases,
6
+ such as when someone needs to determine the passenger instance ID
7
+ * Only run passenger commands from the release_path if passenger is in the Gemfile.
8
+ Otherwise, it may be in a gemset that conflicts with a .ruby-gemset file in release_path.
9
+
10
+ # 0.2.0 (8 Dec 2015)
11
+ * Added support for passenger versions > 5.0.20
12
+
13
+ # 0.1.1 (30 June 2015)
14
+ * Bug fixes:
15
+ * When detecting passenger version, we account for the fact the the version may not be on the first line of the captured output (@pzgz, capistrano/passenger#20)
16
+ * When executing the restart command without sudo, we make sure the first argument to execute is still a Symbol so that the command is executed in the appropriate directory (@FooBarWidget, capistrano/passenger#27)
17
+
18
+ # 0.1.0 (3 June 2015)
19
+
20
+ * BREAKING CHANGES
21
+ * On version of passenger that support both restarting by touch and restarting with passenger-config, the default is to use passenger-config. set :passenger_restart_with_touch to true to opt out of this.
22
+ * Bug fixes:
23
+ * Restored support for CHRuby (@aeons, capistrano/passenger#16)
24
+ * Restored support for passenger installed by bundle (@betesh, capistrano/passenger#10)
25
+
26
+ # 0.0.5 (12 Apr 2015)
27
+
28
+ * Bug fixes:
29
+ * When restarting passenger without sudo, made it nevertheless use command map (@betesh, capistrano/passenger#8)
30
+ * We now check whether passenger is installed outside of RVM and use the system installation if it is found. Otherwise, the user can specify which version of RVM passenger was installed with if it is not the default.
31
+
32
+ * Command map prefixes for rbenv are automatically added now
33
+
34
+ # 0.0.4 (26 Mar 2015)
35
+
36
+ * Bug fixes:
37
+ * rvm:hook task was being called even if it wasn't defined (@betesh, capistrano/passenger#5)
38
+
39
+ # 0.0.3 (25 Mar 2015)
40
+
41
+ * Passenger 5 support (@pjkelly, capistrano/passenger#4)
42
+
1
43
  # 0.0.2 (10 Feb 2015)
2
44
 
3
45
  Bugfixes:
4
- * If directory doesn't exist, it's created during task (@powertoaster, #1)
46
+ * If directory doesn't exist, it's created during task (@powertoaster, capistrano/passenger#1)
5
47
 
6
48
  # 0.0.1 (7 Aug 2014)
7
49
 
data/README.md CHANGED
@@ -1,51 +1,111 @@
1
1
  # Capistrano::Passenger
2
2
 
3
- Adds a task to restart your application after deployment via Capistrano:
4
-
5
- * cap production deploy:restart
3
+ Adds a task to restart your application after deployment via Capistrano. Supports Passenger versions 6 and lower.
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
- gem 'capistrano-passenger'
9
+ ``` ruby
10
+ gem 'capistrano-passenger'
11
+ ```
12
12
 
13
13
  And then execute:
14
14
 
15
- $ bundle
15
+ ``` bash
16
+ $ bundle
17
+ ```
16
18
 
17
19
  Or install it yourself as:
18
20
 
19
- $ gem install capistrano-passenger
21
+ ``` bash
22
+ $ gem install capistrano-passenger
23
+ ```
20
24
 
21
25
  ## Usage
22
26
 
23
- Adding this line to your `Capfile` will load the default configuration and make the task run after `deploy:publishing`:
27
+ Add this line to your `Capfile` and `deploy:restart` will be setup to automatically run after `:publishing` is complete:
28
+
29
+ ``` ruby
30
+ require 'capistrano/passenger'
31
+ ```
32
+
33
+ You can also run the underlying task in isolation:
34
+
35
+ ``` bash
36
+ # Restart your Passenger application.
37
+ # The restart mechanism used is based on the version of Passenger installed on your server.
38
+ $ cap production passenger:restart
39
+ # Alternatively:
40
+ $ cap production deploy:restart
41
+ ```
42
+
43
+ If you want the task to run at a different point in your deployment, require `capistrano/passenger/no_hook` instead of `capistrano/passenger` and then add your own hook in `config/deploy.rb`. When using this gem in this way, you must use `passenger:restart`--the `deploy:restart` alias is not available. Example:
24
44
 
25
- require 'capistrano/passenger'
45
+ ``` ruby
46
+ # Capfile
47
+ require 'capistrano/passenger/no_hook'
26
48
 
27
- You can also run the task in isolation:
49
+ # config/deploy.rb
50
+ after :some_other_task, :'passenger:restart'
51
+ ```
28
52
 
29
- $ cap production deploy:restart
53
+ Configurable options and their defaults:
30
54
 
31
- Configurable options:
55
+ ``` ruby
56
+ set :passenger_roles, :app
57
+ set :passenger_restart_runner, :sequence
58
+ set :passenger_restart_wait, 5
59
+ set :passenger_restart_limit, 2
60
+ set :passenger_restart_with_sudo, false
61
+ set :passenger_environment_variables, {}
62
+ set :passenger_restart_command, 'passenger-config restart-app'
63
+ set :passenger_restart_options, -> { "#{deploy_to} --ignore-app-not-running" }
64
+ ```
32
65
 
33
- set :passenger_roles, :app # this is default
34
- set :passenger_restart_runner, :sequence # this is default
35
- set :passenger_restart_wait, 5 # this is default
36
- set :passenger_restart_limit, 2 # this is default
66
+ ### Restarting Your Passenger Application
67
+
68
+ In most cases, the default settings should just work for most people. This plugin checks the version of passenger you're running on your server(s) and invokes the appropriate restart mechanism based on that.
37
69
 
38
70
  `passenger_restart_wait` and `passenger_restart_limit` are passed to the `on` block when restarting the application:
39
71
 
40
- on roles(fetch(:passenger_roles)), in: fetch(:passenger_restart_runner), wait: fetch(:passenger_restart_wait), limit: fetch(:passenger_restart_limit) do
41
- execute :touch, release_path.join('tmp/restart.txt')
42
- end
72
+ ``` ruby
73
+ on roles(fetch(:passenger_roles)), in: fetch(:passenger_restart_runner), wait: fetch(:passenger_restart_wait), limit: fetch(:passenger_restart_limit) do
74
+ with fetch(:passenger_environment_variables) do
75
+ # Version-specific restart happens here.
76
+ end
77
+ end
78
+ ```
79
+
80
+ Note that `passenger_restart_limit` has no effect if you are using the default `passenger_restart_runner` of `:sequence`. sshkit only looks at it when the runner is `:groups`.
81
+
82
+ `:passenger_environment_variables` is available if anything about your environment is not available to the user deploying your application. One use-case for this is when `passenger-config` isn't available in your user's `PATH` on the server. You could override it like so:
83
+
84
+ ``` ruby
85
+ set :passenger_environment_variables, { :path => '/your/path/to/passenger/bin:$PATH' }
86
+ ```
87
+
88
+ ### Note for RVM users
89
+
90
+ https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#_when_the_system_has_multiple_ruby_interpreters descibes how "Once installed, you can run Phusion Passenger’s Ruby parts under any Ruby interpreter you want, even if that Ruby interpreter was not the one you originally installed Phusion Passenger with. [...] There is however one caveat if you happen to be using RVM or RVM gemsets. When you gem install Phusion Passenger using RVM," it is available only to the Ruby version where it was installed. Therefore, if you are using RVM **AND** passenger was installed via RVM **AND** it was installed under a different version of RVM than `fetch(:rvm_ruby_version)`, you need to `set :passenger_rvm_ruby_version` in your `config/deploy.rb`.
91
+
92
+ ### Note for Standalone Passenger users
93
+
94
+ If you are running passenger in standalone mode, it is possible for you to put passenger in your Gemfile and rely on capistrano-bundler to install it with the rest of your bundle. If you are installing passenger during your deployment **AND** you are using the new restart method (see below), you need to set `:passenger_in_gemfile` to `true` in your `config/deploy.rb`.
95
+
96
+ ### Restarting Passenger >= 4.0.33 Applications
97
+
98
+ Passenger 4.0.33 introduced a new way to restart your application, and thus has some additional configuration options to accomodate for various server environments.
99
+
100
+ If you need to pass additional/different options to `:passenger_restart_command`, simply override `:passenger_restart_options`.
101
+
102
+ If you require `sudo` when restarting passenger, set `:passenger_restart_with_sudo` to `true`. **Note**: This option has no effect when restarting Passenger <= 4.0.32 applications.
43
103
 
44
- Note that `passenger_restart_limit` has no effect if you are using the default `passenger_restart_runner` of `:sequence`. sshkit only looks at it when the runner is `:group`.
104
+ To opt out of the new way to restart, and use the deprecated approach instead, set `:passenger_restart_with_touch` to `true`.
45
105
 
46
106
  ## Contributing
47
107
 
48
- 1. Fork it ( https://github.com/betesh/capistrano-passenger/fork )
108
+ 1. Fork it ( https://github.com/capistrano/passenger/fork )
49
109
  2. Create your feature branch (`git checkout -b my-new-feature`)
50
110
  3. Commit your changes (`git commit -am 'Add some feature'`)
51
111
  4. Push to the branch (`git push origin my-new-feature`)
@@ -21,4 +21,32 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "capistrano", "~> 3.0"
22
22
  spec.add_development_dependency "bundler", "~> 1.6"
23
23
  spec.add_development_dependency "rake"
24
+ spec.post_install_message = <<PIM
25
+ ==== Release notes for capistrano-passenger ====
26
+ passenger once had only one way to restart: `touch tmp/restart.txt`
27
+ Beginning with passenger v4.0.33, a new way was introduced: `passenger-config restart-app`
28
+
29
+ The new way to restart was not initially practical for everyone,
30
+ since for versions of passenger prior to v5.0.10,
31
+ it required your deployment user to have sudo access for some server configurations.
32
+
33
+ capistrano-passenger gives you the flexibility to choose your restart approach, or to rely on reasonable defaults.
34
+
35
+ If you want to restart using `touch tmp/restart.txt`, add this to your config/deploy.rb:
36
+
37
+ set :passenger_restart_with_touch, true
38
+
39
+ If you want to restart using `passenger-config restart-app`, add this to your config/deploy.rb:
40
+
41
+ set :passenger_restart_with_touch, false # Note that `nil` is NOT the same as `false` here
42
+
43
+ If you don't set `:passenger_restart_with_touch`, capistrano-passenger will check what version of passenger you are running
44
+ and use `passenger-config restart-app` if it is available in that version.
45
+
46
+ If you are running passenger in standalone mode, it is possible for you to put passenger in your
47
+ Gemfile and rely on capistrano-bundler to install it with the rest of your bundle.
48
+ If you are installing passenger during your deployment AND you want to restart using `passenger-config restart-app`,
49
+ you need to set `:passenger_in_gemfile` to `true` in your `config/deploy.rb`.
50
+ ================================================
51
+ PIM
24
52
  end
@@ -1 +1 @@
1
- load File.expand_path('../tasks/passenger.cap', __FILE__)
1
+ load File.expand_path('../tasks/deploy_passenger.cap', __FILE__)
@@ -0,0 +1 @@
1
+ load File.expand_path('../../tasks/passenger.cap', __FILE__)
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Passenger
3
- VERSION = "0.0.2"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -0,0 +1,9 @@
1
+ load File.expand_path('../passenger.cap', __FILE__)
2
+
3
+ namespace :deploy do
4
+ desc 'Restart your Passenger application'
5
+ task :restart do
6
+ invoke('passenger:restart')
7
+ end
8
+ after :publishing, :'deploy:restart'
9
+ end
@@ -1,12 +1,86 @@
1
- namespace :deploy do
2
- desc 'Restart application'
1
+ namespace :passenger do
2
+ desc 'Restart your Passenger application'
3
3
  task :restart do
4
+ restart_with_touch = fetch(:passenger_restart_with_touch, nil)
5
+ if restart_with_touch.nil? && fetch(:sshkit_backend) == SSHKit::Backend::Printer
6
+ run_locally do
7
+ fatal "In a dry run, we cannot check the passenger version, and therefore can't guess which passenger restart method to use. Therefore, using --dry-run without setting `passenger_restart_with_touch` to either `true` or `false` is not supported."
8
+ end
9
+ exit
10
+ end
4
11
  on roles(fetch(:passenger_roles)), in: fetch(:passenger_restart_runner), wait: fetch(:passenger_restart_wait), limit: fetch(:passenger_restart_limit) do
5
- execute :mkdir, '-p', release_path.join('tmp')
6
- execute :touch, release_path.join('tmp/restart.txt')
12
+ with fetch(:passenger_environment_variables) do
13
+ within(fetch(:passenger_in_gemfile, false) ? release_path : capture(:pwd)) do
14
+ if restart_with_touch.nil?
15
+ # 'passenger -v' may output one of the following depending on the version:
16
+ # Phusion Passenger version x.x.x
17
+ # Phusion Passenger Enterprise version x.x.x
18
+ # Phusion Passenger x.x.x
19
+ # Phusion Passenger Enterprise x.x.x
20
+ # and it may have a (R) after Passenger
21
+ passenger_version = capture(:passenger, '-v').match(/^Phusion Passenger(\(R\))? (Enterprise )?(version )?(.*)$/)[4]
22
+ restart_with_touch = Gem::Version.new(passenger_version) < Gem::Version.new('4.0.33')
23
+ end
24
+
25
+ if restart_with_touch
26
+ execute :mkdir, '-p', release_path.join('tmp')
27
+ execute :touch, release_path.join('tmp/restart.txt')
28
+ else
29
+ restart_command = fetch(:passenger_restart_command).split(" ").collect(&:to_sym) << fetch(:passenger_restart_options)
30
+ if fetch(:passenger_restart_with_sudo)
31
+ # We preprocess the command with SSHKit::Command to allow 'passenger-config' to be transformed with the command map.
32
+ restart_command = [:sudo, SSHKit::Command.new(*restart_command).to_s]
33
+ end
34
+ execute *restart_command
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ task :test_which_passenger do
42
+ on roles(fetch(:passenger_roles)) do
43
+ set(:passenger_in_path, test(:which, :passenger))
44
+ end
45
+ end
46
+
47
+ namespace :rvm do
48
+ task hook: :"passenger:test_which_passenger" do
49
+ unless fetch(:passenger_in_path)
50
+ if fetch(:passenger_rvm_ruby_version) == fetch(:rvm_ruby_version)
51
+ set :rvm_map_bins, fetch(:rvm_map_bins) + [:passenger, :'passenger-config', :'passenger-status']
52
+ else
53
+ after :'rvm:hook', :'passenger:rvm:after_rvm_path_is_set'
54
+ end
55
+ end
56
+ end
57
+
58
+ task :after_rvm_path_is_set do
59
+ # This is very similar to code in capistrano-rvm. Ideally, there would be a way to hook into that code instead of duplicating it with only minor changes.
60
+ passenger_rvm_prefix = "#{fetch(:rvm_path)}/bin/rvm #{fetch(:passenger_rvm_ruby_version)} do"
61
+ [:passenger, :'passenger-config', :'passenger-status'].each do |command|
62
+ SSHKit.config.command_map.prefix[command.to_sym].unshift(passenger_rvm_prefix)
63
+ end
64
+ end
65
+ end
66
+
67
+ namespace :rbenv do
68
+ task hook: :"passenger:test_which_passenger" do
69
+ set :rbenv_map_bins, fetch(:rbenv_map_bins) + [:passenger, :'passenger-config', :'passenger-status'] unless fetch(:passenger_in_path)
70
+ end
71
+ end
72
+
73
+ namespace :chruby do
74
+ task hook: :"passenger:test_which_passenger" do
75
+ set :chruby_map_bins, fetch(:chruby_map_bins) + [:passenger, :'passenger-config', :'passenger-status'] unless fetch(:passenger_in_path)
76
+ end
77
+ end
78
+
79
+ namespace :bundler do
80
+ task :hook do
81
+ set :bundle_bins, fetch(:bundle_bins) + [:passenger, :'passenger-config', :'passenger-status'] if fetch(:passenger_in_gemfile, false)
7
82
  end
8
83
  end
9
- after :publishing, :restart
10
84
  end
11
85
 
12
86
  namespace :load do
@@ -15,5 +89,21 @@ namespace :load do
15
89
  set :passenger_restart_runner, :sequence
16
90
  set :passenger_restart_wait, 5
17
91
  set :passenger_restart_limit, 2
92
+ set :passenger_restart_with_sudo, false
93
+ set :passenger_environment_variables, {}
94
+ set :passenger_restart_command, 'passenger-config restart-app'
95
+ set :passenger_restart_options, -> { "#{deploy_to} --ignore-app-not-running" }
96
+ set :passenger_rvm_ruby_version, ->{ fetch(:rvm_ruby_version) }
97
+ _tasks = Rake.application.tasks.collect(&:to_s)
98
+ if _tasks.include?("bundler:map_bins")
99
+ before :'bundler:map_bins', :'passenger:bundler:hook'
100
+ end
101
+ if _tasks.include?("rvm:hook")
102
+ before :'rvm:hook', :'passenger:rvm:hook'
103
+ elsif _tasks.include?("rbenv:map_bins")
104
+ before :'rbenv:map_bins', :'passenger:rbenv:hook'
105
+ elsif _tasks.include?("chruby:map_bins")
106
+ before :'chruby:map_bins', :'passenger:chruby:hook'
107
+ end
18
108
  end
19
109
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Betesh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2021-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -68,13 +68,41 @@ files:
68
68
  - capistrano-passenger.gemspec
69
69
  - lib/capistrano-passenger.rb
70
70
  - lib/capistrano/passenger.rb
71
+ - lib/capistrano/passenger/no_hook.rb
71
72
  - lib/capistrano/passenger/version.rb
73
+ - lib/capistrano/tasks/deploy_passenger.cap
72
74
  - lib/capistrano/tasks/passenger.cap
73
75
  homepage: https://github.com/capistrano/passenger
74
76
  licenses:
75
77
  - MIT
76
78
  metadata: {}
77
- post_install_message:
79
+ post_install_message: |
80
+ ==== Release notes for capistrano-passenger ====
81
+ passenger once had only one way to restart: `touch tmp/restart.txt`
82
+ Beginning with passenger v4.0.33, a new way was introduced: `passenger-config restart-app`
83
+
84
+ The new way to restart was not initially practical for everyone,
85
+ since for versions of passenger prior to v5.0.10,
86
+ it required your deployment user to have sudo access for some server configurations.
87
+
88
+ capistrano-passenger gives you the flexibility to choose your restart approach, or to rely on reasonable defaults.
89
+
90
+ If you want to restart using `touch tmp/restart.txt`, add this to your config/deploy.rb:
91
+
92
+ set :passenger_restart_with_touch, true
93
+
94
+ If you want to restart using `passenger-config restart-app`, add this to your config/deploy.rb:
95
+
96
+ set :passenger_restart_with_touch, false # Note that `nil` is NOT the same as `false` here
97
+
98
+ If you don't set `:passenger_restart_with_touch`, capistrano-passenger will check what version of passenger you are running
99
+ and use `passenger-config restart-app` if it is available in that version.
100
+
101
+ If you are running passenger in standalone mode, it is possible for you to put passenger in your
102
+ Gemfile and rely on capistrano-bundler to install it with the rest of your bundle.
103
+ If you are installing passenger during your deployment AND you want to restart using `passenger-config restart-app`,
104
+ you need to set `:passenger_in_gemfile` to `true` in your `config/deploy.rb`.
105
+ ================================================
78
106
  rdoc_options: []
79
107
  require_paths:
80
108
  - lib
@@ -89,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
117
  - !ruby/object:Gem::Version
90
118
  version: '0'
91
119
  requirements: []
92
- rubyforge_project:
93
- rubygems_version: 2.4.3
120
+ rubygems_version: 3.1.4
94
121
  signing_key:
95
122
  specification_version: 4
96
123
  summary: Passenger support for Capistrano 3.x