capistrano-puma 0.0.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +18 -1
- data/capistrano-puma.gemspec +3 -1
- data/lib/capistrano-puma.rb +2 -3
- data/lib/capistrano/puma.rb +1 -0
- data/lib/capistrano/tasks/puma.rake +68 -0
- metadata +24 -12
- data/lib/capistrano-puma/tasks.rb +0 -56
- data/lib/capistrano-puma/version.rb +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e9448a5bb2d9ae03745498bf1859229eb0c5c45a
|
4
|
+
data.tar.gz: 5b7f30b7b96a107937e8319bb33864fde491d628
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fad22e3b55d6e62e3e47c7be73d54708358b8c84aa69c9661ca00588ba072188ab4454cf692ee738da96465d83add307a183da99defebbee4bf350ada1009edc
|
7
|
+
data.tar.gz: 6300cbf7d8768c1695c14005bf11f6c1dc499f6edcc76006c364bc3ba16957340b1807fae8d74e88927a482652de2aacaba99411734f11dcf47c75d68d243946
|
data/README.md
CHANGED
@@ -6,6 +6,8 @@ These tasks assume that you are using the [jungle tool scripts](https://github.c
|
|
6
6
|
|
7
7
|
This is an extension of the puma tasks from [Deploying a Rails app on Nginx/Puma with Capistrano](http://tommy.chheng.com/2013/01/23/deploying-a-rails-app-on-nginxpuma-with-capistrano) of [Tommy Chheng](https://github.com/tc).
|
8
8
|
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/capistrano-puma.png)](http://badge.fury.io/rb/capistrano-puma)
|
10
|
+
|
9
11
|
## Installation
|
10
12
|
|
11
13
|
Add this line to your application's Gemfile:
|
@@ -30,7 +32,22 @@ Use it in your deploy.rb as:
|
|
30
32
|
require 'capistrano-puma'
|
31
33
|
```
|
32
34
|
|
33
|
-
|
35
|
+
Please ensure, that you've set the `application` property to identify the application to manage, e.g.:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
set :application, 'foobar'
|
39
|
+
|
40
|
+
cap puma:start # => /etc/init.d/puma start foobar
|
41
|
+
```
|
42
|
+
|
43
|
+
On inclusion the following capistrano callbacks are inserted:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
after "deploy:start", "puma:start"
|
47
|
+
after "deploy:stop", "puma:stop"
|
48
|
+
after "deploy:restart", "puma:restart"
|
49
|
+
after "deploy:create_symlink", "puma:after_symlink"
|
50
|
+
```
|
34
51
|
|
35
52
|
Or you just call it by hand like:
|
36
53
|
|
data/capistrano-puma.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'capistrano-puma
|
4
|
+
require 'capistrano-puma'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "capistrano-puma"
|
@@ -16,4 +16,6 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'capistrano', '>= 3.0'
|
19
21
|
end
|
data/lib/capistrano-puma.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../tasks/puma.rake", __FILE__)
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
namespace :puma do
|
3
|
+
|
4
|
+
desc "Start puma instance for this application"
|
5
|
+
task :start do
|
6
|
+
on roles fetch(:puma_roles) do
|
7
|
+
within release_path do
|
8
|
+
with rails_env: fetch(:rails_env) do
|
9
|
+
execute :bundle, "exec puma -b '#{puma_socket}'",
|
10
|
+
" -e #{stage} ",
|
11
|
+
"--control '#{pumactl_socket}'",
|
12
|
+
"-S #{puma_state}",
|
13
|
+
fetch(:puma_flags),
|
14
|
+
">> #{puma_log} 2>&1 &"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Stop puma instance for this application"
|
21
|
+
task :stop do
|
22
|
+
on roles fetch(:puma_roles) do
|
23
|
+
within release_path do
|
24
|
+
execute :bundle, "exec pumactl -S #{puma_state} stop"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Restart puma instance for this application"
|
30
|
+
task :restart do
|
31
|
+
on roles fetch(:puma_roles) do
|
32
|
+
within release_path do
|
33
|
+
execute :bundle, "exec pumactl -S #{puma_state} restart"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Show status of puma for this application"
|
39
|
+
task :status do
|
40
|
+
on roles fetch(:puma_roles) do
|
41
|
+
within release_path do
|
42
|
+
execute :bundle, "exec pumactl -S #{puma_state} stats"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Show status of puma for all applications"
|
48
|
+
task :overview do
|
49
|
+
on roles fetch(:puma_roles) do
|
50
|
+
within release_path do
|
51
|
+
execute :bundle, "exec puma status"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
namespace :load do
|
59
|
+
task :defaults do
|
60
|
+
set :sockets_path, -> { shared_path.join('tmp/sockets/') }
|
61
|
+
set :puma_roles, -> { :app }
|
62
|
+
set :puma_socket, -> { "unix://#{sockets_path.join('puma.sock')}" }
|
63
|
+
set :pumactl_socket, -> { "unix://#{sockets_path.join('pumactl.sock')}" }
|
64
|
+
set :puma_state, -> { sockets_path.join('puma.state') }
|
65
|
+
set :puma_log, -> { shared_path.join("log/puma-#{stage}.log") }
|
66
|
+
set :puma_flags, -> { nil }
|
67
|
+
end
|
68
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Johannes Opper
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
-
dependencies:
|
11
|
+
date: 2013-11-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
14
27
|
description: Provide deployment tasks for puma
|
15
28
|
email:
|
16
29
|
- xijo@gmx.de
|
@@ -26,30 +39,29 @@ files:
|
|
26
39
|
- Rakefile
|
27
40
|
- capistrano-puma.gemspec
|
28
41
|
- lib/capistrano-puma.rb
|
29
|
-
- lib/capistrano
|
30
|
-
- lib/capistrano
|
42
|
+
- lib/capistrano/puma.rb
|
43
|
+
- lib/capistrano/tasks/puma.rake
|
31
44
|
homepage: http://github.com/xijo/capistrano-puma
|
32
45
|
licenses: []
|
46
|
+
metadata: {}
|
33
47
|
post_install_message:
|
34
48
|
rdoc_options: []
|
35
49
|
require_paths:
|
36
50
|
- lib
|
37
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
52
|
requirements:
|
40
|
-
- -
|
53
|
+
- - '>='
|
41
54
|
- !ruby/object:Gem::Version
|
42
55
|
version: '0'
|
43
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
57
|
requirements:
|
46
|
-
- -
|
58
|
+
- - '>='
|
47
59
|
- !ruby/object:Gem::Version
|
48
60
|
version: '0'
|
49
61
|
requirements: []
|
50
62
|
rubyforge_project:
|
51
|
-
rubygems_version:
|
63
|
+
rubygems_version: 2.0.3
|
52
64
|
signing_key:
|
53
|
-
specification_version:
|
65
|
+
specification_version: 4
|
54
66
|
summary: Provide deployment tasks for puma
|
55
67
|
test_files: []
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'capistrano'
|
2
|
-
require 'capistrano/version'
|
3
|
-
|
4
|
-
module CapistranoPuma
|
5
|
-
class Tasks
|
6
|
-
def self.load_into(capistrano_config)
|
7
|
-
capistrano_config.load do
|
8
|
-
before(%w[puma:start puma:stop puma:restart puma:status]) do
|
9
|
-
_cset(:puma_app_name) { fetch(:application) }
|
10
|
-
end
|
11
|
-
|
12
|
-
namespace :puma do
|
13
|
-
desc "Start puma instance for this application"
|
14
|
-
task :start do
|
15
|
-
run "/etc/init.d/puma start #{puma_app_name}"
|
16
|
-
end
|
17
|
-
|
18
|
-
desc "Stop puma instance for this application"
|
19
|
-
task :stop do
|
20
|
-
run "/etc/init.d/puma stop #{puma_app_name}"
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "Restart puma instance for this application"
|
24
|
-
task :restart, roles: :app do
|
25
|
-
run "/etc/init.d/puma restart #{puma_app_name}"
|
26
|
-
end
|
27
|
-
|
28
|
-
desc "Show status of puma for this application"
|
29
|
-
task :status, roles: :app do
|
30
|
-
run "/etc/init.d/puma status #{puma_app_name}"
|
31
|
-
end
|
32
|
-
|
33
|
-
desc "Show status of puma for all applications"
|
34
|
-
task :overview, roles: :app do
|
35
|
-
run "/etc/init.d/puma status"
|
36
|
-
end
|
37
|
-
|
38
|
-
desc "Create a shared tmp dir for puma state files"
|
39
|
-
task :after_symlink, roles: :app do
|
40
|
-
run "rm -rf #{release_path}/tmp"
|
41
|
-
run "ln -s #{shared_path}/tmp #{release_path}/tmp"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
after "deploy:start", "puma:start"
|
46
|
-
after "deploy:stop", "puma:stop"
|
47
|
-
after "deploy:restart", "puma:restart"
|
48
|
-
after "deploy:create_symlink", "puma:after_symlink"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
if Capistrano::Configuration.instance
|
55
|
-
CapistranoPuma::Tasks.load_into(Capistrano::Configuration.instance)
|
56
|
-
end
|