-
-
Save ticean/735754 to your computer and use it in GitHub Desktop.
chef magento roles examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if @params[:ssl] %> | |
<VirtualHost <%= node[:ipaddress] %>:443> | |
ServerName <% if node[:magento][:server][:secure_domain] %><%= node[:magento][:server][:secure_domain] %><% else %><%= @params[:server_name] %><% end %> | |
SSLEngine on | |
SSLCertificateKeyFile ssl/<%= @params[:server_name] %>.pem | |
SSLCertificateFile ssl/<%= @params[:server_name] %>.pem | |
SSLProtocol all | |
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL | |
<% else %> | |
<VirtualHost *:8080> | |
ServerName <%= @params[:server_name] %> | |
ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %> | |
<% end %> | |
DocumentRoot <%= @params[:docroot] %> | |
<Directory <%= @params[:docroot] %>> | |
AllowOverride All | |
<% if @params[:ssl] %>SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128<% end %> | |
</Directory> | |
<Directory /> | |
Options FollowSymLinks | |
AllowOverride None | |
</Directory> | |
LogLevel info | |
ErrorLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log | |
CustomLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined | |
RewriteEngine On | |
RewriteLog <%= node[:apache][:log_dir] %>/<%= @application_name %>-rewrite.log | |
RewriteLogLevel 0 | |
<IfModule mod_deflate.c> | |
############################################ | |
## enable apache served files compression | |
## http://developer.yahoo.com/performance/rules.html#gzip | |
# Insert filter on all content | |
###SetOutputFilter DEFLATE | |
# Insert filter on selected content types only | |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript | |
# Netscape 4.x has some problems... | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
# Netscape 4.06-4.08 have some more problems | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
# MSIE masquerades as Netscape, but it is fine | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
# Don't compress images | |
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary | |
# Make sure proxies don't deliver the wrong content | |
Header append Vary User-Agent env=!dont-vary | |
</IfModule> | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!-- | |
/** | |
* Generated by Chef, FOR NODES RUNNING APC CACHE BACKEND ONLY!!! | |
*/ | |
--> | |
<config> | |
<global> | |
<install> | |
<date><![CDATA[Thu, 01 Jul 2010 10:29:20 +0000]]></date> | |
</install> | |
<crypt> | |
<key><![CDATA[82ba7f3f9db9aec288ffbce1e0ad08e2]]></key> | |
</crypt> | |
<disable_local_modules>false</disable_local_modules> | |
<resources> | |
<db> | |
<table_prefix><![CDATA[]]></table_prefix> | |
</db> | |
<default_setup> | |
<connection> | |
<host><![CDATA[<%= @database[:host] %>]]></host> | |
<username><![CDATA[<%= @database[:username] %>]]></username> | |
<password><![CDATA[<%= @database[:password] %>]]></password> | |
<dbname><![CDATA[<%= @database[:database] %>]]></dbname> | |
<active>1</active> | |
</connection> | |
</default_setup> | |
</resources> | |
<session_save><![CDATA[files]]></session_save> | |
<% if node[:fqdn] == "nginx-example.com" %> | |
<cache> | |
<backend>apc</backend> | |
<prefix>MAGE_</prefix> | |
</cache> | |
<% end %> | |
</global> | |
<admin> | |
<routers> | |
<adminhtml> | |
<args> | |
<frontName><![CDATA[admin]]></frontName> | |
</args> | |
</adminhtml> | |
</routers> | |
</admin> | |
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name "magento_apache" | |
description "Bootstraping magento box with apache, mysql and varnish on 512MB flavor" | |
run_list("recipe[chef::bootstrap_client]", "recipe[php::php5]", "recipe[php::module_eaccelerator]","recipe[magento::sample_data]", "recipe[magento::apache2]", "recipe[varnish]") | |
default_attributes "magento" => { | |
"server" => { | |
"aliases" => %w{ www.apache-example.com }, | |
"static_domains" => %w{ static.apache-example.com media.apache-example.com }, | |
"secure_domain" => "www.apache-example.com" | |
} | |
}, | |
"apache" => { | |
"listen_ports" => [ "8080", "443" ], | |
"timeout" => 45, | |
"keepalivetimeout" => 2, | |
"prefork" => { | |
"startservers" => 1, | |
"minspareservers" => 1, | |
"maxspareservers" => 3, | |
"serverlimit" => 6, | |
"maxclients" => 6, | |
"maxrequestsperchild" => 1000 | |
} | |
}, | |
"mysql" => { | |
"max_connections" => 10 | |
} | |
override_attributes "fqdn" => "apache-example.com", | |
"apache" => { "listen_ports" => [ "8080", "443" ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name "magento_nginx" | |
description "Bootstraping magento demo box with nginx, php5-fpm and mysql" | |
run_list("recipe[chef::bootstrap_client]", "recipe[magento::sample_data]", "recipe[magento::nginx]", "recipe[php::module_apc]", "recipe[php::php5-fpm]") | |
default_attributes "magento" => { | |
"server" => { | |
"aliases" => %w{ www.nginx-example.com }, | |
"static_domains" => %w{ static.nginx-example.com media.nginx-example.com }, | |
"secure_domain" => "www.nginx-example.com" | |
} | |
} | |
override_attributes "fqdn" => "nginx-example.com" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backend default { | |
.host = "localhost"; | |
.port = "8080"; | |
} | |
sub vcl_recv { | |
if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") { | |
lookup; | |
} | |
} | |
sub vcl_fetch { | |
# strip the cookie before the image is inserted into cache. | |
if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") { | |
unset obj.http.set-cookie; | |
} | |
# force minimum ttl of 120 seconds | |
if (obj.ttl < 120s) { | |
set obj.ttl = 120s; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration file for varnish | |
# | |
# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this | |
# shell script fragment. | |
# | |
# Maximum number of open files (for ulimit -n) | |
NFILES=131072 | |
# Default varnish instance name is the local nodename. Can be overridden with | |
# the -n switch, to have more instances on a single server. | |
INSTANCE=$(uname -n) | |
# This file contains 4 alternatives, please use only one. | |
## Alternative 1, Minimal configuration, no VCL | |
# | |
# Listen on port 6081, administration on localhost:6082, and forward to | |
# content server on localhost:8080. Use a fixed-size cache file. | |
# | |
DAEMON_OPTS="-a :80 \ | |
-T localhost:6082 \ | |
-b localhost:8080 \ | |
-u varnish -g varnish \ | |
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G" | |
## Alternative 2, Configuration with VCL | |
# | |
# Listen on port 6081, administration on localhost:6082, and forward to | |
# one content server selected by the vcl file, based on the request. Use a | |
# fixed-size cache file. | |
# | |
# DAEMON_OPTS="-a :6081 \ | |
# -T localhost:6082 \ | |
# -f /etc/varnish/default.vcl \ | |
# -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G" | |
## Alternative 3, Advanced configuration | |
# | |
# See varnishd(1) for more information. | |
# | |
# # Main configuration file. You probably want to change it :) | |
# VARNISH_VCL_CONF=/etc/varnish/default.vcl | |
# | |
# # Default address and port to bind to | |
# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify | |
# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets. | |
# VARNISH_LISTEN_ADDRESS= | |
# VARNISH_LISTEN_PORT=6081 | |
# | |
# # Telnet admin interface listen address and port | |
# VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 | |
# VARNISH_ADMIN_LISTEN_PORT=6082 | |
# | |
# # The minimum number of worker threads to start | |
# VARNISH_MIN_THREADS=1 | |
# | |
# # The Maximum number of worker threads to start | |
# VARNISH_MAX_THREADS=1000 | |
# | |
# # Idle timeout for worker threads | |
# VARNISH_THREAD_TIMEOUT=120 | |
# | |
# # Cache file location | |
# VARNISH_STORAGE_FILE=/var/lib/varnish/$INSTANCE/varnish_storage.bin | |
# | |
# # Cache file size: in bytes, optionally using k / M / G / T suffix, | |
# # or in percentage of available disk space using the % suffix. | |
# VARNISH_STORAGE_SIZE=1G | |
# | |
# # Backend storage specification | |
# VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}" | |
# | |
# # Default TTL used when the backend does not specify one | |
# VARNISH_TTL=120 | |
# | |
# # DAEMON_OPTS is used by the init script. If you add or remove options, make | |
# # sure you update this section, too. | |
# DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ | |
# -f ${VARNISH_VCL_CONF} \ | |
# -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ | |
# -t ${VARNISH_TTL} \ | |
# -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \ | |
# -s ${VARNISH_STORAGE}" | |
# | |
## Alternative 4, Do It Yourself | |
# | |
# DAEMON_OPTS="" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment