ms_deploy 0.0.7 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/examples/deploy.rb +5 -6
- data/lib/ms_deploy/recipes/deploy/assets.rb +1 -0
- data/lib/ms_deploy/recipes/deploy/unicorn.rb +4 -4
- data/lib/ms_deploy/recipes/nginx.rb +4 -4
- data/lib/ms_deploy/templates/vhost.erb +8 -3
- data/lib/ms_deploy/version.rb +1 -1
- metadata +8 -9
- data/lib/ms_deploy/templates/ssl_vhost.erb +0 -85
data/lib/examples/deploy.rb
CHANGED
@@ -73,8 +73,7 @@ set(:shared_directories_to_create) {
|
|
73
73
|
|
74
74
|
set(:shared_directories_to_link) {
|
75
75
|
{
|
76
|
-
"#{shared_path}/bundle/" => "#{release_path}/vendor/bundle"
|
77
|
-
"#{shared_path}/solr/" => "#{release_path}/solr"
|
76
|
+
"#{shared_path}/bundle/" => "#{release_path}/vendor/bundle"
|
78
77
|
}
|
79
78
|
}
|
80
79
|
|
@@ -87,15 +86,15 @@ set(:directories_to_create) {
|
|
87
86
|
|
88
87
|
set(:files_to_link) {
|
89
88
|
{
|
90
|
-
"#{shared_path}/config/config.
|
91
|
-
"#{shared_path}/config/unicorn.
|
89
|
+
"#{shared_path}/config/config.#{stage}.yml" => "#{release_path}/config/config.local.yml",
|
90
|
+
"#{shared_path}/config/unicorn.#{stage}.rb" => "#{release_path}/config/unicorn.production.rb"
|
92
91
|
}
|
93
92
|
}
|
94
93
|
|
95
94
|
set(:config_file_to_setup) {
|
96
95
|
[
|
97
|
-
"config.
|
98
|
-
"unicorn.
|
96
|
+
"config.#{stage}.yml",
|
97
|
+
"unicorn.#{stage}.rb"
|
99
98
|
]
|
100
99
|
}
|
101
100
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
Capistrano::Configuration.instance.load do
|
2
2
|
|
3
3
|
set :unicorn_binary, "bundle exec unicorn"
|
4
|
-
set :unicorn_config, "
|
5
|
-
set :unicorn_pid, "
|
4
|
+
set :unicorn_config, "config/unicorn.#{fetch(:stage, 'production')}.rb"
|
5
|
+
set :unicorn_pid, "tmp/pids/unicorn.pid"
|
6
6
|
|
7
7
|
namespace :deploy do
|
8
8
|
task :start, :roles => :app, :except => { :no_release => true } do
|
9
|
-
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
|
9
|
+
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{current_path}/#{unicorn_config} -E #{rails_env} -D"
|
10
10
|
end
|
11
11
|
task :stop, :roles => :app, :except => { :no_release => true } do
|
12
|
-
run "if [ -f #{unicorn_pid} ]; then #{try_sudo} kill `cat #{unicorn_pid}`; fi"
|
12
|
+
run "if [ -f #{current_path}/#{unicorn_pid} ]; then #{try_sudo} kill `cat #{current_path}/#{unicorn_pid}`; fi"
|
13
13
|
end
|
14
14
|
task :graceful_stop, :roles => :app, :except => { :no_release => true } do
|
15
15
|
run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
|
@@ -30,16 +30,16 @@ Capistrano::Configuration.instance.load do
|
|
30
30
|
|
31
31
|
task :install do
|
32
32
|
template_path = File.expand_path('../../templates/vhost.erb', __FILE__)
|
33
|
-
vars = {'application'=> application, 'project_root' => deploy_to + '/current', 'domain' => vhost_domain}
|
33
|
+
vars = {'application'=> application, 'project_root' => deploy_to + '/current', 'domain' => vhost_domain, 'stage' => stage, 'auth_basic_title' => fetch(:auth_basic_title, nil), 'auth_basic_password_file' => fetch(:auth_basic_password_file, nil)}
|
34
34
|
config_path = "#{shared_path}/config/#{application}_vhost.conf"
|
35
35
|
|
36
36
|
put(render_erb_template(template_path, vars), config_path)
|
37
|
-
sudo "rm -f /etc/nginx/sites-enabled/#{application}.conf"
|
38
|
-
sudo "ln -s #{config_path} /etc/nginx/sites-enabled/#{application}.conf"
|
37
|
+
sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
|
38
|
+
sudo "ln -s #{config_path} /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
|
39
39
|
end
|
40
40
|
|
41
41
|
task :uninstall do
|
42
|
-
sudo "rm -f /etc/nginx/sites-enabled/#{application}.conf"
|
42
|
+
sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
upstream <%= application %>_server {
|
2
|
+
upstream <%= application %>_<%= stage %>_server {
|
3
3
|
# fail_timeout=0 means we always retry an upstream even if it failed
|
4
4
|
# to return a good HTTP response (in case the Unicorn master nukes a
|
5
5
|
# single worker for timing out).
|
6
6
|
|
7
7
|
# This is the socket we configured in unicorn.rb
|
8
|
-
server unix:/tmp/sockets/<%= application %>.sock fail_timeout=0;
|
8
|
+
server unix:/tmp/sockets/<%= application %>_<%= stage %>.sock fail_timeout=0;
|
9
9
|
|
10
10
|
# for TCP setups, point these to your backend servers
|
11
11
|
# server 127.0.0.1:8080 fail_timeout=0;
|
@@ -67,9 +67,14 @@ server {
|
|
67
67
|
# proxy_buffering off;
|
68
68
|
|
69
69
|
if (!-f $request_filename) {
|
70
|
-
proxy_pass http://<%= application %>_server;
|
70
|
+
proxy_pass http://<%= application %>_<%= stage %>_server;
|
71
71
|
break;
|
72
72
|
}
|
73
|
+
|
74
|
+
<% if auth_basic_title %>
|
75
|
+
auth_basic "<%= auth_basic_title %>";
|
76
|
+
auth_basic_user_file <%= auth_basic_password_file %>;
|
77
|
+
<% end %>
|
73
78
|
}
|
74
79
|
|
75
80
|
# Rails error pages
|
data/lib/ms_deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ms_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &77667400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *77667400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano-ext
|
27
|
-
requirement: &
|
27
|
+
requirement: &77666540 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *77666540
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: erubis
|
38
|
-
requirement: &
|
38
|
+
requirement: &77665970 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *77665970
|
47
47
|
description: capistrano deployment task for my projects
|
48
48
|
email:
|
49
49
|
- michael.schiller@gmx.de
|
@@ -68,7 +68,6 @@ files:
|
|
68
68
|
- lib/ms_deploy/recipes/redis.rb
|
69
69
|
- lib/ms_deploy/recipes/whenever.rb
|
70
70
|
- lib/ms_deploy/render.rb
|
71
|
-
- lib/ms_deploy/templates/ssl_vhost.erb
|
72
71
|
- lib/ms_deploy/templates/vhost.erb
|
73
72
|
- lib/ms_deploy/version.rb
|
74
73
|
- ms_deploy.gemspec
|
@@ -1,85 +0,0 @@
|
|
1
|
-
|
2
|
-
upstream <%= application %>_server {
|
3
|
-
# fail_timeout=0 means we always retry an upstream even if it failed
|
4
|
-
# to return a good HTTP response (in case the Unicorn master nukes a
|
5
|
-
# single worker for timing out).
|
6
|
-
|
7
|
-
# This is the socket we configured in unicorn.rb
|
8
|
-
server unix: <%= project_root %>/tmp/sockets/unicorn.sock fail_timeout=0;
|
9
|
-
|
10
|
-
# for TCP setups, point these to your backend servers
|
11
|
-
# server 127.0.0.1:8080 fail_timeout=0;
|
12
|
-
# server 192.168.0.8:8080 fail_timeout=0;
|
13
|
-
# server 192.168.0.9:8080 fail_timeout=0;
|
14
|
-
}
|
15
|
-
|
16
|
-
server {
|
17
|
-
|
18
|
-
listen 443;
|
19
|
-
server_name <%= domain %>;
|
20
|
-
|
21
|
-
ssl on;
|
22
|
-
ssl_certificate /usr/local/nginx/conf/cert.pem;
|
23
|
-
ssl_certificate_key /usr/local/nginx/conf/cert.key;
|
24
|
-
|
25
|
-
client_max_body_size 4G;
|
26
|
-
|
27
|
-
# ~2 seconds is often enough for most folks to parse HTML/CSS and
|
28
|
-
# retrieve needed images/icons/frames, connections are cheap in
|
29
|
-
# nginx so increasing this is generally safe...
|
30
|
-
#keepalive_timeout 5;
|
31
|
-
|
32
|
-
# path for static files
|
33
|
-
root <%= project_root %>/public;
|
34
|
-
|
35
|
-
# Prefer to serve static files directly from nginx to avoid unnecessary
|
36
|
-
# data copies from the application server.
|
37
|
-
#
|
38
|
-
# try_files directive appeared in in nginx 0.7.27 and has stabilized
|
39
|
-
# over time. Older versions of nginx (e.g. 0.6.x) requires
|
40
|
-
# "if (!-f $request_filename)" which was less efficient:
|
41
|
-
# http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
|
42
|
-
try_files $uri/index.html $uri.html $uri @app;
|
43
|
-
|
44
|
-
location / {
|
45
|
-
# an HTTP header important enough to have its own Wikipedia entry:
|
46
|
-
# http://en.wikipedia.org/wiki/X-Forwarded-For
|
47
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
48
|
-
|
49
|
-
# enable this if and only if you use HTTPS, this helps Rack
|
50
|
-
# set the proper protocol for doing redirects:
|
51
|
-
# proxy_set_header X-Forwarded-Proto https;
|
52
|
-
|
53
|
-
# pass the Host: header from the client right along so redirects
|
54
|
-
# can be set properly within the Rack application
|
55
|
-
proxy_set_header Host $http_host;
|
56
|
-
|
57
|
-
# we don't want nginx trying to do something clever with
|
58
|
-
# redirects, we set the Host: header above already.
|
59
|
-
proxy_redirect off;
|
60
|
-
|
61
|
-
# set "proxy_buffering off" *only* for Rainbows! when doing
|
62
|
-
# Comet/long-poll/streaming. It's also safe to set if you're using
|
63
|
-
# only serving fast clients with Unicorn + nginx, but not slow
|
64
|
-
# clients. You normally want nginx to buffer responses to slow
|
65
|
-
# clients, even with Rails 3.1 streaming because otherwise a slow
|
66
|
-
# client can become a bottleneck of Unicorn.
|
67
|
-
#
|
68
|
-
# The Rack application may also set "X-Accel-Buffering (yes|no)"
|
69
|
-
# in the response headers do disable/enable buffering on a
|
70
|
-
# per-response basis.
|
71
|
-
# proxy_buffering off;
|
72
|
-
|
73
|
-
if (!-f $request_filename) {
|
74
|
-
proxy_pass http://app_server;
|
75
|
-
break;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
# Rails error pages
|
80
|
-
error_page 500 502 503 504 /500.html;
|
81
|
-
location = /500.html {
|
82
|
-
root <%= project_root %>/public;
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|