dolphin 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cdebd25f15c7ca3178f5b20d2fcf659ddac74c1
4
- data.tar.gz: bd3f80a28f9c699457432c035aab9d56f741aa27
3
+ metadata.gz: df915c5f7dbaac8d7a2e3904d4bfa6ba128ed99d
4
+ data.tar.gz: 1054605420d1488164062a8d4c5a49f4d822873b
5
5
  SHA512:
6
- metadata.gz: 9a8cbd6cda2c393fc43ec56837d8945c6fa5158328b7aeddadc8a8c6143c3b0215c6e716527ac1eee52b37ad0cf427ba82047c331a0e684eb6cacfe781f1e408
7
- data.tar.gz: 40c74e0f464376b848e2e5a099a07eb7abbbe4a5a43245451404e70238ac3d12c03d15da0edbaa83afe0109610619d31f05a7062fb30d7b66bc3feb513b9da8d
6
+ metadata.gz: 96461fe1ef517739578562d155e6a5921321f4f7c2627419a542d0647f712306a84a78d7f02aeebe176c0c9121d1a38c4a5a240af824a6b00b3f84dc029d7ed3
7
+ data.tar.gz: 5d8a93ccbde600fcc4342dc7b4597a6b607fccef8c6a4b96a5aaf16f7edcd31c773dd4a2d0a820b5169a673dbe28aded71e31a17fa64c8fdd96ef3ce4f4f682d
data/README.md CHANGED
@@ -19,7 +19,9 @@ Dolphin: deploy agilely like dolphins can swim. A multi-threaded multi-stage dep
19
19
  * Bye bye, complexity;
20
20
  * Welcome, nimbleness.
21
21
 
22
- ## Installation / Rails generator
22
+ ## Installation / Rails generators
23
+
24
+ ### Installation
23
25
 
24
26
  Add this line to your application's Gemfile:
25
27
 
@@ -29,14 +31,26 @@ Or install it yourself as:
29
31
 
30
32
  $ gem install dolphin
31
33
 
34
+ ### Generator for dolphin executable
35
+
32
36
  Run generator from your Rails application:
33
37
 
34
38
  $ bin/rails g dolphin:install
35
39
 
36
40
  This will create an executable script as bin/dolphin.
37
41
 
42
+ ### Generator for Puma config
43
+
44
+ Run generator from your Rails application:
45
+
46
+ $ bin/rails g dolphin:puma
47
+
48
+ This will create a config file for Puma as config/puma.rb.
49
+
38
50
  ## Configuration
39
51
 
52
+ ### Config for dolphin executable
53
+
40
54
  Edit the bin/dolphin script generated as above to adjust settings. Please refer to detailed comments inside the script. Minimum config would require the following:
41
55
 
42
56
  # settings require user input
@@ -71,6 +85,18 @@ Edit the bin/dolphin script generated as above to adjust settings. Please refer
71
85
  @branch = 'master'
72
86
  end
73
87
 
88
+ ### Config for Puma
89
+
90
+ Edit the config/puma.rb script generated as above to adjust settings. Please refer to detailed comments inside the script. Minimum config would require the following:
91
+
92
+ # settings require user input
93
+ # -----------------------------
94
+ # name of this application
95
+ application = 'best_app'
96
+
97
+ You may also refer to Puma for explanation of options:
98
+ * [puma]
99
+
74
100
  ## Usage
75
101
 
76
102
  ### Help
@@ -265,6 +291,7 @@ To extend dolphin's functionality with your custom modules is easy. It is Ruby a
265
291
 
266
292
  * [capistrano]
267
293
  * [chruby]
294
+ * [puma]
268
295
  * [git-deploy]
269
296
  * [hell]
270
297
  * [mina]
@@ -281,6 +308,7 @@ To extend dolphin's functionality with your custom modules is easy. It is Ruby a
281
308
 
282
309
  [capistrano]: https://github.com/capistrano/capistrano
283
310
  [chruby]: https://github.com/postmodern/chruby
