mina-puma 0.0.6 → 0.0.7
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/README.md +56 -24
- data/lib/mina/puma/tasks.rake +42 -21
- data/lib/mina/puma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dec73c6a879f7fbe406f1320381b4af3a642c7e
|
4
|
+
data.tar.gz: 7cc245b86271c1d7563af03c03e5906e8d5cf969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5ea8367bb5ce02bd36dba509fed62db67a8cf44d57090e4fcbda402b9f294e4ab4ee6336a313671282c4f24a30ebe0f3f11575daee5dfaabf4a2015c12adc22
|
7
|
+
data.tar.gz: 69a982baf39e9def2d856f2cc25afd7895f62185bff9af04c56b1e206941b0b50bfdf553a33780199d5f47582d5b56fcef8c8827ee24e787d0bd2df41bb8390c
|
data/README.md
CHANGED
@@ -1,52 +1,84 @@
|
|
1
|
-
# Mina
|
1
|
+
# Mina Puma
|
2
2
|
|
3
|
-
|
3
|
+
[Mina](https://github.com/nadarei/mina) tasks for handle with
|
4
|
+
[Puma](https://github.com/puma/puma).
|
5
|
+
|
6
|
+
This gem provides several mina tasks:
|
7
|
+
|
8
|
+
mina puma:restart # Restart puma
|
9
|
+
mina puma:start # Start puma
|
10
|
+
mina puma:stop # Stop puma
|
4
11
|
|
5
12
|
## Installation
|
6
13
|
|
7
14
|
Add this line to your application's Gemfile:
|
8
15
|
|
9
|
-
gem 'mina-puma', require
|
16
|
+
gem 'mina-puma', :require => false
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install mina-puma
|
10
25
|
|
11
26
|
## Usage
|
12
27
|
|
13
|
-
|
14
|
-
|
28
|
+
Add this to your `config/deploy.rb` file:
|
29
|
+
|
15
30
|
require 'mina/puma'
|
16
31
|
|
17
|
-
|
18
|
-
|
32
|
+
Make sure the following settings are set in your `config/deploy.rb`:
|
33
|
+
|
34
|
+
* `deploy_to` - deployment path
|
35
|
+
|
36
|
+
Make sure the following directories exists on your server:
|
37
|
+
|
38
|
+
* `shared/tmp/sockets` - directory for socket files.
|
39
|
+
* `shared/tmp/pids` - direcotry for pid files.
|
40
|
+
|
41
|
+
OR you can set other directories by setting follow variables:
|
42
|
+
|
43
|
+
* `puma_socket` - puma socket file, default is `shared/tmp/sockets/puma.sock`
|
44
|
+
* `puma_pid` - puma pid file, default `shared/tmp/pids/puma.pid`
|
45
|
+
* `puma_state` - puma state file, default `shared/tmp/sockets/puma.state`
|
46
|
+
* `pumactl_socket` - pumactl socket file, default `shared/tmp/sockets/pumactl.sock`
|
47
|
+
|
48
|
+
Then:
|
49
|
+
|
50
|
+
```
|
51
|
+
$ mina puma:start
|
52
|
+
```
|
53
|
+
|
54
|
+
## Example
|
55
|
+
|
56
|
+
require 'mina/puma'
|
57
|
+
|
58
|
+
task :setup => :environment do
|
59
|
+
# Puma needs a place to store its pid file and socket file.
|
60
|
+
queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/sockets")
|
61
|
+
queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/sockets")
|
62
|
+
queue! %(#{deploy_to}/#{shared_path}/tmp/pids")
|
63
|
+
queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids")
|
19
64
|
|
20
|
-
...
|
21
|
-
task :setup do
|
22
65
|
...
|
23
|
-
|
66
|
+
|
24
67
|
end
|
25
68
|
|
26
69
|
task :deploy do
|
27
70
|
deploy do
|
28
71
|
invoke :'git:clone'
|
72
|
+
invoke :'deploy:link_shared_paths'
|
29
73
|
...
|
30
74
|
|
31
75
|
to :launch do
|
32
|
-
|
33
|
-
|
76
|
+
...
|
77
|
+
invoke :'puma:restart'
|
34
78
|
end
|
35
79
|
end
|
36
80
|
end
|
37
81
|
|
38
|
-
Available commands:
|
39
|
-
|
40
|
-
mina puma:start
|
41
|
-
mina puma:stop
|
42
|
-
mina puma:restart
|
43
|
-
|
44
|
-
Default settings:
|
45
|
-
|
46
|
-
set :puma_socket, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/puma.sock" }
|
47
|
-
set :puma_ctl, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/pumactl.sock" }
|
48
|
-
set :puma_state, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/puma.state" }
|
49
|
-
|
50
82
|
## Contributing
|
51
83
|
|
52
84
|
1. Fork it
|
data/lib/mina/puma/tasks.rake
CHANGED
@@ -1,35 +1,56 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
set_default :puma_state, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/puma.state" }
|
4
|
-
|
1
|
+
require 'mina/bundler'
|
2
|
+
require 'mina/rails'
|
5
3
|
|
6
4
|
namespace :puma do
|
5
|
+
set :web_server, :puma
|
6
|
+
|
7
|
+
set_default :puma_role, -> { user }
|
8
|
+
set_default :puma_env, -> { fetch(:rails_env, 'production') }
|
9
|
+
set_default :puma_config, -> { "#{deploy_to}/#{shared_path}/config/puma.rb" }
|
10
|
+
set_default :puma_socket, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/puma.sock" }
|
11
|
+
set_default :puma_state, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/puma.state" }
|
12
|
+
set_default :puma_pid, -> { "#{deploy_to}/#{shared_path}/tmp/pids/puma.pid" }
|
13
|
+
set_default :puma_cmd, -> { "#{bundle_prefix} puma" }
|
14
|
+
set_default :pumactl_cmd, -> { "#{bundle_prefix} pumactl" }
|
15
|
+
set_default :pumactl_socket, -> { "#{deploy_to}/#{shared_path}/tmp/sockets/pumactl.sock" }
|
16
|
+
|
7
17
|
desc 'Start puma'
|
8
|
-
task start
|
9
|
-
|
18
|
+
task :start => :environment do
|
19
|
+
in_directory "#{deploy_to}/#{current_path}" do
|
20
|
+
queue! %(#{puma_cmd} #{start_options})
|
21
|
+
end
|
10
22
|
end
|
11
23
|
|
12
24
|
desc 'Stop puma'
|
13
25
|
task stop: :environment do
|
14
|
-
|
26
|
+
in_directory "#{deploy_to}/#{current_path}" do
|
27
|
+
queue! %(#{pumactl_cmd} -S #{puma_state} stop)
|
28
|
+
end
|
15
29
|
end
|
16
30
|
|
17
31
|
desc 'Restart puma'
|
18
32
|
task restart: :environment do
|
19
|
-
|
20
|
-
if
|
21
|
-
|
33
|
+
in_directory "#{deploy_to}/#{current_path}" do
|
34
|
+
if check_exists?(pumactl_socket)
|
35
|
+
queue! %(#{pumactl_cmd} -S #{puma_state} restart)
|
22
36
|
else
|
23
|
-
|
24
|
-
|
25
|
-
|
37
|
+
queue! %(#{puma_cmd} #{start_options})
|
38
|
+
end
|
39
|
+
end
|
26
40
|
end
|
27
|
-
end
|
28
41
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
42
|
+
private
|
43
|
+
|
44
|
+
def start_options
|
45
|
+
if check_exists?(puma_config)
|
46
|
+
"-q -d -e #{puma_env} -C #{puma_config}"
|
47
|
+
else
|
48
|
+
"-q -d -e #{puma_env} -b 'unix://#{puma_socket}' -S #{puma_state} --control 'unix://#{pumactl_socket}'"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def check_exists?(file)
|
53
|
+
boolean = capture("if [ -a '#{file}' ]; then echo 'yes'; else echo 'no'; fi").chomp
|
54
|
+
boolean == 'yes' ? true : false
|
55
|
+
end
|
56
|
+
end
|
data/lib/mina/puma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mina-puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Sandelius
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mina
|