54d8f7df75
Port the WordPress Native template to Fedora 20. Fedora 20 images have a bug with mariadb which requires an ugly workaround for the time being. Change-Id: Ia3473d05ca756171d8720452790c21c8cac3df7f
122 lines
4.3 KiB
YAML
122 lines
4.3 KiB
YAML
heat_template_version: 2013-05-23
|
|
|
|
description: >
|
|
Heat WordPress template to support F20, using only Heat OpenStack-native
|
|
resource types, and without the requirement for heat-cfntools in the image.
|
|
WordPress is web software you can use to create a beautiful website or blog.
|
|
This template installs a single-instance WordPress deployment using a local
|
|
MySQL database to store the data.
|
|
|
|
parameters:
|
|
|
|
key_name:
|
|
type: string
|
|
description : Name of a KeyPair to enable SSH access to the instance
|
|
instance_type:
|
|
type: string
|
|
description: Instance type for WordPress server
|
|
default: m1.small
|
|
constraints:
|
|
- allowed_values: [m1.small, m1.medium, m1.large]
|
|
description: instance_type must be one of m1.small, m1.medium or m1.large
|
|
image_id:
|
|
type: string
|
|
description: ID of the image to use for the WordPress server
|
|
default: Fedora-x86_64-20-20131211.1-sda
|
|
constraints:
|
|
- allowed_values: [ Fedora-i386-20-20131211.1-sda, Fedora-x86_64-20-20131211.1-sda ]
|
|
description: >
|
|
Image ID must be either Fedora-i386-20-20131211.1-sda or Fedora-x86_64-20-20131211.1-sda
|
|
db_name:
|
|
type: string
|
|
description: WordPress database name
|
|
default: wordpress
|
|
constraints:
|
|
- length: { min: 1, max: 64 }
|
|
description: db_name must be between 1 and 64 characters
|
|
- allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*'
|
|
description: >
|
|
db_name must begin with a letter and contain only alphanumeric
|
|
characters
|
|
db_username:
|
|
type: string
|
|
description: The WordPress database admin account username
|
|
default: admin
|
|
hidden: true
|
|
constraints:
|
|
- length: { min: 1, max: 16 }
|
|
description: db_username must be between 1 and 64 characters
|
|
- allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*'
|
|
description: >
|
|
db_username must begin with a letter and contain only alphanumeric
|
|
characters
|
|
db_password:
|
|
type: string
|
|
description: The WordPress database admin account password
|
|
default: admin
|
|
hidden: true
|
|
constraints:
|
|
- length: { min: 1, max: 41 }
|
|
description: db_username must be between 1 and 64 characters
|
|
- allowed_pattern: '[a-zA-Z0-9]*'
|
|
description: db_password must contain only alphanumeric characters
|
|
db_root_password:
|
|
type: string
|
|
description: Root password for MySQL
|
|
default: admin
|
|
hidden: true
|
|
constraints:
|
|
- length: { min: 1, max: 41 }
|
|
description: db_username must be between 1 and 64 characters
|
|
- allowed_pattern: '[a-zA-Z0-9]*'
|
|
description: db_password must contain only alphanumeric characters
|
|
|
|
resources:
|
|
wordpress_instance:
|
|
type: OS::Nova::Server
|
|
properties:
|
|
image: { get_param: image_id }
|
|
flavor: { get_param: instance_type }
|
|
key_name: { get_param: key_name }
|
|
user_data:
|
|
str_replace:
|
|
template: |
|
|
#!/bin/bash -v
|
|
|
|
yum -y install mariadb mariadb-server httpd wordpress
|
|
touch /var/log/mariadb/mariadb.log
|
|
chown mysql.mysql /var/log/mariadb/mariadb.log
|
|
systemctl start mariadb.service
|
|
|
|
# Setup MySQL root password and create a user
|
|
mysqladmin -u root password db_rootpassword
|
|
cat << EOF | mysql -u root --password=db_rootpassword
|
|
CREATE DATABASE db_name;
|
|
GRANT ALL PRIVILEGES ON db_name.* TO "db_user"@"localhost"
|
|
IDENTIFIED BY "db_password";
|
|
FLUSH PRIVILEGES;
|
|
EXIT
|
|
EOF
|
|
|
|
sed -i "/Deny from All/d" /etc/httpd/conf.d/wordpress.conf
|
|
sed -i "s/Require local/Require all granted/" /etc/httpd/conf.d/wordpress.conf
|
|
sed -i s/database_name_here/db_name/ /etc/wordpress/wp-config.php
|
|
sed -i s/username_here/db_user/ /etc/wordpress/wp-config.php
|
|
sed -i s/password_here/db_password/ /etc/wordpress/wp-config.php
|
|
|
|
systemctl start httpd.service
|
|
params:
|
|
db_rootpassword: { get_param: db_root_password }
|
|
db_name: { get_param: db_name }
|
|
db_user: { get_param: db_username }
|
|
db_password: { get_param: db_password }
|
|
|
|
outputs:
|
|
WebsiteURL:
|
|
description: URL for Wordpress wiki
|
|
value:
|
|
str_replace:
|
|
template: http://host/wordpress
|
|
params:
|
|
host: { get_attr: [wordpress_instance, first_address] }
|