luban-nginx 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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/luban/deployment/packages/nginx.rb +1 -1
- data/lib/luban/deployment/packages/nginx/configurator.rb +1 -9
- data/lib/luban/deployment/packages/nginx/controller.rb +25 -27
- data/lib/luban/deployment/packages/nginx/installer.rb +2 -4
- data/lib/luban/deployment/packages/nginx/templates/nginx.conf.erb +0 -4
- data/lib/luban/deployment/packages/nginx/templates/nginx.http.conf +1 -1
- data/lib/luban/deployment/packages/nginx/templates/nginx.http.proxy.conf +0 -4
- data/lib/luban/deployment/packages/nginx/templates/nginx.logrotate.erb +0 -4
- data/lib/luban/deployment/packages/nginx/templates/nginx.monitrc.erb +3 -8
- data/lib/luban/deployment/packages/nginx/version.rb +1 -1
- data/lib/luban/deployment/packages/pcre.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: 6eebed13089ab8504ba7fad7fe505ee0e0a07dad
|
4
|
+
data.tar.gz: 333d8d4b66ec26f7428fbe5b426236ce2d1ce6d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c1424e41aa0650d9edf1eac6cdeb215655eeb2c550dc95e49988b336396687bb1f48b7cc000b7e96c2108800b662ff9582f7d664591c95fbc262fbfc673dc33
|
7
|
+
data.tar.gz: d03f27e9781ffe8cda82c8916e21d7eaff94c32744acc40a1e90133098d2a24f4f9657b4aa020caa331d0639af35eec8bb0a77a9a116b547b4c735cb89986d60
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## Version 0.1.1 (Jun 16, 2016)
|
4
|
+
|
5
|
+
Minor enhancements:
|
6
|
+
* Refatored commands definitions for better reusability among service workers
|
7
|
+
* Simplified erb templates by removing header information like revision, environment, etc.
|
8
|
+
* Header info is generated by Luban (with a generic header template which could be customized if needed)
|
9
|
+
|
3
10
|
## Version 0.1.0 (May 11, 2016)
|
4
11
|
|
5
12
|
New features:
|
@@ -3,13 +3,7 @@ module Luban
|
|
3
3
|
module Packages
|
4
4
|
class Nginx
|
5
5
|
class Configurator < Luban::Deployment::Service::Configurator
|
6
|
-
|
7
|
-
def bin_path
|
8
|
-
@bin_path ||= install_path.join('sbin')
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
include Paths
|
6
|
+
include Controller::Commands
|
13
7
|
|
14
8
|
def error_log_file_path
|
15
9
|
@error_log_file_path ||= log_path.join(error_log_file_name)
|
@@ -31,9 +25,7 @@ module Luban
|
|
31
25
|
if file?(stage_profile_path.join(mime_types_file_name))
|
32
26
|
profile_path.join(mime_types_file_name)
|
33
27
|
else
|
34
|
-
#Pathname.new('conf').join(mime_types_file_name)
|
35
28
|
current_path.join('conf').join(mime_types_file_name)
|
36
|
-
#install_path.join('conf').join(mime_types_file_name)
|
37
29
|
end
|
38
30
|
end
|
39
31
|
|
@@ -3,17 +3,33 @@ module Luban
|
|
3
3
|
module Packages
|
4
4
|
class Nginx
|
5
5
|
class Controller < Luban::Deployment::Service::Controller
|
6
|
-
|
6
|
+
module Commands
|
7
|
+
def self.included(base)
|
8
|
+
base.define_executable 'nginx'
|
9
|
+
end
|
10
|
+
|
11
|
+
def bin_path
|
12
|
+
@bin_path ||= install_path.join('sbin')
|
13
|
+
end
|
14
|
+
|
15
|
+
def nginx_command
|
16
|
+
@nginx_command ||= "#{nginx_executable} -c #{control_file_path}"
|
17
|
+
end
|
7
18
|
|
8
|
-
|
19
|
+
alias_method :process_pattern, :nginx_command
|
20
|
+
alias_method :start_command, :nginx_command
|
9
21
|
|
10
|
-
|
11
|
-
|
22
|
+
def stop_command
|
23
|
+
@stop_command ||= "#{nginx_command} -s stop"
|
24
|
+
end
|
12
25
|
end
|
13
|
-
alias_method :process_pattern, :nginx_command
|
14
26
|
|
15
|
-
|
16
|
-
|
27
|
+
include Commands
|
28
|
+
|
29
|
+
%w(config_test reload_process reopen_logs).each do |method|
|
30
|
+
define_method(method) do
|
31
|
+
update_result send("#{method}!")
|
32
|
+
end
|
17
33
|
end
|
18
34
|
|
19
35
|
def quit_process
|
@@ -22,9 +38,9 @@ module Luban
|
|
22
38
|
return
|
23
39
|
end
|
24
40
|
|
41
|
+
unmonitor_process
|
25
42
|
output = quit_process!
|
26
43
|
if check_until { process_stopped? }
|
27
|
-
unmonitor_process
|
28
44
|
update_result "Gracefully stop #{package_full_name}: [OK] #{output}"
|
29
45
|
else
|
30
46
|
remove_orphaned_pid_file
|
@@ -33,34 +49,16 @@ module Luban
|
|
33
49
|
end
|
34
50
|
end
|
35
51
|
|
36
|
-
def before_quit; unmonitor_process; end
|
37
|
-
|
38
|
-
def reload_process
|
39
|
-
update_result reload_process!
|
40
|
-
end
|
41
|
-
|
42
|
-
def reopen_logs
|
43
|
-
update_result reopen_logs!
|
44
|
-
end
|
45
|
-
|
46
52
|
protected
|
47
53
|
|
48
54
|
def config_test!
|
49
55
|
capture("#{nginx_command} -t 2>&1")
|
50
56
|
end
|
51
57
|
|
52
|
-
def start_process!
|
53
|
-
capture("#{nginx_command} 2>&1")
|
54
|
-
end
|
55
|
-
|
56
58
|
def quit_process!
|
57
59
|
capture("#{nginx_command} -s quit 2>&1")
|
58
60
|
end
|
59
61
|
|
60
|
-
def stop_process!
|
61
|
-
capture("#{nginx_command} -s stop 2>&1")
|
62
|
-
end
|
63
|
-
|
64
62
|
def reload_process!
|
65
63
|
capture("#{nginx_command} -s reload 2>&1")
|
66
64
|
end
|
@@ -72,4 +70,4 @@ module Luban
|
|
72
70
|
end
|
73
71
|
end
|
74
72
|
end
|
75
|
-
end
|
73
|
+
end
|
@@ -3,9 +3,7 @@ module Luban
|
|
3
3
|
module Packages
|
4
4
|
class Nginx
|
5
5
|
class Installer < Luban::Deployment::Service::Installer
|
6
|
-
include
|
7
|
-
|
8
|
-
default_executable 'nginx'
|
6
|
+
include Controller::Commands
|
9
7
|
|
10
8
|
def source_repo
|
11
9
|
@source_repo ||= "http://nginx.org"
|
@@ -49,4 +47,4 @@ module Luban
|
|
49
47
|
end
|
50
48
|
end
|
51
49
|
end
|
52
|
-
end
|
50
|
+
end
|
@@ -40,4 +40,4 @@ proxy_redirect off;
|
|
40
40
|
# -------------------------------------
|
41
41
|
log_format main '$remote_addr - $remote_user [$time_local] $status '
|
42
42
|
'"$request" $body_bytes_sent "$http_referer" '
|
43
|
-
'"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
|
43
|
+
'"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
|
@@ -1,9 +1,5 @@
|
|
1
1
|
# Nginx reverse proxy configuration
|
2
2
|
|
3
|
-
# Environment: <%= env_name %>
|
4
|
-
# Revision: <%= revision %>
|
5
|
-
# Created at <%= now %>
|
6
|
-
|
7
3
|
upstream <%= serivce_entry %> {
|
8
4
|
# fail_timeout=0 means we always retry an upstream even if it failed
|
9
5
|
# to return a good HTTP response (in case the Puma master nukes a
|
@@ -1,15 +1,10 @@
|
|
1
1
|
# Monit control file for Nginx
|
2
2
|
|
3
|
-
# Environment: <%= env_name %>
|
4
|
-
# Revision: <%= revision %>
|
5
|
-
# Created at <%= now %>
|
6
|
-
|
7
|
-
<% nginx_command = "#{bin_path.join('nginx')} -c #{control_file_path}" %>
|
8
3
|
check process <%= service_entry %>
|
9
4
|
with pidfile <%= pid_file_path %>
|
10
|
-
start program = "/bin/bash -c 'sleep 1; <%=
|
11
|
-
stop program = "/bin/bash -c '<%=
|
5
|
+
start program = "/bin/bash -c 'sleep 1; <%= start_command %>'"
|
6
|
+
stop program = "/bin/bash -c '<%= stop_command %>'"
|
12
7
|
if totalmem is greater than 10.0 MB for 40 cycles then restart
|
13
|
-
if failed port 8080 for
|
8
|
+
if failed port 8080 for 4 times within 8 cycles then restart
|
14
9
|
if cpu is greater than 80% for 20 cycles then alert
|
15
10
|
if loadavg(5min) greater than 10 for 40 cycles then restart
|
@@ -6,7 +6,7 @@ module Luban
|
|
6
6
|
class Pcre < Luban::Deployment::Package::Base
|
7
7
|
class Installer < Luban::Deployment::Package::Installer
|
8
8
|
def pcre_executable
|
9
|
-
@
|
9
|
+
@pcre_executable ||= bin_path.join('pcre-config')
|
10
10
|
end
|
11
11
|
|
12
12
|
def source_repo
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luban-nginx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rubyist Chi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luban
|