fast_food 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +73 -0
- data/Rakefile +8 -0
- data/chef/.chef/bootstrap/chef-solo.erb +27 -0
- data/chef/.chef/knife.rb +8 -0
- data/chef/.gitignore +1 -0
- data/chef/README +3 -0
- data/chef/cookbooks/README +1 -0
- data/chef/cookbooks/apache2/.gitignore +1 -0
- data/chef/cookbooks/apache2/CHANGELOG.md +81 -0
- data/chef/cookbooks/apache2/CONTRIBUTING +29 -0
- data/chef/cookbooks/apache2/Gemfile +10 -0
- data/chef/cookbooks/apache2/LICENSE +201 -0
- data/chef/cookbooks/apache2/README.md +373 -0
- data/chef/cookbooks/apache2/attributes/default.rb +149 -0
- data/chef/cookbooks/apache2/attributes/mod_auth_openid.rb +32 -0
- data/chef/cookbooks/apache2/definitions/apache_conf.rb +26 -0
- data/chef/cookbooks/apache2/definitions/apache_module.rb +53 -0
- data/chef/cookbooks/apache2/definitions/apache_site.rb +43 -0
- data/chef/cookbooks/apache2/definitions/web_app.rb +49 -0
- data/chef/cookbooks/apache2/files/default/apache2_module_conf_generate.pl +41 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/default_test.rb +64 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/helpers.rb +36 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/mod_auth_openid_test.rb +25 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/mod_dav_svn_test.rb +16 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/mod_perl_test.rb +22 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/mod_php5_test.rb +19 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/mod_python_test.rb +14 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/mod_ssl_test.rb +19 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/mod_wsgi_test.rb +14 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/mod_xsendfile_test.rb +14 -0
- data/chef/cookbooks/apache2/files/default/tests/minitest/modules_test.rb +19 -0
- data/chef/cookbooks/apache2/metadata.json +511 -0
- data/chef/cookbooks/apache2/metadata.rb +205 -0
- data/chef/cookbooks/apache2/recipes/default.rb +221 -0
- data/chef/cookbooks/apache2/recipes/god_monitor.rb +33 -0
- data/chef/cookbooks/apache2/recipes/mod_alias.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_apreq2.rb +45 -0
- data/chef/cookbooks/apache2/recipes/mod_auth_basic.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_auth_digest.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_auth_openid.rb +113 -0
- data/chef/cookbooks/apache2/recipes/mod_authn_file.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_authnz_ldap.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_authz_default.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_authz_groupfile.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_authz_host.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_authz_user.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_autoindex.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_cgi.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_dav.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_dav_fs.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_dav_svn.rb +29 -0
- data/chef/cookbooks/apache2/recipes/mod_deflate.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_dir.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_env.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_expires.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_fastcgi.rb +26 -0
- data/chef/cookbooks/apache2/recipes/mod_fcgid.rb +53 -0
- data/chef/cookbooks/apache2/recipes/mod_headers.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_ldap.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_log_config.rb +24 -0
- data/chef/cookbooks/apache2/recipes/mod_logio.rb +24 -0
- data/chef/cookbooks/apache2/recipes/mod_mime.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_negotiation.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_perl.rb +39 -0
- data/chef/cookbooks/apache2/recipes/mod_php5.rb +99 -0
- data/chef/cookbooks/apache2/recipes/mod_proxy.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_proxy_ajp.rb +21 -0
- data/chef/cookbooks/apache2/recipes/mod_proxy_balancer.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_proxy_connect.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_proxy_http.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_python.rb +32 -0
- data/chef/cookbooks/apache2/recipes/mod_rewrite.rb +20 -0
- data/chef/cookbooks/apache2/recipes/mod_setenvif.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_ssl.rb +43 -0
- data/chef/cookbooks/apache2/recipes/mod_status.rb +22 -0
- data/chef/cookbooks/apache2/recipes/mod_wsgi.rb +27 -0
- data/chef/cookbooks/apache2/recipes/mod_xsendfile.rb +27 -0
- data/chef/cookbooks/apache2/templates/default/a2dismod.erb +22 -0
- data/chef/cookbooks/apache2/templates/default/a2dissite.erb +29 -0
- data/chef/cookbooks/apache2/templates/default/a2enmod.erb +37 -0
- data/chef/cookbooks/apache2/templates/default/a2ensite.erb +38 -0
- data/chef/cookbooks/apache2/templates/default/apache2.conf.erb +237 -0
- data/chef/cookbooks/apache2/templates/default/apache2.god.erb +19 -0
- data/chef/cookbooks/apache2/templates/default/charset.erb +6 -0
- data/chef/cookbooks/apache2/templates/default/default-site.erb +57 -0
- data/chef/cookbooks/apache2/templates/default/mods/README +2 -0
- data/chef/cookbooks/apache2/templates/default/mods/alias.conf.erb +24 -0
- data/chef/cookbooks/apache2/templates/default/mods/authopenid.load.erb +1 -0
- data/chef/cookbooks/apache2/templates/default/mods/autoindex.conf.erb +101 -0
- data/chef/cookbooks/apache2/templates/default/mods/deflate.conf.erb +16 -0
- data/chef/cookbooks/apache2/templates/default/mods/dir.conf.erb +5 -0
- data/chef/cookbooks/apache2/templates/default/mods/fastcgi.conf.erb +5 -0
- data/chef/cookbooks/apache2/templates/default/mods/fcgid.conf.erb +10 -0
- data/chef/cookbooks/apache2/templates/default/mods/mime.conf.erb +198 -0
- data/chef/cookbooks/apache2/templates/default/mods/negotiation.conf.erb +18 -0
- data/chef/cookbooks/apache2/templates/default/mods/php5.conf.erb +16 -0
- data/chef/cookbooks/apache2/templates/default/mods/proxy.conf.erb +19 -0
- data/chef/cookbooks/apache2/templates/default/mods/setenvif.conf.erb +28 -0
- data/chef/cookbooks/apache2/templates/default/mods/ssl.conf.erb +76 -0
- data/chef/cookbooks/apache2/templates/default/mods/status.conf.erb +26 -0
- data/chef/cookbooks/apache2/templates/default/port_apache.erb +2 -0
- data/chef/cookbooks/apache2/templates/default/ports.conf.erb +6 -0
- data/chef/cookbooks/apache2/templates/default/security.erb +50 -0
- data/chef/cookbooks/apache2/templates/default/web_app.conf.erb +43 -0
- data/chef/cookbooks/build-essential/.gitignore +4 -0
- data/chef/cookbooks/build-essential/CHANGELOG.md +31 -0
- data/chef/cookbooks/build-essential/CONTRIBUTING +29 -0
- data/chef/cookbooks/build-essential/Gemfile +3 -0
- data/chef/cookbooks/build-essential/LICENSE +201 -0
- data/chef/cookbooks/build-essential/README.md +129 -0
- data/chef/cookbooks/build-essential/attributes/default.rb +33 -0
- data/chef/cookbooks/build-essential/metadata.json +41 -0
- data/chef/cookbooks/build-essential/metadata.rb +14 -0
- data/chef/cookbooks/build-essential/recipes/default.rb +92 -0
- data/chef/cookbooks/database/.gitignore +1 -0
- data/chef/cookbooks/database/CHANGELOG.md +46 -0
- data/chef/cookbooks/database/CONTRIBUTING +29 -0
- data/chef/cookbooks/database/LICENSE +201 -0
- data/chef/cookbooks/database/README.md +468 -0
- data/chef/cookbooks/database/libraries/provider_database_mysql.rb +103 -0
- data/chef/cookbooks/database/libraries/provider_database_mysql_user.rb +76 -0
- data/chef/cookbooks/database/libraries/provider_database_postgresql.rb +131 -0
- data/chef/cookbooks/database/libraries/provider_database_postgresql_user.rb +83 -0
- data/chef/cookbooks/database/libraries/provider_database_sql_server.rb +109 -0
- data/chef/cookbooks/database/libraries/provider_database_sql_server_user.rb +106 -0
- data/chef/cookbooks/database/libraries/resource_database.rb +119 -0
- data/chef/cookbooks/database/libraries/resource_database_user.rb +90 -0
- data/chef/cookbooks/database/libraries/resource_mysql_database.rb +34 -0
- data/chef/cookbooks/database/libraries/resource_mysql_database_user.rb +34 -0
- data/chef/cookbooks/database/libraries/resource_postgresql_database.rb +35 -0
- data/chef/cookbooks/database/libraries/resource_postgresql_database_user.rb +35 -0
- data/chef/cookbooks/database/libraries/resource_sql_server_database.rb +34 -0
- data/chef/cookbooks/database/libraries/resource_sql_server_database_user.rb +34 -0
- data/chef/cookbooks/database/metadata.json +45 -0
- data/chef/cookbooks/database/metadata.rb +22 -0
- data/chef/cookbooks/database/recipes/default.rb +20 -0
- data/chef/cookbooks/database/recipes/ebs_backup.rb +89 -0
- data/chef/cookbooks/database/recipes/ebs_volume.rb +204 -0
- data/chef/cookbooks/database/recipes/master.rb +78 -0
- data/chef/cookbooks/database/recipes/mysql.rb +20 -0
- data/chef/cookbooks/database/recipes/postgresql.rb +20 -0
- data/chef/cookbooks/database/recipes/snapshot.rb +62 -0
- data/chef/cookbooks/database/templates/default/app_grants.sql.erb +8 -0
- data/chef/cookbooks/database/templates/default/aws_config.erb +3 -0
- data/chef/cookbooks/database/templates/default/chef-solo-database-snapshot.cron.erb +6 -0
- data/chef/cookbooks/database/templates/default/chef-solo-database-snapshot.json.erb +1 -0
- data/chef/cookbooks/database/templates/default/chef-solo-database-snapshot.rb.erb +6 -0
- data/chef/cookbooks/database/templates/default/ebs-backup-cron.erb +2 -0
- data/chef/cookbooks/database/templates/default/ebs-db-backup.sh.erb +8 -0
- data/chef/cookbooks/database/templates/default/ebs-db-restore.sh.erb +10 -0
- data/chef/cookbooks/database/templates/default/s3cfg.erb +27 -0
- data/chef/cookbooks/fast_food/recipes/default.rb +24 -0
- data/chef/cookbooks/fast_food/recipes/site.rb +7 -0
- data/chef/cookbooks/fast_food/templates/default/web_app.conf.erb +43 -0
- data/chef/cookbooks/git/CHANGELOG.md +49 -0
- data/chef/cookbooks/git/CONTRIBUTING +29 -0
- data/chef/cookbooks/git/LICENSE +201 -0
- data/chef/cookbooks/git/README.md +115 -0
- data/chef/cookbooks/git/attributes/default.rb +37 -0
- data/chef/cookbooks/git/metadata.json +48 -0
- data/chef/cookbooks/git/metadata.rb +20 -0
- data/chef/cookbooks/git/recipes/default.rb +46 -0
- data/chef/cookbooks/git/recipes/server.rb +38 -0
- data/chef/cookbooks/git/recipes/source.rb +48 -0
- data/chef/cookbooks/git/recipes/windows.rb +32 -0
- data/chef/cookbooks/git/templates/default/sv-git-daemon-log-run.erb +2 -0
- data/chef/cookbooks/git/templates/default/sv-git-daemon-run.erb +3 -0
- data/chef/cookbooks/imagemagick/README.md +57 -0
- data/chef/cookbooks/imagemagick/metadata.json +37 -0
- data/chef/cookbooks/imagemagick/metadata.rb +14 -0
- data/chef/cookbooks/imagemagick/recipes/default.rb +25 -0
- data/chef/cookbooks/imagemagick/recipes/devel.rb +32 -0
- data/chef/cookbooks/imagemagick/recipes/rmagick.rb +22 -0
- data/chef/cookbooks/mysql/.gitignore +5 -0
- data/chef/cookbooks/mysql/CHANGELOG.md +125 -0
- data/chef/cookbooks/mysql/CONTRIBUTING +29 -0
- data/chef/cookbooks/mysql/Gemfile +8 -0
- data/chef/cookbooks/mysql/LICENSE +201 -0
- data/chef/cookbooks/mysql/README.md +227 -0
- data/chef/cookbooks/mysql/attributes/client.rb +50 -0
- data/chef/cookbooks/mysql/attributes/server.rb +240 -0
- data/chef/cookbooks/mysql/files/default/tests/minitest/server_test.rb +36 -0
- data/chef/cookbooks/mysql/files/default/tests/minitest/support/helpers.rb +11 -0
- data/chef/cookbooks/mysql/libraries/helpers.rb +33 -0
- data/chef/cookbooks/mysql/metadata.json +418 -0
- data/chef/cookbooks/mysql/metadata.rb +140 -0
- data/chef/cookbooks/mysql/recipes/client.rb +59 -0
- data/chef/cookbooks/mysql/recipes/default.rb +20 -0
- data/chef/cookbooks/mysql/recipes/ruby.rb +36 -0
- data/chef/cookbooks/mysql/recipes/server.rb +221 -0
- data/chef/cookbooks/mysql/recipes/server_ec2.rb +51 -0
- data/chef/cookbooks/mysql/templates/default/debian.cnf.erb +12 -0
- data/chef/cookbooks/mysql/templates/default/grants.sql.erb +15 -0
- data/chef/cookbooks/mysql/templates/default/my.cnf.erb +312 -0
- data/chef/cookbooks/mysql/templates/default/mysql-server.seed.erb +10 -0
- data/chef/cookbooks/mysql/templates/default/port_mysql.erb +3 -0
- data/chef/cookbooks/mysql/templates/windows/my.cnf.erb +61 -0
- data/chef/cookbooks/openssl/README.md +37 -0
- data/chef/cookbooks/openssl/libraries/secure_password.rb +37 -0
- data/chef/cookbooks/openssl/metadata.json +30 -0
- data/chef/cookbooks/openssl/metadata.rb +8 -0
- data/chef/cookbooks/openssl/recipes/default.rb +19 -0
- data/chef/cookbooks/passenger_apache2/.gitignore +4 -0
- data/chef/cookbooks/passenger_apache2/CHANGELOG.md +29 -0
- data/chef/cookbooks/passenger_apache2/CONTRIBUTING +29 -0
- data/chef/cookbooks/passenger_apache2/Gemfile +3 -0
- data/chef/cookbooks/passenger_apache2/LICENSE +201 -0
- data/chef/cookbooks/passenger_apache2/README.md +77 -0
- data/chef/cookbooks/passenger_apache2/attributes/default.rb +5 -0
- data/chef/cookbooks/passenger_apache2/metadata.json +38 -0
- data/chef/cookbooks/passenger_apache2/metadata.rb +17 -0
- data/chef/cookbooks/passenger_apache2/recipes/default.rb +60 -0
- data/chef/cookbooks/passenger_apache2/recipes/mod_rails.rb +47 -0
- data/chef/cookbooks/passenger_apache2/templates/default/passenger.conf.erb +3 -0
- data/chef/cookbooks/passenger_apache2/templates/default/passenger.load.erb +1 -0
- data/chef/cookbooks/passenger_apache2/templates/default/passenger_web_app.conf.erb +32 -0
- data/chef/cookbooks/passenger_apache2/templates/default/web_app.conf.erb +32 -0
- data/chef/roles/apache2.rb +12 -0
- data/chef/roles/mysql.rb +18 -0
- data/chef/solo.rb +5 -0
- data/config/deploy/centos.sh +17 -0
- data/config/deploy/production.rb +3 -0
- data/config/deploy/ubuntu.sh +10 -0
- data/config/deploy.rb +99 -0
- data/config/deployment.yml +6 -0
- data/fast_food.gemspec +26 -0
- data/lib/fast_food/railtie.rb +9 -0
- data/lib/fast_food/version.rb +3 -0
- data/lib/fast_food.rb +5 -0
- data/lib/tasks/fast_food.rake +100 -0
- data/spec/lib/fast_food_spec.rb +0 -0
- data/spec/spec_helper.rb +1 -0
- metadata +349 -0
@@ -0,0 +1,60 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: passenger_apache2
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
6
|
+
# Author:: Joshua Sierles (<joshua@37signals.com>)
|
7
|
+
# Author:: Michael Hale (<mikehale@gmail.com>)
|
8
|
+
#
|
9
|
+
# Copyright:: 2009, Opscode, Inc
|
10
|
+
# Copyright:: 2009, 37signals
|
11
|
+
# Coprighty:: 2009, Michael Hale
|
12
|
+
#
|
13
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
+
# you may not use this file except in compliance with the License.
|
15
|
+
# You may obtain a copy of the License at
|
16
|
+
#
|
17
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
18
|
+
#
|
19
|
+
# Unless required by applicable law or agreed to in writing, software
|
20
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
+
# See the License for the specific language governing permissions and
|
23
|
+
# limitations under the License.
|
24
|
+
|
25
|
+
include_recipe "apache2"
|
26
|
+
include_recipe "build-essential"
|
27
|
+
|
28
|
+
case node[:platform]
|
29
|
+
when "arch"
|
30
|
+
package "apache"
|
31
|
+
when "centos","redhat"
|
32
|
+
package "httpd-devel"
|
33
|
+
if node['platform_version'].to_f < 6.0
|
34
|
+
package 'curl-devel'
|
35
|
+
else
|
36
|
+
package 'libcurl-devel'
|
37
|
+
package 'openssl-devel'
|
38
|
+
package 'zlib-devel'
|
39
|
+
end
|
40
|
+
else
|
41
|
+
apache_development_package = if %w( worker threaded ).include? node['passenger']['apache_mpm']
|
42
|
+
'apache2-threaded-dev'
|
43
|
+
else
|
44
|
+
'apache2-prefork-dev'
|
45
|
+
end
|
46
|
+
%W( #{apache_development_package} libapr1-dev libcurl4-gnutls-dev ).each do |pkg|
|
47
|
+
package pkg do
|
48
|
+
action :upgrade
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
gem_package "passenger" do
|
54
|
+
version node[:passenger][:version]
|
55
|
+
end
|
56
|
+
|
57
|
+
execute "passenger_module" do
|
58
|
+
command 'passenger-install-apache2-module --auto'
|
59
|
+
creates node[:passenger][:module_path]
|
60
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: passenger_apache2
|
3
|
+
# Recipe:: mod_rails
|
4
|
+
#
|
5
|
+
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
6
|
+
# Author:: Joshua Sierles (<joshua@37signals.com>)
|
7
|
+
# Author:: Michael Hale (<mikehale@gmail.com>)
|
8
|
+
#
|
9
|
+
# Copyright:: 2009, Opscode, Inc
|
10
|
+
# Copyright:: 2009, 37signals
|
11
|
+
# Coprighty:: 2009, Michael Hale
|
12
|
+
#
|
13
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
+
# you may not use this file except in compliance with the License.
|
15
|
+
# You may obtain a copy of the License at
|
16
|
+
#
|
17
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
18
|
+
#
|
19
|
+
# Unless required by applicable law or agreed to in writing, software
|
20
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
+
# See the License for the specific language governing permissions and
|
23
|
+
# limitations under the License.
|
24
|
+
|
25
|
+
include_recipe "passenger_apache2"
|
26
|
+
|
27
|
+
if platform?("ubuntu","debian")
|
28
|
+
template "#{node[:apache][:dir]}/mods-available/passenger.load" do
|
29
|
+
cookbook "passenger_apache2"
|
30
|
+
source "passenger.load.erb"
|
31
|
+
owner "root"
|
32
|
+
group "root"
|
33
|
+
mode 0755
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
template "#{node[:apache][:dir]}/mods-available/passenger.conf" do
|
38
|
+
cookbook "passenger_apache2"
|
39
|
+
source "passenger.conf.erb"
|
40
|
+
owner "root"
|
41
|
+
group "root"
|
42
|
+
mode "644"
|
43
|
+
end
|
44
|
+
|
45
|
+
apache_module "passenger" do
|
46
|
+
module_path node[:passenger][:module_path]
|
47
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
LoadModule passenger_module <%= node[:passenger][:module_path] %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<VirtualHost *:80>
|
2
|
+
ServerName <%= @params[:server_name] %>
|
3
|
+
ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %>
|
4
|
+
DocumentRoot <%= @params[:docroot] %>
|
5
|
+
|
6
|
+
RailsBaseURI /
|
7
|
+
RailsEnv <%= @params[:rails_env] %>
|
8
|
+
|
9
|
+
<Directory <%= @params[:docroot] %>>
|
10
|
+
Options FollowSymLinks
|
11
|
+
AllowOverride None
|
12
|
+
Order allow,deny
|
13
|
+
Allow from all
|
14
|
+
</Directory>
|
15
|
+
|
16
|
+
LogLevel info
|
17
|
+
ErrorLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log
|
18
|
+
CustomLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined
|
19
|
+
|
20
|
+
RewriteEngine On
|
21
|
+
RewriteLog <%= node[:apache][:log_dir] %>/<%= @application_name %>-rewrite.log
|
22
|
+
RewriteLogLevel 0
|
23
|
+
# Canonical host
|
24
|
+
RewriteCond %{HTTP_HOST} !^<%= @params[:server_name] %> [NC]
|
25
|
+
RewriteCond %{HTTP_HOST} !^$
|
26
|
+
RewriteRule ^/(.*)$ http://<%= @params[:server_name] %>/$1 [L,R=301]
|
27
|
+
|
28
|
+
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
|
29
|
+
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
|
30
|
+
RewriteRule ^.*$ /system/maintenance.html [L]
|
31
|
+
|
32
|
+
</VirtualHost>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<VirtualHost *:80>
|
2
|
+
ServerName <%= @params[:server_name] %>
|
3
|
+
ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %>
|
4
|
+
DocumentRoot <%= @params[:docroot] %>
|
5
|
+
|
6
|
+
RailsBaseURI /
|
7
|
+
RailsEnv <%= @params[:rails_env] %>
|
8
|
+
|
9
|
+
<Directory <%= @params[:docroot] %>>
|
10
|
+
Options FollowSymLinks
|
11
|
+
AllowOverride None
|
12
|
+
Order allow,deny
|
13
|
+
Allow from all
|
14
|
+
</Directory>
|
15
|
+
|
16
|
+
LogLevel info
|
17
|
+
ErrorLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log
|
18
|
+
CustomLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined
|
19
|
+
|
20
|
+
RewriteEngine On
|
21
|
+
RewriteLog <%= node[:apache][:log_dir] %>/<%= @application_name %>-rewrite.log
|
22
|
+
RewriteLogLevel 0
|
23
|
+
# Canonical host
|
24
|
+
RewriteCond %{HTTP_HOST} !^<%= @params[:server_name] %> [NC]
|
25
|
+
RewriteCond %{HTTP_HOST} !^$
|
26
|
+
RewriteRule ^/(.*)$ http://<%= @params[:server_name] %>/$1 [L,R=301]
|
27
|
+
|
28
|
+
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
|
29
|
+
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
|
30
|
+
RewriteRule ^.*$ /system/maintenance.html [L]
|
31
|
+
|
32
|
+
</VirtualHost>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
name "apache2"
|
2
|
+
description "Systems that serve HTTP and HTTPS"
|
3
|
+
override_attributes(
|
4
|
+
"apache" => { "listen_ports" => [ "80","443" ] }
|
5
|
+
)
|
6
|
+
run_list(
|
7
|
+
"recipe[apache2::default]",
|
8
|
+
"recipe[apache2::mod_ssl]",
|
9
|
+
"recipe[apache2::mod_expires]",
|
10
|
+
"recipe[apache2::mod_deflate]",
|
11
|
+
"recipe[apache2::mod_headers]"
|
12
|
+
)
|
data/chef/roles/mysql.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
name "mysql"
|
2
|
+
description "MySQL Install"
|
3
|
+
run_list(
|
4
|
+
"recipe[mysql::server]",
|
5
|
+
"recipe[mysql::client]"
|
6
|
+
)
|
7
|
+
override_attributes(
|
8
|
+
:mysql => {
|
9
|
+
#:server_root_password => you can enter in your root password here else its auto generated,
|
10
|
+
:tunable => {
|
11
|
+
:innodb_buffer_pool_size => "128M",
|
12
|
+
:innodb_log_buffer_size => "8M",
|
13
|
+
:innodb_log_file_size => "64M",
|
14
|
+
:innodb_additional_mem_pool_size => "16M",
|
15
|
+
:max_allowed_packet => "128M"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
)
|
data/chef/solo.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
yum update
|
3
|
+
yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel libtool libxml2 libxslt-devel libxml2-devel readline-devel
|
4
|
+
cd /tmp
|
5
|
+
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
|
6
|
+
tar xzvf yaml-0.1.4.tar.gz
|
7
|
+
cd yaml-0.1.4
|
8
|
+
./configure --prefix=/usr/local
|
9
|
+
make
|
10
|
+
make install
|
11
|
+
cd ..
|
12
|
+
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/$1.tar.gz
|
13
|
+
tar -xvzf $1.tar.gz
|
14
|
+
cd $1/
|
15
|
+
./configure --prefix=/usr/local
|
16
|
+
make
|
17
|
+
make install
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
apt-get -y update
|
3
|
+
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev lib64readline-gplv2-dev libyaml-dev libxslt-dev libxml2-dev
|
4
|
+
cd /tmp
|
5
|
+
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/$1.tar.gz
|
6
|
+
tar -xvzf $1.tar.gz
|
7
|
+
cd $1/
|
8
|
+
./configure --prefix=/usr/local
|
9
|
+
make
|
10
|
+
make install
|
data/config/deploy.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
require "bundler/capistrano"
|
2
|
+
require 'capistrano/ext/multistage'
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
application_config = YAML.load(File.open(File.join("config", "deployment.yml")))
|
6
|
+
|
7
|
+
set :default_stage, "production"
|
8
|
+
set :default_shell, "bash"
|
9
|
+
|
10
|
+
default_run_options[:pty] = true
|
11
|
+
ssh_options[:forward_agent] = true
|
12
|
+
|
13
|
+
set :ruby_version, "ruby-1.9.3-p374"
|
14
|
+
|
15
|
+
set :application, application_config["application"]
|
16
|
+
set :repository, application_config["repository"]
|
17
|
+
set :deploy_to, "/var/www/#{application_config["application"]}"
|
18
|
+
set :branch, "master"
|
19
|
+
|
20
|
+
set :scm, :git
|
21
|
+
set :scm_verbose, false
|
22
|
+
|
23
|
+
set :deploy_via, :remote_cache
|
24
|
+
set :use_sudo, true
|
25
|
+
set :keep_releases, 3
|
26
|
+
set :user, "root"
|
27
|
+
|
28
|
+
set :chef_binary, "/usr/local/bin/chef-solo"
|
29
|
+
|
30
|
+
load 'deploy/assets'
|
31
|
+
|
32
|
+
namespace :deploy do
|
33
|
+
|
34
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
35
|
+
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
|
36
|
+
end
|
37
|
+
|
38
|
+
task :seed do
|
39
|
+
run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
namespace :servers do
|
45
|
+
|
46
|
+
task :bootstrap do
|
47
|
+
run("rm -rf /var/chef")
|
48
|
+
run("mkdir -p /var/chef")
|
49
|
+
upload("config/deploy/#{application_config["server_os"]}.sh", "/var/chef", :via => :scp)
|
50
|
+
run("yes | sudo bash /var/chef/#{application_config["server_os"]}.sh #{ruby_version}")
|
51
|
+
run("gem install net-ssh -v '~> 2.2.2' --no-ri --no-rdoc")
|
52
|
+
run("gem install net-ssh-multi -v '1.1' --no-ri --no-rdoc")
|
53
|
+
run("gem install net-ssh-gateway -v '1.1.0' --no-ri --no-rdoc")
|
54
|
+
run("gem install chef -v '~> 10.18.2' --no-ri --no-rdoc")
|
55
|
+
run("gem install bundler --no-ri --no-rdoc")
|
56
|
+
system("tar czf 'chef.tar.gz' -C chef/ .")
|
57
|
+
upload("chef.tar.gz", "/var/", :via => :scp)
|
58
|
+
run("cd /var/ && sudo tar xzf 'chef.tar.gz' -C /var/chef")
|
59
|
+
system("rm chef.tar.gz")
|
60
|
+
end
|
61
|
+
|
62
|
+
task :install do
|
63
|
+
run("rm -rf /var/chef")
|
64
|
+
run("mkdir -p /var/chef")
|
65
|
+
system("tar czf 'chef.tar.gz' -C chef/ .")
|
66
|
+
upload("chef.tar.gz", "/var/", :via => :scp)
|
67
|
+
run("cd /var/ && sudo tar xzf 'chef.tar.gz' -C /var/chef")
|
68
|
+
system("rm chef.tar.gz")
|
69
|
+
sudo("/bin/bash -c 'cd /var/chef && #{chef_binary} -c solo.rb -j #{stage}.json'")
|
70
|
+
sudo("rm -rf /var/chef.tar.gz")
|
71
|
+
sudo("rm -rf /var/chef")
|
72
|
+
end
|
73
|
+
|
74
|
+
task :setup do
|
75
|
+
sudo("/bin/bash -c 'cd /var/chef && #{chef_binary} -c solo.rb -j #{stage}.json'")
|
76
|
+
end
|
77
|
+
|
78
|
+
task :complete do
|
79
|
+
sudo("/bin/bash -c 'cd /var/chef && #{chef_binary} -c solo.rb -j #{stage}.json'")
|
80
|
+
sudo("rm -rf /var/chef.tar.gz")
|
81
|
+
sudo("rm -rf /var/chef")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
namespace :fast_food do
|
86
|
+
|
87
|
+
task :full do
|
88
|
+
transaction do
|
89
|
+
servers.bootstrap
|
90
|
+
servers.setup
|
91
|
+
deploy.setup
|
92
|
+
deploy.cold
|
93
|
+
servers.complete
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
after "deploy:cold", "deploy:seed"
|
data/fast_food.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fast_food/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "fast_food"
|
8
|
+
gem.version = FastFood::VERSION
|
9
|
+
gem.authors = ["Richard Biffin"]
|
10
|
+
gem.email = ["rkjb@me.com"]
|
11
|
+
gem.description = %q{Provides quick and dirty server provisioning and app deployment using Chef and Capistrano}
|
12
|
+
gem.summary = %q{Provides quick and dirty server provisioning and app deployment using Chef and Capistrano}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_development_dependency 'rake'
|
21
|
+
gem.add_development_dependency 'rspec'
|
22
|
+
|
23
|
+
gem.add_runtime_dependency "capistrano"
|
24
|
+
gem.add_runtime_dependency "capistrano-ext"
|
25
|
+
|
26
|
+
end
|
data/lib/fast_food.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
namespace :fast_food do
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
desc "Configures your application for initial deployment. Inserts database and deployment configuration."
|
7
|
+
task :setup do
|
8
|
+
|
9
|
+
spec = Gem::Specification.find_by_name("fast_food")
|
10
|
+
gem_root = spec.gem_dir
|
11
|
+
|
12
|
+
`Capify . && mkdir -p #{Rails.root}/chef && cp -R #{gem_root}/chef/* #{Rails.root}/chef && cp -R #{gem_root}/config/* #{Rails.root}/config`
|
13
|
+
|
14
|
+
print "\n\nPlease enter an application name (one word, or use underscores): "
|
15
|
+
application_name = tidy_input(STDIN.gets)
|
16
|
+
|
17
|
+
print "\nPlease enter a repository path: "
|
18
|
+
repository_path = tidy_input(STDIN.gets)
|
19
|
+
|
20
|
+
print "\nPlease enter a domain name: "
|
21
|
+
domain_name = tidy_input(STDIN.gets)
|
22
|
+
|
23
|
+
print "\nPlease enter the ip address of your server: "
|
24
|
+
server_ip = tidy_input(STDIN.gets)
|
25
|
+
|
26
|
+
database_name = application_name + "_production"
|
27
|
+
application_config = YAML.load(File.open(File.join("config", "deployment.yml")))
|
28
|
+
database_config = YAML.load(File.open(File.join("config", "database.yml")))
|
29
|
+
|
30
|
+
# Add application name and repository URL into deployment config.
|
31
|
+
if application_config["application"].eql?("REPLACE_ME")
|
32
|
+
puts "INSERTED: Deployment configuration"
|
33
|
+
|
34
|
+
application_config["application"] = application_name.gsub /_/, "-"
|
35
|
+
application_config["repository"] = repository_path
|
36
|
+
application_config["domain"] = domain_name
|
37
|
+
application_config["server_ip"] = server_ip
|
38
|
+
File.open(File.join("config", "deployment.yml"), "w+") do |file|
|
39
|
+
YAML.dump(application_config, file)
|
40
|
+
end
|
41
|
+
else
|
42
|
+
puts "IGNORED: Deployment configuration"
|
43
|
+
end
|
44
|
+
|
45
|
+
# Add production database details.
|
46
|
+
if database_config["production"]["database"].nil? || database_config["production"]["database"] != "mysql2"
|
47
|
+
puts "INSERTED: Database details"
|
48
|
+
|
49
|
+
database_config["production"]["adapter"] = "mysql2"
|
50
|
+
database_config["production"]["database"] = database_name
|
51
|
+
database_config["production"]["username"] = application_name[0, 16]
|
52
|
+
database_config["production"]["password"] = random_characters
|
53
|
+
File.open(File.join("config", "database.yml"), "w+") do |file|
|
54
|
+
YAML.dump(database_config, file)
|
55
|
+
end
|
56
|
+
else
|
57
|
+
puts "IGNORED: Database details"
|
58
|
+
end
|
59
|
+
|
60
|
+
# Add Chef JSON details
|
61
|
+
production_hash = {
|
62
|
+
"site" => {
|
63
|
+
"name" => "#{application_name}",
|
64
|
+
"server_name" => "www.#{domain_name}",
|
65
|
+
"server_aliases" => [ "#{domain_name}" ],
|
66
|
+
"docroot" => "/var/www/#{application_name}/current/public"
|
67
|
+
},
|
68
|
+
"mysql" => {
|
69
|
+
"server_debian_password" => "#{database_config["production"]["password"]}",
|
70
|
+
"server_root_password" => "#{database_config["production"]["password"]}",
|
71
|
+
"server_repl_password" => "#{database_config["production"]["password"]}",
|
72
|
+
"host" => "localhost",
|
73
|
+
"database" => "#{database_config["production"]["database"]}",
|
74
|
+
"username" => "#{database_config["production"]["username"]}",
|
75
|
+
"password" => "#{database_config["production"]["password"]}"
|
76
|
+
},
|
77
|
+
"run_list" => [ "recipe[mysql::server]","recipe[mysql::client]","role[apache2]","recipe[fast_food]","recipe[fast_food::site]" ]
|
78
|
+
}
|
79
|
+
File.open(File.join("chef", "production.json"), "w+") do |f|
|
80
|
+
f.write(production_hash.to_json)
|
81
|
+
end
|
82
|
+
|
83
|
+
puts "\nDone! Now run: cap fast_food:deploy\n\n"
|
84
|
+
end
|
85
|
+
|
86
|
+
# Random alphanumeric characters.
|
87
|
+
def random_characters(size=8)
|
88
|
+
alphanumerics = [('0'..'9'),('A'..'Z'),('a'..'z')].map {|range| range.to_a}.flatten
|
89
|
+
(1..size).map { alphanumerics[Kernel.rand(alphanumerics.size)] }.join
|
90
|
+
end
|
91
|
+
|
92
|
+
# Transforms input into something the config can use.
|
93
|
+
def tidy_input(application_name)
|
94
|
+
input = application_name.chomp
|
95
|
+
input.gsub! /[^a-zA-Z0-9_\-\.\:\/\@]/, ''
|
96
|
+
input.gsub! /[\s\-]/, '_'
|
97
|
+
input
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'fast_food'
|