murano-apps/CloudFoundry/package/Classes/CloudFoundry.yaml

101 lines
4.0 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.paas
std: io.murano
res: io.murano.resources
sys: io.murano.system
Name: CloudFoundry
Extends: std:Application
Properties:
instance:
Contract: $.class(res:Instance).notNull()
Methods:
.init:
Body:
- $._environment: $.find(std:Environment).require()
deploy:
Body:
- If: not $.getAttr(deployed, false)
Then:
- $._environment.reporter.report($this, 'Creating VM for CloudFoundry ')
- $securityGroupIngress:
- ToPort: 80
FromPort: 80
IpProtocol: tcp
External: true
- ToPort: 65535
FromPort: 1024
IpProtocol: tcp
External: true
- ToPort: 443
FromPort: 443
IpProtocol: tcp
External: true
- $._environment.securityGroupManager.addGroupIngress($securityGroupIngress)
- $.instance.deploy()
- $resources: new(sys:Resources)
#NOTE(ddovbii) This is workaround which forbids installing CF to non-Ubuntu images
#As soon as we have the ability to filter images by distribution type
#(https://blueprints.launchpad.net/murano/+spec/better-image-filtering)
#this workaround should be deleted
- $template: $resources.yaml('CheckOS.template')
- $os: $.instance.agent.call($template, $resources)
- If: not $os.startsWith('Ubuntu 14.04')
Then:
- $msg: 'Unable to deploy. Only Ubuntu 14.04 is supported'
- $._environment.reporter.report_error($this, $msg)
- Throw: UnsupportedDistributionVersion
Message: $msg
#All steps below actually follow the process in ./scripts/install.sh
# Just add more interactivity to provide status
# Install Ruby part
- $template: $resources.yaml('InstallRuby.template')
- $._environment.reporter.report($this, '[1/6] Installing Ruby...')
- $.instance.agent.call($template, $resources, 3600)
#Clone base repos
- $template: $resources.yaml('CloneRepos.template')
- $._environment.reporter.report($this, '[2/6]Cloning git repositories for BOSH and cf-release...')
- $.instance.agent.call($template, $resources, 3600)
#Install Environment
- $template: $resources.yaml('InstallEnvironment.template')
- $._environment.reporter.report($this, '[3/6]Install Environment...')
- $.instance.agent.call($template, $resources, 3600)
#Install CF release
- $template: $resources.yaml('InstallCFRelease.template')
- $._environment.reporter.report($this, '[4/6]Installing cf-release...')
- $.instance.agent.call($template, $resources, 7200)
#Install CF CLI
- $template: $resources.yaml('InstallCFcli.template')
- $._environment.reporter.report($this, '[5/6]Installing CF CLI...')
- $.instance.agent.call($template, $resources, 600)
- $template: $resources.yaml('StartCloudFoundry.template')
- $._environment.reporter.report($this, '[6/6]Start CloudFoundry services...')
- $result: $.instance.agent.call($template, $resources, 3600)
- $._environment.reporter.report($this, 'CloudFoundry is started')
- $._environment.reporter.report($this, $result)
- $.setAttr(deployed, true)