luban-nginx 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16675ea7d9862ccc2cb4662bc0b64e805c51a13a
4
- data.tar.gz: efb9384f2987130ff5dcb9f3f564d682f0c7e85e
3
+ metadata.gz: 1e3943af49cf3e11c87fee0fb62dc843eec8f966
4
+ data.tar.gz: 1cd30b085fbfe7cd099486a7628f2c46443a8fa3
5
5
  SHA512:
6
- metadata.gz: 59376076da322a1e33e068d2595c8db905bd3eb9ea2ce8e83c6195571910d26f824c9f0b7bf2d28fc585db30a97d9a1ce3234286914ddcd899a0c267494d3bcf
7
- data.tar.gz: a3b9c7057a18a5868a3c6fabbdc4a8599721fe8290b4b669fcafc2ed79092ed7a84db9e64cbe28a1afdd039aa03b9c60b97854632214fd3bc6e9652fdfc7fd74
6
+ metadata.gz: b9e0ac59ac1d298877be74e1408610859f587e493a9778524d5ed42e1f64a1f6094463036b1146238cc600da7cf03a852169b83c7ad6e7a63e270d4c90a4470d
7
+ data.tar.gz: ab8d1b52b7e6a683f92fe2db9e7938a0ac6ce4687cad8fe8bf4a29df88ff30ffbe06252135ac0f7f07a5298e74ee3e21e049e905e206545e206fffdc2cd62856
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.1.6 (Jul 14, 2016)
4
+
5
+ New features:
6
+ * Supported proxy configuration to Rack-based application
7
+
3
8
  ## Version 0.1.5 (Jul 11, 2016)
4
9
 
5
10
  Minor enhancements:
@@ -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
@@ -2,7 +2,7 @@ module Luban
2
2
  module Deployment
3
3
  module Packages
4
4
  class Nginx
5
- VERSION = '0.1.5'
5
+ VERSION = '0.1.6'
6
6
  end
7
7
  end
8
8
  end
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.5
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 00:00:00.000000000 Z
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
- }