capistrano-nginx-unit 0.1 → 0.2

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
  SHA256:
3
- metadata.gz: 33e182a463b851db2c6a7a8b4bb56f40efa09ec1962f4f9d499835adeb52ab56
4
- data.tar.gz: 9342e6888d8dc923cd0828ec3fc510c8bf0bcc2d3787d80667c3adee811e762d
3
+ metadata.gz: 62b0d922cb2c6e70e8027253e76fd5b9cb0be6fbfb25a8ee31ec5c12a14661a2
4
+ data.tar.gz: 939506d0e5896d0f6e0c9058a8953a900543ab533410d2ddb89888bc3607d995
5
5
  SHA512:
6
- metadata.gz: 1b84ef615fff5d33101fe741a4dc0197a78107163558e516e1ff49a9a6a2adccd0ad9d7257d8fa18711af0eed9e69416bd44fb5d0f743fc07e1d71fb6028403a
7
- data.tar.gz: d493111d421d4fb17c4d7f788a5c16861c23207d220d04014f4daaa60ffb81093e8d8d5f58fca95f1ea0e6b14a1e752caf997cca6d208ba02b96edce12b62220
6
+ metadata.gz: 3992ecbc1b83746ec29ef21a65e511e252d1e1267f0ad9df70b2841b377367b16c4c9d8bdd7e01b14afd9e8984cea89eb9252aa50cced62bb913a809bbff766d
7
+ data.tar.gz: 3b4480dd832694971899c0a6f83cac055490a4aa62bbfa302bef2bae17d57457d97a66bae093ee7499a4749e2278f97184f0b224a83e913b0c5b280f1b677b77
data/README.md CHANGED
@@ -2,8 +2,46 @@
2
2
 
3
3
  ## Installation
4
4
 
5
- TODO: writing
5
+ ```rb
6
+ gem "capistrano-nginx-unit"
7
+ ```
6
8
 
7
9
  ## Usage
8
10
 
9
- TODO: writing
11
+ Require in Capfile.
12
+
13
+ ```rb
14
+ # Capfile
15
+ require "capistrano/nginx-unit"
16
+ ```
17
+
18
+ Defined following tasks.
19
+
20
+ ```
21
+ cap nginx_unit:configure # Set listener and application configuration for NGINX Unit
22
+ cap nginx_unit:configure_app # Set application configuration for NGINX Unit
23
+ cap nginx_unit:configure_listener # Set listener configuration for NGINX Unit
24
+ cap nginx_unit:start # Start NGINX Unit process
25
+ ```
26
+
27
+ Defined following customizable options.
28
+
29
+ ```rb
30
+ set :nginx_unit_roles, -> { :app }
31
+ set :nginx_unit_pid, -> { "/var/run/unit.pid" }
32
+ set :nginx_unit_control_sock, -> { "/var/run/control.unit.sock" }
33
+ set :nginx_unit_options, -> { "" }
34
+ set :nginx_unit_listen, -> { "*:3000" }
35
+ set :nginx_unit_app_name, -> { fetch(:application) }
36
+ set :nginx_unit_processes, -> { 1 }
37
+ set :nginx_unit_user, -> { nil }
38
+ set :nginx_unit_group, -> { nil }
39
+ set :nginx_unit_script, -> { "config.ru" }
40
+ ```
41
+
42
+ If you want to apply new code when deployed, please invoke `nginx_unit:configure` task after `deploy:published`.
43
+
44
+ ```rb
45
+ # deploy.rb
46
+ after "deploy:published", "nginx_unit:configure"
47
+ ```
@@ -18,5 +18,7 @@ Gem::Specification.new do |spec|
18
18
  f.match(%r{^(test|spec|features)/})
19
19
  end
20
20
 
21
+ spec.required_ruby_version = '~> 2.0'
22
+
21
23
  spec.add_runtime_dependency "capistrano", "~> 3.0"
22
24
  end
@@ -1,3 +1,3 @@
1
1
  module Capistrano
2
- NGINX_UNIT_VERSION = "0.1"
2
+ NGINX_UNIT_VERSION = "0.2"
3
3
  end
@@ -1,7 +1,9 @@
1
1
  namespace :load do
2
2
  task :defaults do
3
3
  set :nginx_unit_roles, -> { :app }
4
+ set :nginx_unit_pid, -> { "/var/run/unit.pid" }
4
5
  set :nginx_unit_control_sock, -> { "/var/run/control.unit.sock" }
6
+ set :nginx_unit_options, -> { "" }
5
7
  set :nginx_unit_listen, -> { "*:3000" }
6
8
  set :nginx_unit_app_name, -> { fetch(:application) }
7
9
  set :nginx_unit_processes, -> { 1 }
@@ -11,12 +13,28 @@ namespace :load do
11
13
  end
12
14
  end
13
15
 
14
- # TODO: Start and stop NGINX Unit process
16
+ # TODO: Stop NGINX Unit process
15
17
  namespace :nginx_unit do
18
+ desc "Start NGINX Unit process"
19
+ task :start do
20
+ on release_roles(fetch(:nginx_unit_roles)) do
21
+ pid_file = fetch(:nginx_unit_pid)
22
+ if test("[ -e #{pid_file} ] && kill -0 `cat #{pid_file}`")
23
+ info "NGINX Unit is already started"
24
+ else
25
+ execute :sudo, :unitd,
26
+ "--pid #{pid_file}",
27
+ "--control unix:#{fetch(:nginx_unit_control_sock)}",
28
+ fetch(:nginx_unit_options)
29
+ end
30
+ end
31
+ end
32
+
16
33
  # If you want to apply new code when deployed,
17
34
  # please invoke this task after deploy:published
18
35
  desc "Set listener and application configuration for NGINX Unit"
19
36
  task :configure do
37
+ invoke "nginx_unit:start"
20
38
  invoke "nginx_unit:configure_app"
21
39
  invoke "nginx_unit:configure_listener"
22
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-nginx-unit
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - murakmii
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-07 00:00:00.000000000 Z
11
+ date: 2018-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -51,9 +51,9 @@ require_paths:
51
51
  - lib
52
52
  required_ruby_version: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ">="
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '0'
56
+ version: '2.0'
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="