311
+ [puma]: https://github.com/puma/puma
284
312
  [git-deploy]: https://github.com/mislav/git-deploy
285
313
  [hell]: https://github.com/seatgeek/hell
286
314
  [mina]: https://github.com/nadarei/mina
@@ -6,8 +6,7 @@ class Dolphin::Puma < Dolphin::Base
6
6
  menu = [
7
7
  "
8
8
  cd #{@deploy_dir}
9
- RAILS_ENV=#{@env} bundle exec puma -t 8:32 -e #{@env} -d -b unix://#{@sockets}/#{@application}.sock -S #{@pids}/#{@application}.state --control unix://#{@sockets}/pumactl.sock
10
- # --pidfile #{@pids}/#{@application}.pid
9
+ RAILS_ENV=#{@env} bundle exec puma -C config/puma.rb
11
10
  ",
12
11
  ]
13
12
 
@@ -1,3 +1,3 @@
1
1
  module Dolphin
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -8,7 +8,7 @@ class Dolphin::InstallGenerator < Rails::Generators::Base
8
8
  copy_file "dolphin", target
9
9
  # make it executable
10
10
  chmod(target, 0755)
11
- puts "Now edit bin/dolphin to adjust deployment settings\nThen run bin/dolphin to deploy."
11
+ puts "Now edit #{target} to adjust deployment settings\nThen run bin/dolphin to deploy."
12
12
  end
13
13
 
14
14
  end
@@ -0,0 +1,12 @@
1
+ require 'rails/generators'
2
+
3
+ class Dolphin::PumaGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../templates", __FILE__)
5
+
6
+ def setup
7
+ target = "config/puma.rb"
8
+ copy_file "puma.rb", target
9
+ puts "Now edit #{target} to adjust settings for Puma"
10
+ end
11
+
12
+ end
@@ -29,7 +29,6 @@ class Dolphin::Base
29
29
  # on servers under @app_dir, the directory where this application resides
30
30
  @deploy_dir = "#{@app_dir}/#{@application}"
31
31
  # puma related settings
32
- @sockets = "#{@deploy_dir}/tmp/sockets"
33
32
  @pids = "#{@deploy_dir}/tmp/pids"
34
33
 
35
34
  # internal variables, no need to change by user
@@ -0,0 +1,34 @@
1
+ # settings require user input
2
+ # -----------------------------
3
+ # name of this application
4
+ application = 'best_app'
5
+
6
+ # settings with default values
7
+ # -----------------------------
8
+ deploy_dir = File.expand_path('../..', __FILE__)
9
+ sockets = "#{deploy_dir}/tmp/sockets"
10
+ pids = "#{deploy_dir}/tmp/pids"
11
+
12
+ environment ENV['RAILS_ENV']
13
+
14
+ # number of cpu
15
+ nproc = `nproc`.to_i
16
+
17
+ if nproc > 1
18
+ # multiple cpu, running in cluster mode
19
+ threads 2,16
20
+ workers nproc
21
+ preload_app!
22
+ else
23
+ # in single mode
24
+ threads 8,32
25
+ end
26
+
27
+ daemonize true
28
+ state_path "#{pids}/#{application}.state"
29
+
30
+ # pumactl socket
31
+ activate_control_app "unix://#{sockets}/pumactl.sock"
32
+
33
+ # using unix socket
34
+ bind "unix://#{sockets}/#{application}.sock"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dolphin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neng Xu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-16 00:00:00.000000000 Z
11
+ date: 2013-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -104,7 +104,9 @@ files:
104
104
  - lib/dolphin/setup.rb
105
105
  - lib/dolphin/version.rb
106
106
  - lib/generators/dolphin/install_generator.rb
107
+ - lib/generators/dolphin/puma_generator.rb
107
108
  - lib/generators/dolphin/templates/dolphin
109
+ - lib/generators/dolphin/templates/puma.rb
108
110
  - spec/dolphin/base_spec.rb
109
111
  - spec/dolphin/deploy_spec.rb
110
112
  - spec/dolphin/git_spec.rb