[WordPress] Use simple software configuration
Change-Id: If7e254ed03d040ce6348dc7094b57ccd35c55ca9 Partially-Implements: bp refactor-apps-scripts
This commit is contained in:
parent
3b51222b09
commit
2fbbb04b20
@ -16,6 +16,7 @@ Namespaces:
|
||||
sys: io.murano.system
|
||||
db: io.murano.databases
|
||||
srv: io.murano.apps.apache
|
||||
conf: io.murano.configuration
|
||||
|
||||
Name: WordPress
|
||||
|
||||
@ -59,11 +60,9 @@ Methods:
|
||||
- Throw: DependencyMissingError
|
||||
Message: $msg
|
||||
|
||||
- $resources: new(sys:Resources)
|
||||
|
||||
# Deploy Wordpress
|
||||
- $template: $resources.yaml('DeployWordPress.template')
|
||||
- $.server.instance.agent.call($template, $resources)
|
||||
- $file: sys:Resources.string('deployWordPress.sh')
|
||||
- conf:Linux.runCommand($.server.instance.agent, $file)
|
||||
|
||||
# Configure access to MySql
|
||||
- $._environment.reporter.report($this, 'Ensuring Database is deployed.')
|
||||
@ -71,18 +70,19 @@ Methods:
|
||||
- $.database.createUser($.dbUser, $.dbPassword)
|
||||
- $.database.assignUser($.dbUser, $.dbName)
|
||||
- $._environment.reporter.report($this, 'Configure access to MySql.')
|
||||
- $template: $resources.yaml('ConfigureAccessToMySql.template').bind(dict(
|
||||
database => $.dbName,
|
||||
username => $.dbUser,
|
||||
password => $.dbPassword,
|
||||
host => $.database.instance.ipAddresses[0]
|
||||
))
|
||||
- $.server.instance.agent.call($template, $resources)
|
||||
- $replacements:
|
||||
"%DATABASE%": $.dbName
|
||||
"%USERNAME%": $.dbUser
|
||||
"%HOST%": $.database.instance.ipAddresses.first()
|
||||
"%PASSWORD%": $.dbPassword
|
||||
|
||||
- $file: sys:Resources.string('configureAccessToMySql.sh').replace($replacements)
|
||||
- conf:Linux.runCommand($.server.instance.agent, $file)
|
||||
|
||||
- If: $.monitoring != null
|
||||
Then:
|
||||
- $.monitoring.setUpAgent($.server.instance)
|
||||
|
||||
|
||||
- $._environment.reporter.report($this, 'Application is installed')
|
||||
- If: $.server.instance.assignFloatingIp
|
||||
Then:
|
||||
|
@ -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
|
@ -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
|
@ -12,9 +12,9 @@
|
||||
# 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_USER'.*$/define('DB_USER', '$2');/" -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_HOST'.*$/define('DB_HOST', '$4');/" -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', '%USERNAME%');/" -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', '%HOST%');/" -i /var/www/html/wordpress/wp-config.php
|
||||
|
||||
sudo service apache2 restart
|
Loading…
Reference in New Issue
Block a user