-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from brint-hacking/move_mysql_add_apache_option
Move mysql to recipe; Add apache option
- Loading branch information
Showing
15 changed files
with
219 additions
and
116 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Documentation: | ||
Enabled: false |
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'fileutils' | ||
|
||
class Chef | ||
class Recipe | ||
class Magento | ||
def self.create_ssl_cert(cert_path, domain, file_name) | ||
pem_file = File.join(cert_path, file_name) | ||
|
||
unless File.exist?(pem_file) | ||
f = FileUtils | ||
f.mkdir_p cert_path | ||
|
||
# One-liner to generate a SSL cert | ||
system "openssl req -x509 -nodes -days 365 -subj '/CN=#{domain}/O=O"\ | ||
"ps/C=ZZ/ST=State/L=City' -newkey rsa:4096 -keyout "\ | ||
"#{pem_file} -out #{pem_file} 2>/dev/null" | ||
end | ||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ | |
end | ||
|
||
depends 'php-fpm', '>= 0.6.4' | ||
depends 'nginx', '~> 2.6' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# coding: utf-8 | ||
|
||
node.set['apache']['default_modules'] = %w(status actions alias auth_basic | ||
authn_file authz_default | ||
authz_groupfile authz_host | ||
authz_user autoindex dir env mime | ||
negotiation setenvif ssl headers | ||
expires log_config logio fastcgi) | ||
include_recipe 'apache2' | ||
|
||
Magento.create_ssl_cert(File.join(node[:apache][:dir], 'ssl'), | ||
node[:magento][:domain], node[:magento][:cert_name]) | ||
|
||
%w(default ssl).each do |site| | ||
web_app "#{site}" do | ||
template 'apache2-site.conf.erb' | ||
docroot node[:magento][:dir] | ||
server_name node[:magento][:domain] | ||
server_aliases node.fqdn | ||
ssl true if site == 'ssl' | ||
ssl_cert File.join(node[:apache][:dir], 'ssl', node[:magento][:cert_name]) | ||
ssl_key File.join(node[:apache][:dir], 'ssl', node[:magento][:cert_name]) | ||
end | ||
end | ||
|
||
%w(default 000-default).each do |site| | ||
apache_site "#{site}" do | ||
enable false | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# coding: utf-8 | ||
|
||
include_recipe 'nginx' | ||
|
||
Magento.create_ssl_cert(File.join(node[:nginx][:dir], 'ssl'), | ||
node[:magento][:domain], node[:magento][:cert_name]) | ||
|
||
%w(backend).each do |file| | ||
cookbook_file File.join(node[:nginx][:dir], 'conf.d', "#{file}.conf") do | ||
source "nginx/#{file}.conf" | ||
mode 0644 | ||
owner 'root' | ||
group 'root' | ||
end | ||
end | ||
|
||
bash 'Drop default site' do | ||
cwd node[:nginx][:dir] | ||
code <<-EOH | ||
rm -rf conf.d/default.conf | ||
EOH | ||
notifies :reload, resources(service: 'nginx') | ||
end | ||
|
||
%w(default ssl).each do |site| | ||
template File.join(node[:nginx][:dir], 'sites-available', site) do | ||
source 'nginx-site.erb' | ||
owner 'root' | ||
group 'root' | ||
mode 0644 | ||
variables( | ||
path: node[:magento][:dir], | ||
ssl: (site == 'ssl') ? true : false, | ||
ssl_cert: File.join(node[:nginx][:dir], 'ssl', | ||
node[:magento][:cert_name]), | ||
ssl_key: File.join(node[:nginx][:dir], 'ssl', node[:magento][:cert_name]) | ||
) | ||
end | ||
nginx_site site do | ||
template nil | ||
notifies :reload, resources(service: 'nginx') | ||
end | ||
end |
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
Oops, something went wrong.