luban-nginx 0.1.5 → 0.1.6
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 +5 -0
- data/lib/luban/deployment/packages/nginx/base.rb +6 -0
- data/lib/luban/deployment/packages/nginx/configurator.rb +14 -0
- data/lib/luban/deployment/packages/nginx/templates/nginx.conf.erb +3 -2
- data/lib/luban/deployment/packages/nginx/templates/nginx.monitrc.erb +4 -0
- data/lib/luban/deployment/packages/nginx/version.rb +1 -1
- metadata +2 -3
- data/lib/luban/deployment/packages/nginx/templates/nginx.http.proxy.conf +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e3943af49cf3e11c87fee0fb62dc843eec8f966
|
4
|
+
data.tar.gz: 1cd30b085fbfe7cd099486a7628f2c46443a8fa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9e0ac59ac1d298877be74e1408610859f587e493a9778524d5ed42e1f64a1f6094463036b1146238cc600da7cf03a852169b83c7ad6e7a63e270d4c90a4470d
|
7
|
+
data.tar.gz: ab8d1b52b7e6a683f92fe2db9e7938a0ac6ce4687cad8fe8bf4a29df88ff30ffbe06252135ac0f7f07a5298e74ee3e21e049e905e206545e206fffdc2cd62856
|
data/CHANGELOG.md
CHANGED
@@ -19,6 +19,12 @@ module Luban
|
|
19
19
|
|
20
20
|
protected
|
21
21
|
|
22
|
+
def compose_task_options(opts)
|
23
|
+
super.tap do |opts|
|
24
|
+
opts.merge!(proxy_app: find_application(opts[:proxy_to])) if opts[:proxy_to]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
22
28
|
def setup_install_tasks
|
23
29
|
super
|
24
30
|
commands[:install].option :pcre, "PCRE version"
|
@@ -32,6 +32,20 @@ module Luban
|
|
32
32
|
def mime_types_file_name
|
33
33
|
@mime_types_file_name ||= 'mime.types'
|
34
34
|
end
|
35
|
+
|
36
|
+
def proxy_app; task.opts.proxy_app; end
|
37
|
+
def proxy_to; task.opts.proxy_to end
|
38
|
+
def proxy?; !!proxy_to; end
|
39
|
+
|
40
|
+
def proxy_control_file_path
|
41
|
+
@proxy_control_file_path ||=
|
42
|
+
project_path.join(proxy_to.to_s, 'shared', 'profile', proxy_to.to_s).
|
43
|
+
join(proxy_control_file_name)
|
44
|
+
end
|
45
|
+
|
46
|
+
def proxy_control_file_name
|
47
|
+
@proxy_control_file_name ||= "nginx.http.proxy.conf"
|
48
|
+
end
|
35
49
|
end
|
36
50
|
end
|
37
51
|
end
|
@@ -9,8 +9,9 @@ http {
|
|
9
9
|
include <%= mime_types_file_path %>;
|
10
10
|
include <%= profile_path.join('nginx.http.conf') %>;
|
11
11
|
include <%= profile_path.join('nginx.http.*.conf') %>;
|
12
|
+
<%- if proxy? -%>
|
13
|
+
include <%= proxy_control_file_path %>;
|
14
|
+
<%- end -%>
|
12
15
|
|
13
16
|
access_log <%= access_log_file_path %> main;
|
14
17
|
}
|
15
|
-
|
16
|
-
|
@@ -6,6 +6,10 @@ check process <%= service_entry %>
|
|
6
6
|
start program = "/bin/bash -c 'sleep 1; <%= start_command %>'"
|
7
7
|
stop program = "/bin/bash -c '<%= stop_command %>'"
|
8
8
|
if totalmem is greater than 10.0 MB for 40 cycles then restart
|
9
|
+
<%- if proxy? -%>
|
10
|
+
if failed port <%= proxy_app.port %> for 4 times within 8 cycles then restart
|
11
|
+
<%- else -%>
|
9
12
|
if failed port 8080 for 4 times within 8 cycles then restart
|
13
|
+
<%- end -%>
|
10
14
|
if cpu is greater than 80% for 20 cycles then alert
|
11
15
|
if loadavg(5min) greater than 10 for 40 cycles then restart
|
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.6
|
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-07-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luban
|
@@ -90,7 +90,6 @@ files:
|
|
90
90
|
- lib/luban/deployment/packages/nginx/installer.rb
|
91
91
|
- lib/luban/deployment/packages/nginx/templates/nginx.conf.erb
|
92
92
|
- lib/luban/deployment/packages/nginx/templates/nginx.http.conf
|
93
|
-
- lib/luban/deployment/packages/nginx/templates/nginx.http.proxy.conf
|
94
93
|
- lib/luban/deployment/packages/nginx/templates/nginx.logrotate.erb
|
95
94
|
- lib/luban/deployment/packages/nginx/templates/nginx.main.conf
|
96
95
|
- lib/luban/deployment/packages/nginx/templates/nginx.monitrc.erb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# Nginx reverse proxy configuration
|
2
|
-
|
3
|
-
upstream <%= serivce_entry %> {
|
4
|
-
# fail_timeout=0 means we always retry an upstream even if it failed
|
5
|
-
# to return a good HTTP response (in case the Puma master nukes a
|
6
|
-
# single worker for timing out).
|
7
|
-
|
8
|
-
# for UNIX domain socket setups:
|
9
|
-
# server unix:<%= ruby_socket_file %> fail_timeout=0;
|
10
|
-
|
11
|
-
# for TCP setups, point these to the backend servers
|
12
|
-
# server 192.168.0.7:<%= tcp_port %> fail_timeout=0;
|
13
|
-
# server 192.168.0.8:<%= tcp_port %> fail_timeout=0;
|
14
|
-
# server 192.168.0.9:<%= tcp_port %> fail_timeout=0;
|
15
|
-
}
|
16
|
-
|
17
|
-
server {
|
18
|
-
# listen <%= tcp_port %>;
|
19
|
-
# server_name <%= virtual_host %>;
|
20
|
-
|
21
|
-
# ~2 seconds is often enough for most cases to parse HTML/CSS and
|
22
|
-
# retrieve needed images/icons/frames, connections are cheap in
|
23
|
-
# nginx so increasing this is generally safe...
|
24
|
-
keepalive_timeout 5;
|
25
|
-
|
26
|
-
# path for static files
|
27
|
-
# root <%= current_path %>/public;
|
28
|
-
|
29
|
-
location ~ ^/assets/ {
|
30
|
-
gzip_static on; # to serve pre-gizpped version
|
31
|
-
expires 1y;
|
32
|
-
add_header Cache-Control public;
|
33
|
-
add_header ETag "";
|
34
|
-
break;
|
35
|
-
}
|
36
|
-
|
37
|
-
try_files $uri/index.html $uri.html $uri @app;
|
38
|
-
|
39
|
-
location @app {
|
40
|
-
proxy_pass http://<%= service_entry %>;
|
41
|
-
}
|
42
|
-
}
|