capistrano-devops 0.0.12 → 0.0.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfc29117069157ffb1037420ffca03faf6a9c2be
4
- data.tar.gz: c3bf2166efb877a9effe7f85a4161bfd8c138796
3
+ metadata.gz: 9a0eadccd1218e6ed7f72541ca61d917c0dce403
4
+ data.tar.gz: 831043ac33f0baa88a7de833fa2add8429cf6e0c
5
5
  SHA512:
6
- metadata.gz: f5ceec8875da0cf59e3a904e4a21c2bf1927ec28a5607a21d574dac5372c5560f8401c482884066561a8c1338e252c38e34cc0473884d20f7d84cb95d64b8e81
7
- data.tar.gz: fc6dfb5812cc3960a7ee64c4df8a681cb463801e1e683706f8dc7d9c136cb4735290b2521d8b0d4a6c87d64005f2688feee425b0e8982ebe4b351d38ffcf8833
6
+ metadata.gz: 67c90af6d4665f20d59eea027f34fe92b1892885eab3894fc2d8e46d6091e012a6bd2e235e031c071985beb73bfaa3ca18f2f854ec325586e5857a7e7914f144
7
+ data.tar.gz: 797006d8db0f9d3298bac357fd958436fc2c1253629aeebcc44391a2a7f0c1e43080a58f0dc7e1a4f84e8b5a2d2e6062f1560551292e69e1af41bbde5ad92f4b
@@ -6,12 +6,6 @@ server {
6
6
  server_name <%= fetch(:server_name) %>;
7
7
  listen 80 default deferred;
8
8
 
9
- if (<%= fetch(:unicorn_force_ssl) %> = "true") {
10
- if ($http_x_forwarded_proto = "http") {
11
- return 301 https://$host$request_uri;
12
- }
13
- }
14
-
15
9
  root <%= current_path %>/public;
16
10
 
17
11
  location ^~ /assets/ {
@@ -33,35 +27,3 @@ server {
33
27
  client_max_body_size 4G;
34
28
  keepalive_timeout 10;
35
29
  }
36
-
37
- if (<%= fetch(:unicorn_force_ssl) %> = "true") {
38
- server {
39
- server_name <%= fetch(:server_name) %>;
40
- listen 443;
41
-
42
- ssl on;
43
- ssl_certificate /etc/ssl/certs/<%= fetch(:server_name) %>.crt;
44
- ssl_certificate_key /etc/ssl/private/server.key;
45
-
46
- root <%= current_path %>/public;
47
-
48
- location ^~ /assets/ {
49
- gzip_static on;
50
- expires max;
51
- add_header Cache-Control public;
52
- }
53
-
54
- try_files $uri/index.html $uri @unicorn;
55
- location @backend_<%= fetch(:application) %> {
56
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
57
- proxy_set_header Host $http_host;
58
- proxy_set_header X-Real-IP $remote_addr;
59
- proxy_redirect off;
60
- proxy_pass http://backend_<%= fetch(:application) %>;
61
- }
62
-
63
- error_page 500 502 503 504 /500.html;
64
- client_max_body_size 4G;
65
- keepalive_timeout 10;
66
- }
67
- }
@@ -0,0 +1,63 @@
1
+ upstream backend_<%= fetch(:application) %> {
2
+ server unix:/tmp/unicorn.<%= fetch(:application) %>.sock fail_timeout=0;
3
+ }
4
+
5
+ server {
6
+ server_name <%= fetch(:server_name) %>;
7
+ listen 80 default deferred;
8
+
9
+ if ($http_x_forwarded_proto = "http") {
10
+ return 301 https://$host$request_uri;
11
+ }
12
+
13
+ root <%= current_path %>/public;
14
+
15
+ location ^~ /assets/ {
16
+ gzip_static on;
17
+ expires max;
18
+ add_header Cache-Control public;
19
+ }
20
+
21
+ try_files $uri/index.html $uri @backend_<%= fetch(:application) %>;
22
+ location @backend_<%= fetch(:application) %> {
23
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24
+ proxy_set_header Host $http_host;
25
+ proxy_set_header X-Real-IP $remote_addr;
26
+ proxy_redirect off;
27
+ proxy_pass http://backend_<%= fetch(:application) %>;
28
+ }
29
+
30
+ error_page 500 502 503 504 /500.html;
31
+ client_max_body_size 4G;
32
+ keepalive_timeout 10;
33
+ }
34
+
35
+ server {
36
+ server_name <%= fetch(:server_name) %>;
37
+ listen 443;
38
+
39
+ ssl on;
40
+ ssl_certificate /etc/ssl/certs/<%= fetch(:server_name) %>.crt;
41
+ ssl_certificate_key /etc/ssl/private/server.key;
42
+
43
+ root <%= current_path %>/public;
44
+
45
+ location ^~ /assets/ {
46
+ gzip_static on;
47
+ expires max;
48
+ add_header Cache-Control public;
49
+ }
50
+
51
+ try_files $uri/index.html $uri @unicorn;
52
+ location @backend_<%= fetch(:application) %> {
53
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
54
+ proxy_set_header Host $http_host;
55
+ proxy_set_header X-Real-IP $remote_addr;
56
+ proxy_redirect off;
57
+ proxy_pass http://backend_<%= fetch(:application) %>;
58
+ }
59
+
60
+ error_page 500 502 503 504 /500.html;
61
+ client_max_body_size 4G;
62
+ keepalive_timeout 10;
63
+ }
@@ -6,3 +6,19 @@ stdout_path "<%= fetch(:unicorn_log) %>"
6
6
  listen "/tmp/unicorn.<%= fetch(:application) %>.sock"
7
7
  worker_processes <%= fetch(:unicorn_workers) %>
8
8
  timeout <%= fetch(:unicorn_timeout) %>
9
+
10
+ preload_app true
11
+
12
+ before_fork do |server, worker|
13
+ # Disconnect since the database connection will not carry over
14
+ if defined? ActiveRecord::Base
15
+ ActiveRecord::Base.connection.disconnect!
16
+ end
17
+ end
18
+
19
+ after_fork do |server, worker|
20
+ # Start up the database connection again in the worker
21
+ if defined?(ActiveRecord::Base)
22
+ ActiveRecord::Base.establish_connection
23
+ end
24
+ end
@@ -5,7 +5,7 @@ set -e
5
5
  TIMEOUT=${TIMEOUT-60}
6
6
  APP_ROOT=<%= current_path %>
7
7
  PID=<%= fetch(:unicorn_pid) %>
8
- CMD="cd <%= current_path %>; bundle exec unicorn -D -c <%= fetch(:unicorn_config) -E <%= fetch(:rails_env, 'production') %>"
8
+ CMD="cd <%= current_path %>; bundle exec unicorn -D -c <%= fetch(:unicorn_config) %> -E <%= fetch(:rails_env, 'production') %>"
9
9
  AS_USER=<%= fetch(:unicorn_user) %>
10
10
  set -u
11
11
 
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Devops
3
- VERSION = "0.0.12"
3
+ VERSION = "0.0.13"
4
4
  end
5
5
  end
@@ -37,4 +37,23 @@ namespace :nginx do
37
37
  after 'nginx:rainbows:setup', 'nginx:restart'
38
38
  end
39
39
  end
40
+
41
+ namespace :unicorn do
42
+ desc "Setup nginx configuration for this application (unicorn)"
43
+ task :setup do
44
+ on roles :web do
45
+ if fetch(:unicorn_force_ssl) == true
46
+ template "nginx_unicorn_ssl.erb", "/tmp/nginx_conf"
47
+ else
48
+ template "nginx_unicorn.erb", "/tmp/nginx_conf"
49
+ end
50
+
51
+ as :root do
52
+ execute :mv, "/tmp/nginx_conf /etc/nginx/sites-enabled/#{fetch(:application)}"
53
+ execute :rm, "-f /etc/nginx/sites-enabled/default"
54
+ end
55
+ end
56
+ after 'nginx:unicorn:setup', 'nginx:restart'
57
+ end
58
+ end
40
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-devops
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - tristan
@@ -14,28 +14,28 @@ dependencies:
14
14
  name: capistrano
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capistrano-bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: yay
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitignore"
48
+ - .gitignore
49
49
  - Gemfile
50
50
  - LICENSE.txt
51
51
  - README.md
@@ -62,6 +62,7 @@ files:
62
62
  - lib/capistrano/devops/ssh.rb
63
63
  - lib/capistrano/devops/templates/nginx_rainbows.erb
64
64
  - lib/capistrano/devops/templates/nginx_unicorn.erb
65
+ - lib/capistrano/devops/templates/nginx_unicorn_ssl.erb
65
66
  - lib/capistrano/devops/templates/rainbows.erb
66
67
  - lib/capistrano/devops/templates/rainbows_init.erb
67
68
  - lib/capistrano/devops/templates/unicorn.erb
@@ -145,18 +146,19 @@ require_paths:
145
146
  - lib
146
147
  required_ruby_version: !ruby/object:Gem::Requirement
147
148
  requirements:
148
- - - ">="
149
+ - - '>='
149
150
  - !ruby/object:Gem::Version
150
151
  version: '0'
151
152
  required_rubygems_version: !ruby/object:Gem::Requirement
152
153
  requirements:
153
- - - ">="
154
+ - - '>='
154
155
  - !ruby/object:Gem::Version
155
156
  version: '0'
156
157
  requirements: []
157
158
  rubyforge_project:
158
- rubygems_version: 2.2.2
159
+ rubygems_version: 2.0.3
159
160
  signing_key:
160
161
  specification_version: 4
161
162
  summary: yay
162
163
  test_files: []
164
+ has_rdoc: