Add initial kosmos-wordpress cookbook
This commit is contained in:
parent
255ff036c3
commit
bb06dbcbf0
57
data_bags/credentials/wordpress.json
Normal file
57
data_bags/credentials/wordpress.json
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"id": "wordpress",
|
||||||
|
"db_pass": {
|
||||||
|
"encrypted_data": "bpszQO9HAgC6lfk214wKkLiJyZ/Y8iSPLHd5FR8F6Kf7x3ugqpFOorXd7f0h\njGp5\n",
|
||||||
|
"iv": "HTICQA9MkU+bl3HVZdrKjw==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
},
|
||||||
|
"keys_auth": {
|
||||||
|
"encrypted_data": "orIiLz4Uthxjs9M0o5DKvAFjRIx3dk25p6AUtSQEYaRQnJSrqGnVkLmQ10zA\nzfZV\n",
|
||||||
|
"iv": "GHNQ1ofsBC34T7ZV1IGTxQ==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
},
|
||||||
|
"keys_secure_auth": {
|
||||||
|
"encrypted_data": "w124spSuSCptIBvei02PyN69odutZbrSlljD1W+u7r52dfdu8TwG8pL7JA3d\nJ4Gc\n",
|
||||||
|
"iv": "ztacTkIbpzvUSTptCBGIAw==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
},
|
||||||
|
"keys_logged_in": {
|
||||||
|
"encrypted_data": "JDeGlPZy5e33As1TcNa9s5hmpcWXHhbTZk2KBH/20600KHGGfWG7S6fBmfeh\n1za+\n",
|
||||||
|
"iv": "mT514WoiD1Xyu9DhoZ9Bag==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
},
|
||||||
|
"keys_nonce": {
|
||||||
|
"encrypted_data": "LhuZPVXrnNcxZvIQ2WwKZ1Lm1NvlU41hzQQktmA6hmUJWcXaQ4P5XT2Jwmj3\n7edv\n",
|
||||||
|
"iv": "cqaNp+I6msqyr3APdLegIQ==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
},
|
||||||
|
"salt_auth": {
|
||||||
|
"encrypted_data": "50InhVfWXUHNvYZVAtx40fG53iSLHV9C/4iPS8aM8z02zYjiGavENMyCgCcn\n4Tax\n",
|
||||||
|
"iv": "vYREm/XU2Te4mV3pRAVbhQ==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
},
|
||||||
|
"salt_secure_auth": {
|
||||||
|
"encrypted_data": "oR12kgaLPmk7nFpodVvbbpYug8VrBUOU4e9i/wPvy334ydsuqjfzBbApPtws\n4o5U\n",
|
||||||
|
"iv": "0Z8031pUpdHh6ANI6kXn4w==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
},
|
||||||
|
"salt_logged_in": {
|
||||||
|
"encrypted_data": "lqmy1xN518e/ZatohTFjCvaaGWiV0LTfnbcpbSjiInHffTCLqRlrtszf1Vcn\nWdSJ\n",
|
||||||
|
"iv": "7Vvyo58AUTFWV3ucmGeyIw==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
},
|
||||||
|
"salt_nonce": {
|
||||||
|
"encrypted_data": "FUGPwfxe03CgoVvXgsAOyU2sdEX7L2+ApnJ+3JdYi2JLZOwr7V0O2rmwT6Lm\nu5sm\n",
|
||||||
|
"iv": "79hV7Gq9itQmJyLNrCPSSw==\n",
|
||||||
|
"version": 1,
|
||||||
|
"cipher": "aes-256-cbc"
|
||||||
|
}
|
||||||
|
}
|
13
site-cookbooks/kosmos-wordpress/CHANGELOG.md
Normal file
13
site-cookbooks/kosmos-wordpress/CHANGELOG.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
kosmos-wordpress CHANGELOG
|
||||||
|
==========================
|
||||||
|
|
||||||
|
This file is used to list changes made in each version of the kosmos-wordpress cookbook.
|
||||||
|
|
||||||
|
0.1.0
|
||||||
|
-----
|
||||||
|
- [your_name] - Initial release of kosmos-wordpress
|
||||||
|
|
||||||
|
- - -
|
||||||
|
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
|
||||||
|
|
||||||
|
The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
|
68
site-cookbooks/kosmos-wordpress/README.md
Normal file
68
site-cookbooks/kosmos-wordpress/README.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
kosmos-wordpress Cookbook
|
||||||
|
=========================
|
||||||
|
TODO: Enter the cookbook description here.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
This cookbook makes your favorite breakfast sandwich.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
#### packages
|
||||||
|
- `toaster` - kosmos-wordpress needs toaster to brown your bagel.
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
TODO: List your cookbook attributes here.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
#### kosmos-wordpress::default
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Key</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Default</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><tt>['kosmos-wordpress']['bacon']</tt></td>
|
||||||
|
<td>Boolean</td>
|
||||||
|
<td>whether to include bacon</td>
|
||||||
|
<td><tt>true</tt></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
#### kosmos-wordpress::default
|
||||||
|
TODO: Write usage instructions for each cookbook.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
Just include `kosmos-wordpress` in your node's `run_list`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name":"my_node",
|
||||||
|
"run_list": [
|
||||||
|
"recipe[kosmos-wordpress]"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Contributing
|
||||||
|
------------
|
||||||
|
TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
1. Fork the repository on Github
|
||||||
|
2. Create a named feature branch (like `add_component_x`)
|
||||||
|
3. Write your change
|
||||||
|
4. Write tests for your change (if applicable)
|
||||||
|
5. Run the tests, ensuring they all pass
|
||||||
|
6. Submit a Pull Request using Github
|
||||||
|
|
||||||
|
License and Authors
|
||||||
|
-------------------
|
||||||
|
Authors: TODO: List authors
|
10
site-cookbooks/kosmos-wordpress/metadata.rb
Normal file
10
site-cookbooks/kosmos-wordpress/metadata.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
name 'kosmos-wordpress'
|
||||||
|
maintainer 'Kosmos'
|
||||||
|
maintainer_email 'ops@kosmos.org'
|
||||||
|
license 'All rights reserved'
|
||||||
|
description 'Installs/Configures kosmos-wordpress'
|
||||||
|
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||||
|
version '0.1.0'
|
||||||
|
|
||||||
|
depends 'wordpress'
|
||||||
|
depends 'php-fpm'
|
26
site-cookbooks/kosmos-wordpress/recipes/default.rb
Normal file
26
site-cookbooks/kosmos-wordpress/recipes/default.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#
|
||||||
|
# Cookbook Name:: kosmos-wordpress
|
||||||
|
# Recipe:: default
|
||||||
|
#
|
||||||
|
# Copyright 2016, Kosmos
|
||||||
|
#
|
||||||
|
# All rights reserved - Do Not Redistribute
|
||||||
|
#
|
||||||
|
|
||||||
|
node.override['wordpress']['db']['root_password'] = "eiSi9aegebietheoBaogh8ay"
|
||||||
|
node.override['wordpress']['server_name'] = "blog.kosmos.org"
|
||||||
|
node.override['wordpress']['server_aliases'] = ["blog.kosmos.org"]
|
||||||
|
node.override['wordpress']['db']['mysql_version'] = "5.6"
|
||||||
|
node.override['wordpress']['server_port'] = "443"
|
||||||
|
credentials = Chef::EncryptedDataBagItem.load('credentials', 'wordpress')
|
||||||
|
node.set['wordpress']['db']['pass'] = credentials["db_pass"]
|
||||||
|
node.set['wordpress']['keys']['auth'] = credentials["keys_auth"]
|
||||||
|
node.set['wordpress']['keys']['secure_auth'] = credentials["keys_secure_auth"]
|
||||||
|
node.set['wordpress']['keys']['logged_in'] = credentials["keys_logged_in"]
|
||||||
|
node.set['wordpress']['keys']['nonce'] = credentials["keys_nonce"]
|
||||||
|
node.set['wordpress']['salt']['auth'] = credentials["keys_auth"]
|
||||||
|
node.set['wordpress']['salt']['secure_auth'] = credentials["saltsecure_auth"]
|
||||||
|
node.set['wordpress']['salt']['logged_in'] = credentials["salt_logged_in"]
|
||||||
|
node.set['wordpress']['salt']['nonce'] = credentials["salt_nonce"]
|
||||||
|
|
||||||
|
include_recipe 'kosmos-wordpress::nginx'
|
98
site-cookbooks/kosmos-wordpress/recipes/nginx.rb
Normal file
98
site-cookbooks/kosmos-wordpress/recipes/nginx.rb
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
#
|
||||||
|
# Cookbook Name:: kosmos-wordpress
|
||||||
|
# Recipe:: nginx
|
||||||
|
#
|
||||||
|
# Copyright 2016, Kosmos
|
||||||
|
#
|
||||||
|
# All rights reserved - Do Not Redistribute
|
||||||
|
#
|
||||||
|
|
||||||
|
node.set_unless['php-fpm']['pools'] = []
|
||||||
|
|
||||||
|
include_recipe "php-fpm::configure"
|
||||||
|
include_recipe 'php-fpm::repository' unless node['php-fpm']['skip_repository_install']
|
||||||
|
|
||||||
|
if node['php-fpm']['package_name'].nil?
|
||||||
|
if platform_family?("rhel")
|
||||||
|
php_fpm_package_name = "php-fpm"
|
||||||
|
else
|
||||||
|
php_fpm_package_name = "php5-fpm"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
php_fpm_package_name = node['php-fpm']['package_name']
|
||||||
|
end
|
||||||
|
|
||||||
|
package php_fpm_package_name do
|
||||||
|
action :upgrade
|
||||||
|
end
|
||||||
|
|
||||||
|
if node['php-fpm']['service_name'].nil?
|
||||||
|
php_fpm_service_name = php_fpm_package_name
|
||||||
|
else
|
||||||
|
php_fpm_service_name = node['php-fpm']['service_name']
|
||||||
|
end
|
||||||
|
|
||||||
|
service "php-fpm" do
|
||||||
|
service_name php_fpm_service_name
|
||||||
|
supports :start => true, :stop => true, :restart => true, :reload => true
|
||||||
|
action [ :enable, :start ]
|
||||||
|
end
|
||||||
|
|
||||||
|
php_fpm_pool "www" do
|
||||||
|
enable false
|
||||||
|
end
|
||||||
|
|
||||||
|
php_fpm_pool "wordpress" do
|
||||||
|
listen "127.0.0.1:9001"
|
||||||
|
user node['wordpress']['install']['user']
|
||||||
|
group node['wordpress']['install']['group']
|
||||||
|
if node['platform'] == 'ubuntu' and node['platform_version'] == '10.04'
|
||||||
|
process_manager 'dynamic'
|
||||||
|
end
|
||||||
|
listen_owner node['wordpress']['install']['user']
|
||||||
|
listen_group node['wordpress']['install']['group']
|
||||||
|
php_options node['wordpress']['php_options']
|
||||||
|
start_servers 5
|
||||||
|
enable true
|
||||||
|
end
|
||||||
|
|
||||||
|
include_recipe "php::module_mysql"
|
||||||
|
|
||||||
|
include_recipe "kosmos-nginx"
|
||||||
|
|
||||||
|
include_recipe "wordpress::app"
|
||||||
|
|
||||||
|
data_bag_item = Chef::EncryptedDataBagItem.load('certificates', 'wildcard_kosmos_org')
|
||||||
|
|
||||||
|
ssl_cert_path = "/etc/ssl/private/wildcard.kosmos.org.crt"
|
||||||
|
file ssl_cert_path do
|
||||||
|
content data_bag_item['ssl_cert']
|
||||||
|
mode 0600
|
||||||
|
owner 'www-data'
|
||||||
|
sensitive true
|
||||||
|
end
|
||||||
|
|
||||||
|
ssl_key_path = "/etc/ssl/private/wildcard.kosmos.org.key"
|
||||||
|
file ssl_key_path do
|
||||||
|
content data_bag_item['ssl_key']
|
||||||
|
mode 0600
|
||||||
|
owner 'www-data'
|
||||||
|
sensitive true
|
||||||
|
end
|
||||||
|
|
||||||
|
template "#{node['nginx']['dir']}/sites-available/wordpress" do
|
||||||
|
source "nginx.conf.erb"
|
||||||
|
variables(
|
||||||
|
docroot: node['wordpress']['dir'],
|
||||||
|
server_name: node['wordpress']['server_name'],
|
||||||
|
server_aliases: node['wordpress']['server_aliases'],
|
||||||
|
server_port: node['wordpress']['server_port'],
|
||||||
|
ssl_cert: ssl_cert_path,
|
||||||
|
ssl_key: ssl_key_path
|
||||||
|
)
|
||||||
|
action :create
|
||||||
|
end
|
||||||
|
|
||||||
|
nginx_site 'wordpress' do
|
||||||
|
enable true
|
||||||
|
end
|
@ -0,0 +1,32 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen <%= @server_port %> ssl;
|
||||||
|
server_name <%= @server_name %> <%= @server_aliases.join(" ") %>;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/<%= @server_name %>.access.log;
|
||||||
|
error_log /var/log/nginx/<%= @server_name %>.error.log;
|
||||||
|
|
||||||
|
root <%= @docroot %>;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$args;
|
||||||
|
set $redirect_to_ssl "no";
|
||||||
|
if ($ssl_protocol = "") {
|
||||||
|
set $redirect_to_ssl "yes";
|
||||||
|
}
|
||||||
|
if ($redirect_to_ssl = yes) {
|
||||||
|
rewrite ^(.*) https://$host$1 permanent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass 127.0.0.1:9001;
|
||||||
|
fastcgi_param SCRIPT_FILENAME <%= @docroot %>$fastcgi_script_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssl_certificate <%= @ssl_cert %>;
|
||||||
|
ssl_certificate_key <%= @ssl_key %>;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user