[WordPress] Use simple software configuration

Change-Id: If7e254ed03d040ce6348dc7094b57ccd35c55ca9
Partially-Implements: bp refactor-apps-scripts
This commit is contained in:
Dmytro Dovbii 2016-04-01 14:04:33 +03:00
parent 3b51222b09
commit 2fbbb04b20
5 changed files with 16 additions and 81 deletions

View File

@ -16,6 +16,7 @@ Namespaces:
sys: io.murano.system sys: io.murano.system
db: io.murano.databases db: io.murano.databases
srv: io.murano.apps.apache srv: io.murano.apps.apache
conf: io.murano.configuration
Name: WordPress Name: WordPress
@ -59,11 +60,9 @@ Methods:
- Throw: DependencyMissingError - Throw: DependencyMissingError
Message: $msg Message: $msg
- $resources: new(sys:Resources)
# Deploy Wordpress # Deploy Wordpress
- $template: $resources.yaml('DeployWordPress.template') - $file: sys:Resources.string('deployWordPress.sh')
- $.server.instance.agent.call($template, $resources) - conf:Linux.runCommand($.server.instance.agent, $file)
# Configure access to MySql # Configure access to MySql
- $._environment.reporter.report($this, 'Ensuring Database is deployed.') - $._environment.reporter.report($this, 'Ensuring Database is deployed.')
@ -71,18 +70,19 @@ Methods:
- $.database.createUser($.dbUser, $.dbPassword) - $.database.createUser($.dbUser, $.dbPassword)
- $.database.assignUser($.dbUser, $.dbName) - $.database.assignUser($.dbUser, $.dbName)
- $._environment.reporter.report($this, 'Configure access to MySql.') - $._environment.reporter.report($this, 'Configure access to MySql.')
- $template: $resources.yaml('ConfigureAccessToMySql.template').bind(dict( - $replacements:
database => $.dbName, "%DATABASE%": $.dbName
username => $.dbUser, "%USERNAME%": $.dbUser
password => $.dbPassword, "%HOST%": $.database.instance.ipAddresses.first()
host => $.database.instance.ipAddresses[0] "%PASSWORD%": $.dbPassword
))
- $.server.instance.agent.call($template, $resources) - $file: sys:Resources.string('configureAccessToMySql.sh').replace($replacements)
- conf:Linux.runCommand($.server.instance.agent, $file)
- If: $.monitoring != null - If: $.monitoring != null
Then: Then:
- $.monitoring.setUpAgent($.server.instance) - $.monitoring.setUpAgent($.server.instance)
- $._environment.reporter.report($this, 'Application is installed') - $._environment.reporter.report($this, 'Application is installed')
- If: $.server.instance.assignFloatingIp - If: $.server.instance.assignFloatingIp
Then: Then:

View File

@ -1,34 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
FormatVersion: 2.0.0
Version: 1.0.0
Name: Configure database access credentails
Parameters:
database: $database
username: $username
password: $password
host: $host
Body: |
return configure('{0} {1} {2} {3}'.format(args.database, args.username, args.password, args.host)).stdout
Scripts:
configure:
Type: Application
Version: 1.0.0
EntryPoint: configureAccessToMySql.sh
Files: []
Options:
captureStdout: true
captureStderr: true

View File

@ -1,31 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
FormatVersion: 2.0.0
Version: 1.0.0
Name: Deploy WordPress
Parameters:
appName: $appName
Body: |
return deploy(args.appName).stdout
Scripts:
deploy:
Type: Application
Version: 1.0.0
EntryPoint: deployWordPress.sh
Files: []
Options:
captureStdout: true
captureStderr: true

View File

@ -12,9 +12,9 @@
# under the License. # under the License.
sudo sed -e "s/define('DB_NAME'.*$/define('DB_NAME', '$1');/" -i /var/www/html/wordpress/wp-config.php sudo sed -e "s/define('DB_NAME'.*$/define('DB_NAME', '%DATABASE%');/" -i /var/www/html/wordpress/wp-config.php
sudo sed -e "s/define('DB_USER'.*$/define('DB_USER', '$2');/" -i /var/www/html/wordpress/wp-config.php sudo sed -e "s/define('DB_USER'.*$/define('DB_USER', '%USERNAME%');/" -i /var/www/html/wordpress/wp-config.php
sudo sed -e "s/define('DB_PASSWORD'.*$/define('DB_PASSWORD', '$3');/" -i /var/www/html/wordpress/wp-config.php sudo sed -e "s/define('DB_PASSWORD'.*$/define('DB_PASSWORD', '%PASSWORD%');/" -i /var/www/html/wordpress/wp-config.php
sudo sed -e "s/define('DB_HOST'.*$/define('DB_HOST', '$4');/" -i /var/www/html/wordpress/wp-config.php sudo sed -e "s/define('DB_HOST'.*$/define('DB_HOST', '%HOST%');/" -i /var/www/html/wordpress/wp-config.php
sudo service apache2 restart sudo service apache2 restart