Merge "Create a TOSCA CSAR for Wordpress template"
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
tosca_definitions_version: tosca_simple_1.0
|
||||
|
||||
description: >
|
||||
TOSCA simple profile with wordpress, web server and mysql on the same server.
|
||||
|
||||
imports:
|
||||
- wordpress.yaml
|
||||
|
||||
inputs:
|
||||
cpus:
|
||||
type: integer
|
||||
description: Number of CPUs for the server.
|
||||
constraints:
|
||||
- valid_values: [ 1, 2, 4, 8 ]
|
||||
db_name:
|
||||
type: string
|
||||
description: The name of the database.
|
||||
db_user:
|
||||
type: string
|
||||
description: The user name of the DB user.
|
||||
db_pwd:
|
||||
type: string
|
||||
description: The WordPress database admin account password.
|
||||
db_root_pwd:
|
||||
type: string
|
||||
description: Root password for MySQL.
|
||||
db_port:
|
||||
type: integer
|
||||
description: Port for the MySQL database.
|
||||
|
||||
node_templates:
|
||||
wordpress:
|
||||
type: tosca.nodes.WebApplication.WordPress
|
||||
requirements:
|
||||
- host: webserver
|
||||
- database_endpoint: mysql_database
|
||||
interfaces:
|
||||
tosca.interfaces.node.Lifecycle:
|
||||
create: Scripts/WordPress/install.sh
|
||||
configure:
|
||||
implementation: Scripts/WordPress/configure.sh
|
||||
input:
|
||||
wp_db_name: { get_property: [ mysql_database, db_name ] }
|
||||
wp_db_user: { get_property: [ mysql_database, db_user ] }
|
||||
wp_db_password: { get_property: [ mysql_database, db_password ] }
|
||||
|
||||
mysql_database:
|
||||
type: tosca.nodes.Database
|
||||
properties:
|
||||
db_name: { get_input: db_name }
|
||||
db_user: { get_input: db_user }
|
||||
db_password: { get_input: db_pwd }
|
||||
requirements:
|
||||
- host: mysql_dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.Lifecycle:
|
||||
configure:
|
||||
implementation: Scripts/MYSQLDatabase/configure.sh
|
||||
input:
|
||||
db_name: { get_property: [ SELF, db_name ] }
|
||||
db_user: { get_property: [ SELF, db_user ] }
|
||||
db_password: { get_property: [ SELF, db_password ] }
|
||||
db_root_password: { get_property: [ mysql_dbms, dbms_root_password ] }
|
||||
|
||||
mysql_dbms:
|
||||
type: tosca.nodes.DBMS
|
||||
properties:
|
||||
dbms_root_password: { get_input: db_root_pwd }
|
||||
dbms_port: { get_input: db_port }
|
||||
requirements:
|
||||
- host: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.Lifecycle:
|
||||
create: Scripts/MYSQLDBMS/install.sh
|
||||
start: Scripts/MYSQLDBMS/start.sh
|
||||
configure:
|
||||
implementation: Scripts/MYSQLDBMS/configure.sh
|
||||
input:
|
||||
db_root_password: { get_property: [ mysql_dbms, dbms_root_password ] }
|
||||
|
||||
webserver:
|
||||
type: tosca.nodes.WebServer
|
||||
requirements:
|
||||
- host: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.Lifecycle:
|
||||
create: Scripts/WebServer/install.sh
|
||||
start: Scripts/WebServer/start.sh
|
||||
|
||||
server:
|
||||
type: tosca.nodes.Compute
|
||||
properties:
|
||||
# compute properties (flavor)
|
||||
disk_size: 10
|
||||
num_cpus: { get_input: cpus }
|
||||
mem_size: 4096
|
||||
# host image properties
|
||||
os_arch: x86_64
|
||||
os_type: Linux
|
||||
os_distribution: Fedora
|
||||
os_version: 18
|
||||
|
||||
outputs:
|
||||
website_url:
|
||||
description: IP address for Wordpress wiki.
|
||||
value: { get_attribute: [server, ip_address] }
|
||||
@@ -0,0 +1,25 @@
|
||||
tosca_definitions_version: tosca_simple_1.0
|
||||
|
||||
node_types:
|
||||
tosca.nodes.WebApplication.WordPress:
|
||||
derived_from: tosca.nodes.WebApplication
|
||||
properties:
|
||||
admin_user:
|
||||
required: no
|
||||
type: string
|
||||
admin_password:
|
||||
required: no
|
||||
type: string
|
||||
requirements:
|
||||
- database_endpoint: tosca.nodes.Database
|
||||
interfaces:
|
||||
tosca.interfaces.node.Lifecycle:
|
||||
inputs:
|
||||
db_port:
|
||||
type: integer
|
||||
db_name:
|
||||
type: string
|
||||
db_user:
|
||||
type: string
|
||||
db_password:
|
||||
type: string
|
||||
@@ -0,0 +1,22 @@
|
||||
README:
|
||||
|
||||
This CSAR contains all definitions that are required for deploying WordPress
|
||||
and MySQL on a single compute instance.
|
||||
|
||||
Entry information for processing through an orchestrator is contained in file
|
||||
TOSCA-Metadata/TOSCA.meta. This file provides high-level information such as
|
||||
CSAR version or creator of the CSAR. Furthermore, it provides pointers to the
|
||||
various TOSCA definitions files that contain the real details.
|
||||
The entry 'Entry-Definitions' points to the definitions file which holds the
|
||||
service template for the workload.
|
||||
'Entry-Definitions' is optional. An orchestrator can also process the contents
|
||||
like this:
|
||||
1) Read in and process each definitions file.
|
||||
2) For each definitions file:
|
||||
2.1) Read in all * type definitions (node types, capability types, etc.) and
|
||||
store them in an internal map
|
||||
3) Verify and build dependencies (e.g. inheritance) between all type definitions
|
||||
previously read in. Orchestrator built-in types (e.g. TOSCA base types) are
|
||||
also considered in this step.
|
||||
4) Process the actual service template (the file with a node_templates section).
|
||||
Validate using previously obtained type information.
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh -x
|
||||
# Set the MySQL server root password
|
||||
mysqladmin -u root password db_root_password
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh -x
|
||||
yum -y install mysql mysql-server
|
||||
# Use systemd to start MySQL server at system boot time
|
||||
#systemctl enable mysqld.service
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh -x
|
||||
# Start the MySQL service (NOTE: may already be started at image boot time)
|
||||
systemctl start mysqld.service
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh -x
|
||||
# Setup MySQL root password and create user
|
||||
cat << EOF | mysql -u root --password=db_root_password
|
||||
CREATE DATABASE db_name;
|
||||
GRANT ALL PRIVILEGES ON db_name.* TO "db_user"@"localhost"
|
||||
IDENTIFIED BY "db_password";
|
||||
FLUSH PRIVILEGES;
|
||||
EXIT
|
||||
EOF
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh -x
|
||||
yum -y install httpd
|
||||
systemctl enable httpd.service
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh -x
|
||||
# Start the httpd service (NOTE: may already be started at image boot time)
|
||||
systemctl start httpd.service
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh -x
|
||||
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/wp_db_name/ /etc/wordpress/wp-config.php
|
||||
sed -i s/username_here/wp_db_user/ /etc/wordpress/wp-config.php
|
||||
sed -i s/password_here/wp_db_password/ /etc/wordpress/wp-config.php
|
||||
systemctl restart httpd.service
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh -x
|
||||
yum -y install wordpress
|
||||
@@ -0,0 +1,8 @@
|
||||
TOSCA-Meta-File-Version: 1.0
|
||||
CSAR-Version: 1.1
|
||||
Created-By: OASIS TOSCA TC
|
||||
Entry-Definitions: Definitions/wordpress_mysql_single_instance.yaml
|
||||
|
||||
Name: Definitions/tosca_single_instance_wordpress.yaml
|
||||
Content-Type: application/vnd.oasis.tosca.definitions.yaml
|
||||
|
||||
Reference in New Issue
Block a user