megalodon 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/README.md +80 -0
- data/bin/megalodon +68 -0
- data/config/rake.rb +60 -0
- data/config/run_list.json +5 -0
- data/config/run_vhosts.json +5 -0
- data/config/solo.rb +20 -0
- data/cookbooks/dnsmasq/recipies/default.rb +28 -0
- data/cookbooks/elasticsearch/recipies/default.rb +23 -0
- data/cookbooks/erlang/README.rdoc +8 -0
- data/cookbooks/erlang/metadata.rb +6 -0
- data/cookbooks/erlang/recipes/default.rb +8 -0
- data/cookbooks/git/README.rdoc +8 -0
- data/cookbooks/git/metadata.rb +6 -0
- data/cookbooks/git/recipes/default.rb +24 -0
- data/cookbooks/git/templates/default/dot.gitconfig.erb +47 -0
- data/cookbooks/homebrew/README.rdoc +73 -0
- data/cookbooks/homebrew/libraries/homebrew_package.rb +85 -0
- data/cookbooks/homebrew/metadata.json +33 -0
- data/cookbooks/homebrew/metadata.rb +9 -0
- data/cookbooks/homebrew/recipes/default.rb +11 -0
- data/cookbooks/jenkins/metadata.rb +9 -0
- data/cookbooks/jenkins/recipes/default.rb +21 -0
- data/cookbooks/maatkit/recipes/default.rb +10 -0
- data/cookbooks/megalodon/attributes/default.rb +3 -0
- data/cookbooks/megalodon/definitions/megalodon_app.rb +21 -0
- data/cookbooks/megalodon/recipes/apache_vhosts.rb +46 -0
- data/cookbooks/megalodon/recipes/default.rb +55 -0
- data/cookbooks/megalodon/recipes/misc.rb +14 -0
- data/cookbooks/megalodon/templates/default/default.conf.erb +26 -0
- data/cookbooks/megalodon/templates/default/default.json.erb +5 -0
- data/cookbooks/megalodon/templates/default/dot.profile.erb +22 -0
- data/cookbooks/megalodon/templates/default/php5.conf.erb +12 -0
- data/cookbooks/megalodon/templates/default/vhost.conf.erb +28 -0
- data/cookbooks/memcached/README.rdoc +8 -0
- data/cookbooks/memcached/metadata.rb +2 -0
- data/cookbooks/memcached/recipes/default.rb +9 -0
- data/cookbooks/mongodb/recipes/default.rb +23 -0
- data/cookbooks/mvim/README.rdoc +8 -0
- data/cookbooks/mvim/metadata.rb +6 -0
- data/cookbooks/mvim/recipes/default.rb +47 -0
- data/cookbooks/mvim/templates/default/dot.vimrc.erb +23 -0
- data/cookbooks/mysql/README.rdoc +143 -0
- data/cookbooks/mysql/attributes/server.rb +58 -0
- data/cookbooks/mysql/metadata.rb +78 -0
- data/cookbooks/mysql/recipes/default.rb +24 -0
- data/cookbooks/mysql/recipes/mariadb.rb +41 -0
- data/cookbooks/mysql/templates/default/my.cnf.erb +161 -0
- data/cookbooks/nginx/recipes/default.rb +66 -0
- data/cookbooks/nginx/templates/default/app_nginx.conf.erb +42 -0
- data/cookbooks/nginx/templates/default/default.conf.erb +40 -0
- data/cookbooks/nginx/templates/default/fastcgi_params.erb +23 -0
- data/cookbooks/nginx/templates/default/nginx.conf.erb +33 -0
- data/cookbooks/node/README.rdoc +8 -0
- data/cookbooks/node/metadata.rb +6 -0
- data/cookbooks/node/recipes/default.rb +12 -0
- data/cookbooks/php/attributes/default.rb +3 -0
- data/cookbooks/php/metadata.rb +2 -0
- data/cookbooks/php/providers/pear.rb +229 -0
- data/cookbooks/php/providers/pear_channel.rb +91 -0
- data/cookbooks/php/recipes/default.rb +25 -0
- data/cookbooks/php/recipes/fpm.rb +45 -0
- data/cookbooks/php/recipes/module_apc.rb +12 -0
- data/cookbooks/php/recipes/module_memcached.rb +12 -0
- data/cookbooks/php/recipes/module_mongo.rb +11 -0
- data/cookbooks/php/recipes/module_xdebug.rb +11 -0
- data/cookbooks/php/resources/pear.rb +28 -0
- data/cookbooks/php/resources/pear_channel.rb +28 -0
- data/cookbooks/php/templates/default/mods/apc.ini.erb +4 -0
- data/cookbooks/php/templates/default/mods/memcached.ini.erb +1 -0
- data/cookbooks/php/templates/default/mods/mongo.ini.erb +1 -0
- data/cookbooks/php/templates/default/mods/xdebug.ini.erb +39 -0
- data/cookbooks/php/templates/default/net.php.php-fpm.plist.erb +23 -0
- data/cookbooks/php/templates/default/php-fpm.conf.erb +323 -0
- data/cookbooks/php/templates/default/php.ini.erb +1854 -0
- data/cookbooks/php.tgz +0 -0
- data/cookbooks/phpunit/metadata.rb +8 -0
- data/cookbooks/phpunit/recipes/default.rb +38 -0
- data/cookbooks/python/README.rdoc +8 -0
- data/cookbooks/python/metadata.rb +6 -0
- data/cookbooks/python/recipes/default.rb +6 -0
- data/cookbooks/redis/recipes/default.rb +23 -0
- data/cookbooks/siege/recipes/default.rb +4 -0
- data/cookbooks/solr/metadata.json +36 -0
- data/cookbooks/solr/metadata.rb +9 -0
- data/cookbooks/solr/recipes/default.rb +18 -0
- data/cookbooks/varnish/attributes/default.rb +2 -0
- data/cookbooks/varnish/recipes/default.rb +24 -0
- data/cookbooks/varnish/templates/default/default.vcl.erb +268 -0
- data/cookbooks/varnish/templates/default/ubuntu-default.erb +103 -0
- data/cookbooks/xhprof/metadata.json +36 -0
- data/cookbooks/xhprof/metadata.rb +12 -0
- data/cookbooks/xhprof/recipes/default.rb +43 -0
- data/cookbooks/xhprof/templates/default/xhprof.ini.erb +2 -0
- data/formulas/apc.rb +63 -0
- data/formulas/cclient.rb +57 -0
- data/formulas/megalodon.rb +27 -0
- data/formulas/memcached-php.rb +24 -0
- data/formulas/mongo-php.rb +25 -0
- data/formulas/mongodb-php.rb +31 -0
- data/formulas/php-memcached.rb +31 -0
- data/formulas/php.rb +261 -0
- data/formulas/xdebug.rb +36 -0
- data/formulas/xhprof.rb +33 -0
- data/lib/megalodon/version.rb +3 -0
- data/megalodon.gemspec +14 -0
- data/roles/nginx_web_server.json +23 -0
- data/roles/web_server.json +19 -0
- metadata +170 -0
data/cookbooks/php.tgz
ADDED
Binary file
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Author:: Mark Sonnabaum <mark.sonnabaum@acquia.com>
|
2
|
+
# Cookbook Name:: phpunit
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
include_recipe "php"
|
18
|
+
|
19
|
+
channels = %w{pear.phpunit.de components.ez.no pear.symfony.com pear.symfony-project.com}
|
20
|
+
channels.each do |chan|
|
21
|
+
php_pear_channel chan do
|
22
|
+
action [:discover, :update]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
php_pear "PEAR" do
|
27
|
+
cur_version = `pear -V| head -1| awk -F': ' '{print $2}'`
|
28
|
+
action :upgrade
|
29
|
+
# This feels super ghetto. Open to improvements.
|
30
|
+
not_if { Gem::Version.new(cur_version) > Gem::Version.new('1.9.0') }
|
31
|
+
end
|
32
|
+
|
33
|
+
php_pear "PHPUnit" do
|
34
|
+
channel "phpunit"
|
35
|
+
version "3.7.15"
|
36
|
+
action :install
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Cookbook Name:: redis
|
2
|
+
# Recipe:: default
|
3
|
+
|
4
|
+
package "redis"
|
5
|
+
|
6
|
+
plist="homebrew.mxcl.redis.plist"
|
7
|
+
|
8
|
+
bash "copy plist firsttime" do
|
9
|
+
code <<-EOS
|
10
|
+
(cp /usr/local/Cellar/redis/*/#{plist} ~/Library/LaunchAgents/)
|
11
|
+
(launchctl load -w ~/Library/LaunchAgents/#{plist})
|
12
|
+
EOS
|
13
|
+
not_if File.exists?("~/Library/LaunchAgents/#{plist}")
|
14
|
+
end
|
15
|
+
|
16
|
+
bash "copy new plist" do
|
17
|
+
code <<-EOS
|
18
|
+
launchctl unload -w ~/Library/LaunchAgents/#{plist}
|
19
|
+
cp /usr/local/Cellar/redis/*/#{plist} ~/Library/LaunchAgents/
|
20
|
+
launchctl load -w ~/Library/LaunchAgents/#{plist}
|
21
|
+
EOS
|
22
|
+
only_if File.exists?("~/Library/LaunchAgents/#{plist}")
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"recipes": {
|
3
|
+
"xhprof": "Installs xhprof php extension"
|
4
|
+
},
|
5
|
+
"attributes": {
|
6
|
+
},
|
7
|
+
"providing": {
|
8
|
+
},
|
9
|
+
"dependencies": {
|
10
|
+
"php": [
|
11
|
+
|
12
|
+
]
|
13
|
+
},
|
14
|
+
"maintainer": "Mark Sonnabaum",
|
15
|
+
"replacing": {
|
16
|
+
},
|
17
|
+
"maintainer_email": "mark.sonnabaum@acquia.com",
|
18
|
+
"groupings": {
|
19
|
+
},
|
20
|
+
"platforms": {
|
21
|
+
"ubuntu": [
|
22
|
+
|
23
|
+
]
|
24
|
+
},
|
25
|
+
"license": "Apache 2.0",
|
26
|
+
"version": "0.9.0",
|
27
|
+
"recommendations": {
|
28
|
+
},
|
29
|
+
"suggestions": {
|
30
|
+
},
|
31
|
+
"name": "xhprof",
|
32
|
+
"long_description": "",
|
33
|
+
"description": "Installs xhprof php extension from Brian Mercer's launchpad PPA",
|
34
|
+
"conflicting": {
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: xhprof
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
package "solr"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Cookbook Name:: varnish
|
2
|
+
# Recipe:: default
|
3
|
+
|
4
|
+
package "varnish"
|
5
|
+
|
6
|
+
brew_prefix = `brew --prefix`.strip
|
7
|
+
directory "#{brew_prefix}/etc/varnish" do
|
8
|
+
action :create
|
9
|
+
end
|
10
|
+
|
11
|
+
template "/usr/local/etc/varnish/default.vcl" do
|
12
|
+
source "default.vcl.erb"
|
13
|
+
#owner "root"
|
14
|
+
#group "root"
|
15
|
+
mode 0644
|
16
|
+
end
|
17
|
+
|
18
|
+
#template "#{node[:varnish][:default]}" do
|
19
|
+
# source "ubuntu-default.erb"
|
20
|
+
# owner "root"
|
21
|
+
# group "root"
|
22
|
+
# mode 0644
|
23
|
+
#end
|
24
|
+
#
|
@@ -0,0 +1,268 @@
|
|
1
|
+
# This is a basic VCL configuration file for varnish. See the vcl(7)
|
2
|
+
# man page for details on VCL syntax and semantics.
|
3
|
+
#
|
4
|
+
# Default backend definition. Set this to point to your content
|
5
|
+
# server.
|
6
|
+
#
|
7
|
+
#
|
8
|
+
|
9
|
+
<% unless node[:varnish][:backend_hosts].empty? %>
|
10
|
+
<% node[:varnish][:backend_hosts].each do |host| %>
|
11
|
+
backend <%= host %> {
|
12
|
+
.host = "<%= host %>";
|
13
|
+
.port = "8080";
|
14
|
+
.connect_timeout = 600s;
|
15
|
+
.first_byte_timeout = 600s;
|
16
|
+
.between_bytes_timeout = 600s;
|
17
|
+
.probe = {
|
18
|
+
#.url = "/";
|
19
|
+
.url = "/sites/default/alive.txt";
|
20
|
+
.interval = 5s;
|
21
|
+
.timeout = 30 s;
|
22
|
+
.window = 5;
|
23
|
+
.threshold = 3;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
director drupal_pool round-robin {
|
29
|
+
<% node[:varnish][:backend_hosts].each do |host| %>
|
30
|
+
{
|
31
|
+
.backend = <%= host %>;
|
32
|
+
}
|
33
|
+
<% end %>
|
34
|
+
}
|
35
|
+
<% else %>
|
36
|
+
backend default {
|
37
|
+
.host = "<%= node[:varnish][:backend_default][:host] %>";
|
38
|
+
.port = "<%= node[:varnish][:backend_default][:port] %>";
|
39
|
+
}
|
40
|
+
<% end %>
|
41
|
+
|
42
|
+
|
43
|
+
sub vcl_recv {
|
44
|
+
# Add the X-Forwarded-For header (Varnish <2.1 used
|
45
|
+
# to do this automatically but not anymore)
|
46
|
+
if (req.http.X-Forwarded-For) {
|
47
|
+
set req.http.X-Forwarded-For =
|
48
|
+
req.http.X-Forwarded-For ", " client.ip;
|
49
|
+
} else {
|
50
|
+
set req.http.X-Forwarded-For = client.ip;
|
51
|
+
}
|
52
|
+
|
53
|
+
# Grace: Avoid thundering herd when an object expires by serving
|
54
|
+
# expired stale object during the next N seconds while one request
|
55
|
+
# is made to the backend for that object.
|
56
|
+
set req.grace = 120s;
|
57
|
+
|
58
|
+
|
59
|
+
# Varnish doesn't support Range requests: needs to be piped
|
60
|
+
if (req.http.Range) {
|
61
|
+
return(pipe);
|
62
|
+
}
|
63
|
+
|
64
|
+
# Don't check cache for POSTs and various other HTTP request types
|
65
|
+
if (req.request != "GET" && req.request != "HEAD") {
|
66
|
+
return(pass);
|
67
|
+
}
|
68
|
+
|
69
|
+
# Normalize Accept-Encoding to reduce cache variations per url
|
70
|
+
if (req.http.Accept-Encoding) {
|
71
|
+
# No point in compressing these
|
72
|
+
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
|
73
|
+
remove req.http.Accept-Encoding;
|
74
|
+
# MSIE 6 bug workaround
|
75
|
+
} elsif(req.http.User-Agent ~ "MSIE 6") {
|
76
|
+
unset req.http.Accept-Encoding;
|
77
|
+
} elsif (req.http.Accept-Encoding ~ "gzip") {
|
78
|
+
set req.http.Accept-Encoding = "gzip";
|
79
|
+
} elsif (req.http.Accept-Encoding ~ "deflate") {
|
80
|
+
set req.http.Accept-Encoding = "deflate";
|
81
|
+
} else {
|
82
|
+
# unkown algorithm
|
83
|
+
remove req.http.Accept-Encoding;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
# Cookie Cache Bypass Drupal module (Pressflow): Don't check cache for
|
89
|
+
# any user that just submitted a content form within the past 5 to 10
|
90
|
+
# minutes (depending on Drupal's cache_lifetime setting).
|
91
|
+
if(req.http.cookie ~ "NO_CACHE") {
|
92
|
+
return(pass);
|
93
|
+
}
|
94
|
+
|
95
|
+
# Don't check cache if the Drupal session cookie is set.
|
96
|
+
# Pressflow pages don't send this cookie to anon users.
|
97
|
+
if(req.http.cookie ~ "SESS") {
|
98
|
+
# ...except for /files we try cache regardless of the SESS cookie
|
99
|
+
if ((req.url !~ "^/files/") && (req.url !~ "^/sites/[^/]+/files/")
|
100
|
+
&& (req.url !~ "\.(jpg|png|gif|jpeg|js|css|swf)$")) {
|
101
|
+
return(pass);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
# Enforce no-cookie-vary: Hide the Cookie header prior
|
106
|
+
# to vcl_hash, then restore Cookie if we get to vcl_miss.
|
107
|
+
if (req.http.Cookie) {
|
108
|
+
set req.http.X-Acquia-Cookie = req.http.Cookie;
|
109
|
+
unset req.http.Cookie;
|
110
|
+
}
|
111
|
+
|
112
|
+
## Remove a ";" prefix, if present.
|
113
|
+
set req.http.Cookie = regsub(req.http.Cookie, "^;\s*", "");
|
114
|
+
## Remove empty cookies.
|
115
|
+
if (req.http.Cookie ~ "^\s*$") {
|
116
|
+
unset req.http.Cookie;
|
117
|
+
}
|
118
|
+
# Default cache check
|
119
|
+
return(lookup);
|
120
|
+
}
|
121
|
+
|
122
|
+
#
|
123
|
+
# Below is a commented-out copy of the default VCL logic. If you
|
124
|
+
# redefine any of these subroutines, the built-in logic will be
|
125
|
+
# appended to your code.
|
126
|
+
#
|
127
|
+
# sub vcl_recv {
|
128
|
+
# if (req.http.x-forwarded-for) {
|
129
|
+
# set req.http.X-Forwarded-For =
|
130
|
+
# req.http.X-Forwarded-For ", " client.ip;
|
131
|
+
# } else {
|
132
|
+
# set req.http.X-Forwarded-For = client.ip;
|
133
|
+
# }
|
134
|
+
# if (req.request != "GET" &&
|
135
|
+
# req.request != "HEAD" &&
|
136
|
+
# req.request != "PUT" &&
|
137
|
+
# req.request != "POST" &&
|
138
|
+
# req.request != "TRACE" &&
|
139
|
+
# req.request != "OPTIONS" &&
|
140
|
+
# req.request != "DELETE") {
|
141
|
+
# /* Non-RFC2616 or CONNECT which is weird. */
|
142
|
+
# return (pipe);
|
143
|
+
# }
|
144
|
+
# if (req.request != "GET" && req.request != "HEAD") {
|
145
|
+
# /* We only deal with GET and HEAD by default */
|
146
|
+
# return (pass);
|
147
|
+
# }
|
148
|
+
# if (req.http.Authorization || req.http.Cookie) {
|
149
|
+
# /* Not cacheable by default */
|
150
|
+
# return (pass);
|
151
|
+
# }
|
152
|
+
# return (lookup);
|
153
|
+
# }
|
154
|
+
#
|
155
|
+
# sub vcl_pipe {
|
156
|
+
# # Note that only the first request to the backend will have
|
157
|
+
# # X-Forwarded-For set. If you use X-Forwarded-For and want to
|
158
|
+
# # have it set for all requests, make sure to have:
|
159
|
+
# # set req.http.connection = "close";
|
160
|
+
# # here. It is not set by default as it might break some broken web
|
161
|
+
# # applications, like IIS with NTLM authentication.
|
162
|
+
# return (pipe);
|
163
|
+
# }
|
164
|
+
#
|
165
|
+
# sub vcl_pass {
|
166
|
+
# return (pass);
|
167
|
+
# }
|
168
|
+
#
|
169
|
+
# sub vcl_hash {
|
170
|
+
# set req.hash += req.url;
|
171
|
+
# if (req.http.host) {
|
172
|
+
# set req.hash += req.http.host;
|
173
|
+
# } else {
|
174
|
+
# set req.hash += server.ip;
|
175
|
+
# }
|
176
|
+
# return (hash);
|
177
|
+
# }
|
178
|
+
#
|
179
|
+
# sub vcl_hit {
|
180
|
+
# if (!obj.cacheable) {
|
181
|
+
# return (pass);
|
182
|
+
# }
|
183
|
+
# return (deliver);
|
184
|
+
# }
|
185
|
+
#
|
186
|
+
sub vcl_miss {
|
187
|
+
# Restore the original incoming Cookie
|
188
|
+
if (req.http.X-Acquia-Cookie) {
|
189
|
+
set bereq.http.Cookie = req.http.X-Acquia-Cookie;
|
190
|
+
unset bereq.http.X-Acquia-Cookie;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
# Backend response: Determine whether to cache each backend response
|
195
|
+
sub vcl_fetch {
|
196
|
+
|
197
|
+
# Don't cache errors, redirects, HEAD, and POST responses.
|
198
|
+
if (beresp.status >= 300 || !beresp.cacheable || req.request != "GET") {
|
199
|
+
return(pass);
|
200
|
+
}
|
201
|
+
|
202
|
+
# Respect explicit no-cache headers
|
203
|
+
if(beresp.http.Pragma ~ "no-cache" ||
|
204
|
+
beresp.http.Cache-Control ~ "no-cache") {
|
205
|
+
## Commenting this out for now because for some reason, imagecache images of the
|
206
|
+
## currently logged in user were set to Cache-Control:max-age=1209600, private, must-revalidate,
|
207
|
+
## which was causing them to be broken upon re-login.
|
208
|
+
#beresp.http.Cache-Control ~ "no-cache" ||
|
209
|
+
# beresp.http.Cache-Control ~ "private") {
|
210
|
+
return(pass);
|
211
|
+
}
|
212
|
+
|
213
|
+
# NOTE: xmlrpc.php requests are not cached because they're POSTs
|
214
|
+
|
215
|
+
# Don't cache if Drupal session cookie is set
|
216
|
+
# Note: Pressflow doesn't send SESS cookies to anon users
|
217
|
+
if(beresp.http.Set-Cookie ~ "SESS") {
|
218
|
+
return(pass);
|
219
|
+
}
|
220
|
+
|
221
|
+
# Grace: Avoid thundering herd when an object expires by serving
|
222
|
+
# expired stale object during the next N seconds while one request
|
223
|
+
# is made to the backend for that object.
|
224
|
+
set beresp.grace = 120s;
|
225
|
+
|
226
|
+
# Cache anything else. Returning nothing here would fall-through
|
227
|
+
# to Varnish's default cache store policies.
|
228
|
+
return(deliver);
|
229
|
+
}
|
230
|
+
|
231
|
+
sub vcl_deliver {
|
232
|
+
# Add an X-Cache diagnostic header
|
233
|
+
if (obj.hits > 0) {
|
234
|
+
set resp.http.X-Cache = "HIT";
|
235
|
+
set resp.http.X-Cache-Hits = obj.hits;
|
236
|
+
# Don't echo cached Set-Cookie headers
|
237
|
+
unset resp.http.Set-Cookie;
|
238
|
+
} else {
|
239
|
+
set resp.http.X-Cache = "MISS";
|
240
|
+
}
|
241
|
+
return(deliver);
|
242
|
+
}
|
243
|
+
|
244
|
+
# sub vcl_error {
|
245
|
+
# set obj.http.Content-Type = "text/html; charset=utf-8";
|
246
|
+
# synthetic {"
|
247
|
+
# <?xml version="1.0" encoding="utf-8"?>
|
248
|
+
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
249
|
+
# "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
250
|
+
# <html>
|
251
|
+
# <head>
|
252
|
+
# <title>"} obj.status " " obj.response {"</title>
|
253
|
+
# </head>
|
254
|
+
# <body>
|
255
|
+
# <h1>Error "} obj.status " " obj.response {"</h1>
|
256
|
+
# <p>"} obj.response {"</p>
|
257
|
+
# <h3>Guru Meditation:</h3>
|
258
|
+
# <p>XID: "} req.xid {"</p>
|
259
|
+
# <hr>
|
260
|
+
# <address>
|
261
|
+
# <a href="http://www.varnish-cache.org/">Varnish cache server</a>
|
262
|
+
# </address>
|
263
|
+
# </body>
|
264
|
+
# </html>
|
265
|
+
# "};
|
266
|
+
# return (deliver);
|
267
|
+
# }
|
268
|
+
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# Configuration file for varnish
|
2
|
+
#
|
3
|
+
# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this
|
4
|
+
# shell script fragment.
|
5
|
+
#
|
6
|
+
|
7
|
+
# Maximum number of open files (for ulimit -n)
|
8
|
+
NFILES=131072
|
9
|
+
|
10
|
+
# Maximum locked memory size (for ulimit -l)
|
11
|
+
# Used for locking the shared memory log in memory. If you increase log size,
|
12
|
+
# you need to increase this number as well
|
13
|
+
MEMLOCK=82000
|
14
|
+
|
15
|
+
# Default varnish instance name is the local nodename. Can be overridden with
|
16
|
+
# the -n switch, to have more instances on a single server.
|
17
|
+
INSTANCE=$(uname -n)
|
18
|
+
|
19
|
+
# This file contains 4 alternatives, please use only one.
|
20
|
+
|
21
|
+
## Alternative 1, Minimal configuration, no VCL
|
22
|
+
#
|
23
|
+
# Listen on port 6081, administration on localhost:6082, and forward to
|
24
|
+
# content server on localhost:8080. Use a fixed-size cache file.
|
25
|
+
#
|
26
|
+
#DAEMON_OPTS="-a :6081 \
|
27
|
+
# -T localhost:6082 \
|
28
|
+
# -b localhost:8080 \
|
29
|
+
# -u varnish -g varnish \
|
30
|
+
# -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G"
|
31
|
+
|
32
|
+
|
33
|
+
## Alternative 2, Configuration with VCL
|
34
|
+
#
|
35
|
+
# Listen on port 6081, administration on localhost:6082, and forward to
|
36
|
+
# one content server selected by the vcl file, based on the request. Use a
|
37
|
+
# fixed-size cache file.
|
38
|
+
#
|
39
|
+
DAEMON_OPTS="-a :6081 \
|
40
|
+
-T localhost:6082 \
|
41
|
+
-f /etc/varnish/default.vcl \
|
42
|
+
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G
|
43
|
+
-p thread_pools=4 \
|
44
|
+
-p thread_pool_max=1500 \
|
45
|
+
-p listen_depth=2048 \
|
46
|
+
-p lru_interval=1800 \
|
47
|
+
-p connect_timeout=600 \
|
48
|
+
-p max_restarts=6 \
|
49
|
+
-h classic,169313 "
|
50
|
+
|
51
|
+
## Alternative 3, Advanced configuration
|
52
|
+
#
|
53
|
+
# See varnishd(1) for more information.
|
54
|
+
#
|
55
|
+
# # Main configuration file. You probably want to change it :)
|
56
|
+
# VARNISH_VCL_CONF=/etc/varnish/default.vcl
|
57
|
+
#
|
58
|
+
# # Default address and port to bind to
|
59
|
+
# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify
|
60
|
+
# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets.
|
61
|
+
# VARNISH_LISTEN_ADDRESS=
|
62
|
+
# VARNISH_LISTEN_PORT=6081
|
63
|
+
#
|
64
|
+
# # Telnet admin interface listen address and port
|
65
|
+
# VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
|
66
|
+
# VARNISH_ADMIN_LISTEN_PORT=6082
|
67
|
+
#
|
68
|
+
# # The minimum number of worker threads to start
|
69
|
+
# VARNISH_MIN_THREADS=1
|
70
|
+
#
|
71
|
+
# # The Maximum number of worker threads to start
|
72
|
+
# VARNISH_MAX_THREADS=1000
|
73
|
+
#
|
74
|
+
# # Idle timeout for worker threads
|
75
|
+
# VARNISH_THREAD_TIMEOUT=120
|
76
|
+
#
|
77
|
+
# # Cache file location
|
78
|
+
# VARNISH_STORAGE_FILE=/var/lib/varnish/$INSTANCE/varnish_storage.bin
|
79
|
+
#
|
80
|
+
# # Cache file size: in bytes, optionally using k / M / G / T suffix,
|
81
|
+
# # or in percentage of available disk space using the % suffix.
|
82
|
+
# VARNISH_STORAGE_SIZE=1G
|
83
|
+
#
|
84
|
+
# # Backend storage specification
|
85
|
+
# VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
|
86
|
+
#
|
87
|
+
# # Default TTL used when the backend does not specify one
|
88
|
+
# VARNISH_TTL=120
|
89
|
+
#
|
90
|
+
# # DAEMON_OPTS is used by the init script. If you add or remove options, make
|
91
|
+
# # sure you update this section, too.
|
92
|
+
# DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \
|
93
|
+
# -f ${VARNISH_VCL_CONF} \
|
94
|
+
# -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \
|
95
|
+
# -t ${VARNISH_TTL} \
|
96
|
+
# -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \
|
97
|
+
# -s ${VARNISH_STORAGE}"
|
98
|
+
#
|
99
|
+
|
100
|
+
|
101
|
+
## Alternative 4, Do It Yourself
|
102
|
+
#
|
103
|
+
# DAEMON_OPTS=""
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"recipes": {
|
3
|
+
"xhprof": "Installs xhprof php extension"
|
4
|
+
},
|
5
|
+
"attributes": {
|
6
|
+
},
|
7
|
+
"providing": {
|
8
|
+
},
|
9
|
+
"dependencies": {
|
10
|
+
"php": [
|
11
|
+
|
12
|
+
]
|
13
|
+
},
|
14
|
+
"maintainer": "Mark Sonnabaum",
|
15
|
+
"replacing": {
|
16
|
+
},
|
17
|
+
"maintainer_email": "mark.sonnabaum@acquia.com",
|
18
|
+
"groupings": {
|
19
|
+
},
|
20
|
+
"platforms": {
|
21
|
+
"ubuntu": [
|
22
|
+
|
23
|
+
]
|
24
|
+
},
|
25
|
+
"license": "Apache 2.0",
|
26
|
+
"version": "0.9.0",
|
27
|
+
"recommendations": {
|
28
|
+
},
|
29
|
+
"suggestions": {
|
30
|
+
},
|
31
|
+
"name": "xhprof",
|
32
|
+
"long_description": "",
|
33
|
+
"description": "Installs xhprof php extension from Brian Mercer's launchpad PPA",
|
34
|
+
"conflicting": {
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
maintainer "Mark Sonnabaum"
|
2
|
+
maintainer_email "mark.sonnabaum@acquia.com"
|
3
|
+
license "Apache 2.0"
|
4
|
+
description "Installs xhprof php extension from Brian Mercer's launchpad PPA"
|
5
|
+
version "0.9"
|
6
|
+
depends "php"
|
7
|
+
|
8
|
+
recipe "xhprof", "Installs xhprof php extension"
|
9
|
+
|
10
|
+
%w{ ubuntu mac_os_x }.each do |os|
|
11
|
+
supports os
|
12
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: xhprof
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
include_recipe "php"
|
19
|
+
case node[:platform]
|
20
|
+
when "debian","ubuntu"
|
21
|
+
execute "apt-get update" do
|
22
|
+
action :nothing
|
23
|
+
end
|
24
|
+
|
25
|
+
%w{python-software-properties pkg-config}.each do |pkg|
|
26
|
+
package pkg
|
27
|
+
end
|
28
|
+
|
29
|
+
execute "add-apt-repository ppa:brianmercer/php5-xhprof" do
|
30
|
+
not_if { File.exists?("/etc/apt/sources.list.d/xhprof.list") }
|
31
|
+
notifies :run, resources("execute[apt-get update]"), :immediately
|
32
|
+
end
|
33
|
+
|
34
|
+
package "php5-xhprof"
|
35
|
+
|
36
|
+
when "mac_os_x"
|
37
|
+
package "xhprof"
|
38
|
+
|
39
|
+
template "/usr/local/etc/php5/conf.d/xhprof.ini" do
|
40
|
+
source "xhprof.ini.erb"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|