ms_deploy 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/examples/deploy.rb +3 -0
- data/lib/ms_deploy/recipes/defaults.rb +3 -0
- data/lib/ms_deploy/recipes/nginx.rb +26 -7
- data/lib/ms_deploy/templates/vhost.erb +19 -2
- data/lib/ms_deploy/version.rb +1 -1
- metadata +20 -20
data/lib/examples/deploy.rb
CHANGED
@@ -4,6 +4,9 @@ set :domain, ''
|
|
4
4
|
set :deploy_domain, ''
|
5
5
|
set :vhost_domain, ''
|
6
6
|
|
7
|
+
# set application folder
|
8
|
+
set :deploy_to, "/var/projects/#{application}/xxx"
|
9
|
+
|
7
10
|
set :rails_root, File.expand_path('../../', __FILE__)
|
8
11
|
set :rails_env, :production # use 'stage' to differ between stage environments
|
9
12
|
|
@@ -4,6 +4,7 @@ Capistrano::Configuration.instance.load do
|
|
4
4
|
abort "You must set :user before using defaults" unless fetch(:user, nil)
|
5
5
|
abort "You must set :repository before using defaults" unless fetch(:repository, nil)
|
6
6
|
abort "You must set :branch before using defaults" unless fetch(:branch, nil)
|
7
|
+
abort "You must set :deploy_to before using defaults" unless fetch(:deploy_to, nil)
|
7
8
|
|
8
9
|
set :uptodate_scm, :git
|
9
10
|
set :uptodate_branch, fetch(:branch)
|
@@ -33,6 +34,8 @@ Capistrano::Configuration.instance.load do
|
|
33
34
|
|
34
35
|
set :group, user
|
35
36
|
|
37
|
+
set :protocol, :both
|
38
|
+
|
36
39
|
set :scm, :git
|
37
40
|
set :git_enable_submodules, true
|
38
41
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require "ms_deploy/render"
|
1
|
+
require "ms_deploy/render"
|
2
2
|
|
3
3
|
Capistrano::Configuration.instance.load do
|
4
4
|
|
@@ -29,17 +29,36 @@ Capistrano::Configuration.instance.load do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
task :install do
|
32
|
+
protocol = fetch(:protocol, nil).to_s
|
32
33
|
template_path = File.expand_path('../../templates/vhost.erb', __FILE__)
|
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
|
-
config_path = "#{shared_path}/config/#{application}_vhost.conf"
|
34
|
+
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), 'protocol' => 'http', 'nginx_cert_dir' => fetch(:nginx_cert_dir, '/etc/nginx/cert'), 'with_upstream_server' => true}
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
if protocol.nil? or protocol == 'http' or protocol == 'both'
|
37
|
+
config_path = "#{shared_path}/config/#{application}_vhost.conf"
|
38
|
+
|
39
|
+
put(render_erb_template(template_path, vars), config_path)
|
40
|
+
sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
|
41
|
+
sudo "ln -s #{config_path} /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
|
42
|
+
end
|
43
|
+
if protocol == 'https' or protocol == 'both'
|
44
|
+
vars.merge!({'protocol' => 'https', 'with_upstream_server' => false})
|
45
|
+
|
46
|
+
config_path = "#{shared_path}/config/#{application}_ssl_vhost.conf"
|
47
|
+
|
48
|
+
put(render_erb_template(template_path, vars), config_path)
|
49
|
+
sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}_ssl.conf"
|
50
|
+
sudo "ln -s #{config_path} /etc/nginx/sites-enabled/#{application}_#{stage}_ssl.conf"
|
51
|
+
end
|
39
52
|
end
|
40
53
|
|
41
54
|
task :uninstall do
|
42
|
-
|
55
|
+
protocol = fetch(:protocol, nil)
|
56
|
+
|
57
|
+
if protocol.blank? or protocol == 'http' or protocol == 'both'
|
58
|
+
sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
|
59
|
+
elsif protocol == 'https' or protocol == 'both'
|
60
|
+
sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}_ssl.conf"
|
61
|
+
end
|
43
62
|
end
|
44
63
|
end
|
45
64
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
<% if with_upstream_server %>
|
3
|
+
|
2
4
|
upstream <%= application %>_<%= stage %>_server {
|
3
5
|
# fail_timeout=0 means we always retry an upstream even if it failed
|
4
6
|
# to return a good HTTP response (in case the Unicorn master nukes a
|
@@ -12,19 +14,34 @@ upstream <%= application %>_<%= stage %>_server {
|
|
12
14
|
# server 192.168.0.8:8080 fail_timeout=0;
|
13
15
|
# server 192.168.0.9:8080 fail_timeout=0;
|
14
16
|
}
|
17
|
+
<% end %>
|
15
18
|
|
16
19
|
server {
|
17
20
|
|
18
|
-
listen 80;
|
19
21
|
server_name <%= domain %>;
|
20
22
|
|
21
|
-
|
23
|
+
<% if protocol == 'https' %>
|
24
|
+
|
25
|
+
listen 443 default_server ssl;
|
26
|
+
|
27
|
+
ssl_certificate <%= nginx_cert_dir %>/<%= application %>_cert.pem;
|
28
|
+
ssl_certificate_key <%= nginx_cert_dir %>/<%= application %>_cert.key;
|
29
|
+
|
30
|
+
keepalive_timeout 70;
|
31
|
+
|
32
|
+
<% else %>
|
33
|
+
|
34
|
+
listen 80;
|
22
35
|
|
23
36
|
# ~2 seconds is often enough for most folks to parse HTML/CSS and
|
24
37
|
# retrieve needed images/icons/frames, connections are cheap in
|
25
38
|
# nginx so increasing this is generally safe...
|
26
39
|
#keepalive_timeout 5;
|
27
40
|
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
client_max_body_size 4G;
|
44
|
+
|
28
45
|
# path for static files
|
29
46
|
root <%= project_root %>/public;
|
30
47
|
|
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.1.
|
4
|
+
version: 0.1.3
|
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-06-
|
12
|
+
date: 2012-06-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gemcutter
|
16
|
-
requirement: &
|
16
|
+
requirement: &84131860 !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: *84131860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano
|
27
|
-
requirement: &
|
27
|
+
requirement: &84131690 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.12.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *84131690
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: capistrano-ext
|
38
|
-
requirement: &
|
38
|
+
requirement: &84131320 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.2.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *84131320
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: capistrano_colors
|
49
|
-
requirement: &
|
49
|
+
requirement: &84130820 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.5.5
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *84130820
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: capistrano-unicorn
|
60
|
-
requirement: &
|
60
|
+
requirement: &84130590 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.1.6
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *84130590
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: capistrano-file_db
|
71
|
-
requirement: &
|
71
|
+
requirement: &84130300 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.1.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *84130300
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: capistrano-uptodate
|
82
|
-
requirement: &
|
82
|
+
requirement: &84130000 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.0.2
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *84130000
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rvm-capistrano
|
93
|
-
requirement: &
|
93
|
+
requirement: &84129720 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 1.2.2
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *84129720
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: erubis
|
104
|
-
requirement: &
|
104
|
+
requirement: &84129480 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *84129480
|
113
113
|
description: capistrano deployment task for my projects
|
114
114
|
email:
|
115
115
|
- michael.schiller@gmx.de
|