d501d84dbe
This patch adds Bursting Apache application to demontrate capabilities to deploy scalable applications in different regions Change-Id: Id3c5a355c9e110b0b6fbf6e2b567c40059d39c82
78 lines
2.2 KiB
YAML
78 lines
2.2 KiB
YAML
# 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.
|
|
|
|
Namespaces:
|
|
=: com.example.apache
|
|
apps: io.murano.applications
|
|
conf: io.murano.configuration
|
|
res: io.murano.resources
|
|
std: io.murano
|
|
sys: io.murano.system
|
|
|
|
|
|
Name: BurstingApacheHttpServer
|
|
|
|
Extends:
|
|
- apps:MultiServerApplicationWithScaling
|
|
- apps:OpenStackSecurityConfigurable
|
|
|
|
Properties:
|
|
enablePHP:
|
|
Contract: $.bool()
|
|
Default: false
|
|
|
|
Methods:
|
|
getSecurityRules:
|
|
Body:
|
|
- Return:
|
|
- ToPort: 80
|
|
FromPort: 80
|
|
IpProtocol: tcp
|
|
External: true
|
|
- ToPort: 443
|
|
FromPort: 443
|
|
IpProtocol: tcp
|
|
External: true
|
|
|
|
onInstallServer:
|
|
Arguments:
|
|
- server:
|
|
Contract: $.class(res:Instance).notNull()
|
|
- serverGroup:
|
|
Contract: $.class(apps:ServerGroup).notNull()
|
|
Body:
|
|
- $file: sys:Resources.string('deployApache.sh')
|
|
- conf:Linux.runCommand($server.agent, $file)
|
|
- If: $this.enablePHP
|
|
Then:
|
|
- conf:Linux.runCommand($server.agent, "sudo apt-get -y install php5")
|
|
|
|
onCompleteConfiguration:
|
|
Arguments:
|
|
- servers:
|
|
Contract:
|
|
- $.class(res:Instance).notNull()
|
|
- serverGroup:
|
|
Contract: $.class(apps:ServerGroup).notNull()
|
|
- failedServers:
|
|
Contract:
|
|
- $.class(res:Instance).notNull()
|
|
Body:
|
|
- $ips: $serverGroup.getServers().selectMany(
|
|
switch(
|
|
$.assignFloatingIp => [$.floatingIpAddress],
|
|
true => $.ipAddresses
|
|
)).select(format('http://{0}', $)).join(', ')
|
|
|
|
- $this.find(std:Environment).require().reporter.report($this, format('Apache is available at {0}', $ips))
|
|
|