capistrano-passenger 0.0.2 → 0.0.5

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
  SHA1:
3
- metadata.gz: 4f8fd2477d085bb6bdc41b2a2eec100fa3a92b2e
4
- data.tar.gz: e4cf76f579ecb5d76c50d7da1d260335a1f6550e
3
+ metadata.gz: de7f72b6bfcdc40bbbd10af5c56e00ba964a56b0
4
+ data.tar.gz: bc39916c2642aa4126fc48b1df4bc1571391066c
5
5
  SHA512:
6
- metadata.gz: 948bf4c42d4cf7975a17e92479c1d2f055ecd9310a7cdf18a19d1c68f48d6154ea04ef0f18254983c15997589faaa2254a0c2c12e5df52ba04ff8afec4be2081
7
- data.tar.gz: 70b6e897b3e4ca05f2e9e16f5742964e54d5b56ec28f70400bffaca74e4c974aa241310d9c6175a0f5a934179b2fbb9352b577184a597a8fde240ce19d0de5fb
6
+ metadata.gz: 8d6135fa823c59892880fd81721df36ffde57b6001bb4b583d1cc901bea290bea5b7d3b48421b3a171b699c4f2138d266d4c5f9dd713040d0861ee7540a16af3
7
+ data.tar.gz: 16559f6fa7ab2e0dea172615dc49b891ede80016051ea936f9b9c4ca267fdf3cbe8691bdb46a7a872b70af4f581be656421374d22d025aea0e8a8d84ffffc0ba
data/CHANGELOG.md CHANGED
@@ -1,7 +1,24 @@
1
+ # 0.0.5 (12 Apr 2015)
2
+
3
+ * Bug fixes:
4
+ * When restarting passenger without sudo, made it nevertheless use command map (@betesh, capistrano/passenger#8)
5
+ * 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.
6
+
7
+ * Command map prefixes for rbenv are automatically added now
8
+
9
+ # 0.0.4 (26 Mar 2015)
10
+
11
+ * Bug fixes:
12
+ * rvm:hook task was being called even if it wasn't defined (@betesh, capistrano/passenger#5)
13
+
14
+ # 0.0.3 (25 Mar 2015)
15
+
16
+ * Passenger 5 support (@pjkelly, capistrano/passenger#4)
17
+
1
18
  # 0.0.2 (10 Feb 2015)
2
19
 
3
20
  Bugfixes:
4
- * If directory doesn't exist, it's created during task (@powertoaster, #1)
21
+ * If directory doesn't exist, it's created during task (@powertoaster, capistrano/passenger#1)
5
22
 
6
23
  # 0.0.1 (7 Aug 2014)
7
24
 
data/README.md CHANGED
@@ -1,51 +1,105 @@
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 5 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
+ ```
24
42
 
25
- require 'capistrano/passenger'
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:
26
44
 
27
- You can also run the task in isolation:
45
+ ``` ruby
46
+ # Capfile
47
+ require 'capistrano/passenger/no_hook'
28
48
 
29
- $ cap production deploy:restart
49
+ # config/deploy.rb
50
+ after :some_other_task, :'passenger:restart'
51
+ ```
30
52
 
31
- Configurable options:
53
+ Configurable options and their defaults:
32
54
 
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
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
+ ```
65
+
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
+ ```
43
79
 
44
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 `:group`.
45
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
+ ### Restarting Passenger 5 (and above) Applications
93
+
94
+ Passenger 5 introduced a new way to restart your application, and thus has some additional configuration options to accomodate for various server environments.
95
+
96
+ If you need to pass additional/different options to `:passenger_restart_command`, simply override `:passenger_restart_options`.
97
+
98
+ If you require `sudo` when restarting passenger, set `:passenger_restart_with_sudo` to `true`. **Note**: This option has no effect when restarting Passenger 4 (and lower) applications.
99
+
46
100
  ## Contributing
47
101
 
48
- 1. Fork it ( https://github.com/betesh/capistrano-passenger/fork )
102
+ 1. Fork it ( https://github.com/capistrano/passenger/fork )
49
103
  2. Create your feature branch (`git checkout -b my-new-feature`)
50
104
  3. Commit your changes (`git commit -am 'Add some feature'`)
51
105
  4. Push to the branch (`git push origin my-new-feature`)
@@ -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.0.5"
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, :restart
9
+ end
@@ -1,19 +1,70 @@
1
- namespace :deploy do
2
- desc 'Restart application'
1
+ namespace :passenger do
2
+ desc 'Restart your Passenger application'
3
3
  task :restart do
4
4
  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')
5
+ with fetch(:passenger_environment_variables) do
6
+ passenger_version = capture(:passenger, '-v').match(/\APhusion Passenger version (.*)$/)[1].to_i
7
+
8
+ if passenger_version > 4
9
+ restart_with_sudo = fetch(:passenger_restart_with_sudo) ? :sudo : nil
10
+ arguments = [restart_with_sudo, *fetch(:passenger_restart_command).split(" ").collect(&:to_sym), fetch(:passenger_restart_options)].compact
11
+ execute *arguments
12
+ else
13
+ execute :mkdir, '-p', release_path.join('tmp')
14
+ execute :touch, release_path.join('tmp/restart.txt')
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ namespace :rvm do
21
+ task :hook do
22
+ passenger_installed_via_rvm = false
23
+ on roles(fetch(:passenger_roles)) do
24
+ passenger_installed_via_rvm = !(test :which, :passenger)
25
+ end
26
+ if passenger_installed_via_rvm
27
+ if fetch(:passenger_rvm_ruby_version) == fetch(:rvm_ruby_version)
28
+ set :rvm_map_bins, fetch(:rvm_map_bins) + [:passenger, :'passenger-config']
29
+ else
30
+ after :'rvm:hook', :'passenger:rvm:after_rvm_path_is_set'
31
+ end
32
+ end
33
+ end
34
+
35
+ task :after_rvm_path_is_set do
36
+ # 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.
37
+ passenger_rvm_prefix = "#{fetch(:rvm_path)}/bin/rvm #{fetch(:passenger_rvm_ruby_version)} do"
38
+ [:passenger, :'passenger-config'].each do |command|
39
+ SSHKit.config.command_map.prefix[command.to_sym].unshift(passenger_rvm_prefix)
40
+ end
41
+ end
42
+ end
43
+
44
+ namespace :rbenv do
45
+ task :hook do
46
+ set :rbenv_map_bins, fetch(:rbenv_map_bins) + [:passenger, :'passenger-config']
7
47
  end
8
48
  end
9
- after :publishing, :restart
10
49
  end
11
50
 
51
+
12
52
  namespace :load do
13
53
  task :defaults do
14
54
  set :passenger_roles, :app
15
55
  set :passenger_restart_runner, :sequence
16
56
  set :passenger_restart_wait, 5
17
57
  set :passenger_restart_limit, 2
58
+ set :passenger_restart_with_sudo, false
59
+ set :passenger_environment_variables, {}
60
+ set :passenger_restart_command, 'passenger-config restart-app'
61
+ set :passenger_restart_options, -> { "#{deploy_to} --ignore-app-not-running" }
62
+ set :passenger_rvm_ruby_version, ->{ fetch(:rvm_ruby_version) }
63
+ if Rake.application.tasks.collect(&:to_s).include?("rvm:hook")
64
+ before :'rvm:hook', :'passenger:rvm:hook'
65
+ end
66
+ if Rake.application.tasks.collect(&:to_s).include?("rbenv:map_bins")
67
+ before :'rbenv:map_bins', :'passenger:rbenv:hook'
68
+ end
18
69
  end
19
70
  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.0.5
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: 2015-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -68,7 +68,9 @@ 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:
@@ -90,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
92
  version: '0'
91
93
  requirements: []
92
94
  rubyforge_project:
93
- rubygems_version: 2.4.3
95
+ rubygems_version: 2.2.2
94
96
  signing_key:
95
97
  specification_version: 4
96
98
  summary: Passenger support for Capistrano 3.x