luban-rack 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/luban/deployment/applications/rack/base.rb +7 -1
- data/lib/luban/deployment/applications/rack/configurator.rb +5 -0
- data/lib/luban/deployment/applications/rack/controller.rb +5 -0
- data/lib/luban/deployment/applications/rack/paths.rb +13 -4
- data/lib/luban/deployment/applications/rack/templates/thin/nginx.http.proxy.conf.erb +45 -0
- data/lib/luban/deployment/applications/rack/templates/thin/thin.monitrc.erb +1 -1
- data/lib/luban/deployment/applications/rack/version.rb +1 -1
- data/lib/luban/deployment/applications/rack/web_server.rb +0 -1
- data/lib/luban/deployment/applications/rack/web_servers/thin.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbb9ea87d6f534b68912727570e3c6233ef32685
|
4
|
+
data.tar.gz: de08144a0493b050f6d979f62c5ac789f6dfbf2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd634449efb923be8f666a6da47ca5a7db3d8505de69e26de267852536217f906990b82367534b8bc608f2290417e8d3cddaa22da4800f6d0617f1a1fd653b41
|
7
|
+
data.tar.gz: 454d1316ad6cbec1cac6eef112a1dd2099198c69abadca773b128923a59cc220baaf28e2a1e8e878974e9d857ff47ea356fb42d83e08c3a3bd2895f54aef3ada
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## Version 0.1.2 (Jul 14, 2016)
|
4
|
+
|
5
|
+
New features:
|
6
|
+
* Supported generation of Nginx proxy configuration
|
7
|
+
|
8
|
+
* Bug fixes:
|
9
|
+
* Fixed issues to correctly set default web server options for Configurator and Controller
|
10
|
+
* Corrected issues when composing socket file path for cluster
|
11
|
+
* Changed the starting port for cluster to avoid conflicting to the actual port the web app uses
|
12
|
+
|
3
13
|
## Version 0.1.1 (Jul 11, 2016)
|
4
14
|
|
5
15
|
New features:
|
@@ -5,10 +5,14 @@ module Luban
|
|
5
5
|
using Luban::CLI::CoreRefinements
|
6
6
|
|
7
7
|
module Parameters
|
8
|
-
extend Luban::Deployment::Parameters::Base
|
8
|
+
extend Luban::Deployment::Parameters::Base
|
9
9
|
|
10
|
+
DefaultPort = 3000
|
11
|
+
DefaultVirtualHost = 'localhost'
|
10
12
|
DefaultWebServer = :thin
|
11
13
|
|
14
|
+
parameter :port
|
15
|
+
parameter :virtual_host
|
12
16
|
parameter :web_server
|
13
17
|
|
14
18
|
def power_by(server, **opts)
|
@@ -18,6 +22,8 @@ module Luban
|
|
18
22
|
protected
|
19
23
|
|
20
24
|
def set_default_rack_parameters
|
25
|
+
set_default :port, DefaultPort
|
26
|
+
set_default :virtual_host, DefaultVirtualHost
|
21
27
|
set_default :web_server, name: DefaultWebServer, opts: {}
|
22
28
|
end
|
23
29
|
end
|
@@ -43,12 +43,21 @@ module Luban
|
|
43
43
|
@sockets_path ||= shared_path.join('sockets')
|
44
44
|
end
|
45
45
|
|
46
|
-
def socket_file_path
|
47
|
-
|
46
|
+
def socket_file_path(n = nil)
|
47
|
+
if n.nil?
|
48
|
+
@socket_file_path ||= sockets_path.join(socket_file_name)
|
49
|
+
else
|
50
|
+
sockets_path.join(socket_file_name(n))
|
51
|
+
end
|
48
52
|
end
|
49
53
|
|
50
|
-
def socket_file_name
|
51
|
-
|
54
|
+
def socket_file_name(n = nil)
|
55
|
+
if n.nil?
|
56
|
+
@socket_file_name ||= "#{web_server[:name]}.sock"
|
57
|
+
else
|
58
|
+
"#{web_server[:name]}.#{n}.sock"
|
59
|
+
end
|
60
|
+
|
52
61
|
end
|
53
62
|
|
54
63
|
def ruby_bin_path
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Nginx reverse proxy configuration for Thin
|
2
|
+
|
3
|
+
<% opts = web_server[:opts] -%>
|
4
|
+
upstream <%= service_entry %> {
|
5
|
+
# fail_timeout=0 means we always retry an upstream even if it failed
|
6
|
+
# to return a good HTTP response
|
7
|
+
|
8
|
+
<%- if opts[:port] -%>
|
9
|
+
<%- opts[:servers].times do |n| -%>
|
10
|
+
server <%= opts[:address] %>:<%= opts[:port] + n %> fail_timeout=0;
|
11
|
+
<%- end -%>
|
12
|
+
<%- end -%>
|
13
|
+
<%- if opts[:socket] -%>
|
14
|
+
<%- opts[:servers].times do |n| -%>
|
15
|
+
server unix:<%= socket_file_path(n) %> fail_timeout=0;
|
16
|
+
<%- end -%>
|
17
|
+
<%- end -%>
|
18
|
+
}
|
19
|
+
|
20
|
+
server {
|
21
|
+
listen <%= port %>;
|
22
|
+
server_name <%= virtual_host %>;
|
23
|
+
|
24
|
+
# ~2 seconds is often enough for most cases to parse HTML/CSS and
|
25
|
+
# retrieve needed images/icons/frames, connections are cheap in
|
26
|
+
# nginx so increasing this is generally safe...
|
27
|
+
keepalive_timeout 5;
|
28
|
+
|
29
|
+
# path for static files
|
30
|
+
root <%= current_app_path %>/public;
|
31
|
+
|
32
|
+
location ~ ^/assets/ {
|
33
|
+
gzip_static on; # to serve pre-gizpped version
|
34
|
+
expires 1y;
|
35
|
+
add_header Cache-Control public;
|
36
|
+
add_header ETag "";
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
|
40
|
+
try_files $uri/index.html $uri.html $uri @app;
|
41
|
+
|
42
|
+
location @app {
|
43
|
+
proxy_pass http://<%= service_entry %>;
|
44
|
+
}
|
45
|
+
}
|
@@ -10,7 +10,7 @@ check process <%= service_entry %>.<%= web_server[:name] %>.<%= n %>
|
|
10
10
|
stop program = "/bin/bash -c '<%= stop_command %> -o <%=n %>'"
|
11
11
|
if totalmem is greater than 150.0 MB for 40 cycles then alert
|
12
12
|
<%- if opts[:port] -%>
|
13
|
-
if failed port <%= opts[:port]
|
13
|
+
if failed port <%= opts[:port] + n %> for 4 times within 8 cycles then restart
|
14
14
|
<%- end -%>
|
15
15
|
<%- if opts[:socket] -%>
|
16
16
|
if failed unixsocket <%= socket_file_path(n) %> for 4 times within 8 cycles then restart
|
@@ -18,7 +18,6 @@ module Luban
|
|
18
18
|
def load_web_server
|
19
19
|
require web_server_require_path
|
20
20
|
singleton_class.send(:prepend, web_server_module(web_server_require_path))
|
21
|
-
set_default_web_server_options
|
22
21
|
rescue LoadError => e
|
23
22
|
abort "Aborted! Failed to load web server #{web_server[:name].inspect}."
|
24
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luban-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
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
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/luban/deployment/applications/rack/configurator.rb
|
89
89
|
- lib/luban/deployment/applications/rack/controller.rb
|
90
90
|
- lib/luban/deployment/applications/rack/paths.rb
|
91
|
+
- lib/luban/deployment/applications/rack/templates/thin/nginx.http.proxy.conf.erb
|
91
92
|
- lib/luban/deployment/applications/rack/templates/thin/thin.logrotate.erb
|
92
93
|
- lib/luban/deployment/applications/rack/templates/thin/thin.monitrc.erb
|
93
94
|
- lib/luban/deployment/applications/rack/templates/thin/thin.yml.erb
|