greenonline_capistrano_recipes 0.0.18 → 0.0.19
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53ccdf840a5de26a46cdcf172b5a9d1adb3177cf
|
4
|
+
data.tar.gz: ca88442c1c6cd7decf0702e0c5dc9bfbc84cdc64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9c73454ae2a851988ddc82bdb3bf9bbe47dcc8be7dbf64304debd0de07cbe341bfd5f1ed0583c6b1caeeb902ac7587a96e03e2b63c6318c8dce5ba87bc0d69b
|
7
|
+
data.tar.gz: adfd7700fe46e98dc03019bbbfd6edf3f00d37747b43910e788da2d54cf239a508e4a166896c6e5f65914380b5d31a9422911df318a0f795ff34e0771630b9ab
|
@@ -1,9 +1,13 @@
|
|
1
1
|
module Capistrano
|
2
2
|
Configuration.instance(true).load do
|
3
3
|
|
4
|
-
def template(from, to)
|
4
|
+
def template(from, to, options={})
|
5
5
|
erb_contents = File.read File.expand_path("../templates/#{from}", __FILE__)
|
6
|
-
|
6
|
+
if options[:sudo]
|
7
|
+
put_sudo ERB.new(erb_contents).result(binding), to
|
8
|
+
else
|
9
|
+
put ERB.new(erb_contents).result(binding), to
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
def set_default(name, *args, &block)
|
@@ -21,6 +25,13 @@ module Capistrano
|
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
28
|
+
# upload to /tmp then to move to correct location as root
|
29
|
+
def put_sudo(data, to)
|
30
|
+
tmp_filename = "/tmp/#{File.basename(to)}_#{Time.now.to_i}"
|
31
|
+
put data, tmp_filename
|
32
|
+
surun "chown root:root #{tmp_filename}; mv #{tmp_filename} #{to}"
|
33
|
+
end
|
34
|
+
|
24
35
|
set_default(:bundle_flags) { "--deployment --quiet --binstubs" }
|
25
36
|
set_default(:bundle_cmd) { "bundle" }
|
26
37
|
set_default(:stage) { "production" }
|
@@ -5,19 +5,19 @@ module Capistrano
|
|
5
5
|
set_default(:nginx_ssl_path, '/etc/ssl/')
|
6
6
|
set_default(:nginx_ssl_key, nil)
|
7
7
|
set_default(:nginx_ssl_certificate, nil)
|
8
|
+
set_default(:nginx_config_path, '/etc/nginx/conf.d/')
|
9
|
+
|
10
|
+
set_default(:nginx_wordpress_enabled, false)
|
11
|
+
set_default(:nginx_wordpress_root, nil)
|
12
|
+
set_default(:nginx_wordpress_url, 'blog')
|
13
|
+
set_default(:nginx_wordpress_w3tc_enabled, false)
|
8
14
|
|
9
15
|
namespace :nginx do
|
10
16
|
desc "update latest nginx configuration"
|
11
17
|
task :update_config, roles: :web do
|
12
|
-
template 'nginx_unicorn.erb', File.join(
|
13
|
-
|
14
|
-
after "deploy:update_code", "nginx:update_config"
|
15
|
-
|
16
|
-
desc "setup nginx for this application, adding it to sites-enabled"
|
17
|
-
task :setup, roles: :web do
|
18
|
-
surun "ln -nfs #{File.join(current_path, '/config/nginx.conf')} /etc/nginx/conf.d/#{application.downcase}_#{stage}.conf"
|
18
|
+
template 'nginx_unicorn.erb', File.join(nginx_config_path, "#{application.downcase}_#{stage}.conf"), :sudo => true
|
19
|
+
surun "nginx -t"
|
19
20
|
end
|
20
|
-
after "deploy:setup", "nginx:setup"
|
21
21
|
|
22
22
|
namespace :server do
|
23
23
|
|
@@ -20,6 +20,77 @@ server {
|
|
20
20
|
add_header Cache-Control public;
|
21
21
|
}
|
22
22
|
|
23
|
+
<% if nginx_wordpress_enabled %>
|
24
|
+
|
25
|
+
location /<%= nginx_wordpress_url %> {
|
26
|
+
root <%= nginx_wordpress_root %>;
|
27
|
+
index index.php;
|
28
|
+
|
29
|
+
<% if nginx_wordpress_w3tc_enabled %>
|
30
|
+
|
31
|
+
# BEGIN W3TC Page Cache cache
|
32
|
+
location ~ /<%= nginx_wordpress_url %>/wp-content/cache/page_enhanced.*html$ {
|
33
|
+
add_header Vary "Accept-Encoding, Cookie";
|
34
|
+
}
|
35
|
+
location ~ /<%= nginx_wordpress_url %>/wp-content/cache/page_enhanced.*gzip$ {
|
36
|
+
gzip off;
|
37
|
+
types {}
|
38
|
+
default_type text/html;
|
39
|
+
add_header Vary "Accept-Encoding, Cookie";
|
40
|
+
add_header Content-Encoding gzip;
|
41
|
+
}
|
42
|
+
# END W3TC Page Cache cache
|
43
|
+
|
44
|
+
# BEGIN W3TC Page Cache core
|
45
|
+
rewrite ^(.*\/)?w3tc_rewrite_test/?$ $1?w3tc_rewrite_test=1 last;
|
46
|
+
set $cache_uri $request_uri;
|
47
|
+
|
48
|
+
# POST requests and urls with a query string should always go to PHP
|
49
|
+
if ($request_method = POST) {
|
50
|
+
set $cache_uri 'null cache';
|
51
|
+
}
|
52
|
+
if ($query_string != "") {
|
53
|
+
set $cache_uri 'null cache';
|
54
|
+
}
|
55
|
+
|
56
|
+
try_files /<%= nginx_wordpress_url %>/wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /<%= nginx_wordpress_url %>/index.php?$args;
|
57
|
+
<% else %>
|
58
|
+
try_files $uri $uri/ /<%= nginx_wordpress_url %>/index.php?$args;
|
59
|
+
<% end %>
|
60
|
+
|
61
|
+
location = /<%= nginx_wordpress_url %>/favicon.ico {
|
62
|
+
log_not_found off;
|
63
|
+
access_log off;
|
64
|
+
}
|
65
|
+
|
66
|
+
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
|
67
|
+
expires max;
|
68
|
+
access_log off;
|
69
|
+
log_not_found off;
|
70
|
+
}
|
71
|
+
|
72
|
+
# Pass all .php files onto a php-fpm/php-fcgi server.
|
73
|
+
location ~ \.php$ {
|
74
|
+
# Zero-day exploit defense.
|
75
|
+
# http://forum.nginx.org/read.php?2,88845,page=3
|
76
|
+
# Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
|
77
|
+
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
|
78
|
+
try_files $uri =404;
|
79
|
+
|
80
|
+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
81
|
+
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
82
|
+
|
83
|
+
include fastcgi_params;
|
84
|
+
fastcgi_index index.php;
|
85
|
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
86
|
+
# fastcgi_intercept_errors on;
|
87
|
+
fastcgi_pass 127.0.0.1:9000;
|
88
|
+
}
|
89
|
+
|
90
|
+
}
|
91
|
+
|
92
|
+
<% end %>
|
93
|
+
|
23
94
|
if (-f $document_root/system/maintenance.html) {
|
24
95
|
rewrite ^(.*)$ /system/maintenance.html last;
|
25
96
|
break;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greenonline_capistrano_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pieter Visser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.0.
|
84
|
+
rubygems_version: 2.0.7
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Capistrano Recipes
|