Add image requirements to CF app

This patch adds image restrictions to CF application due to
installer requirements:
https://github.com/yudai/cf_nise_installer#requirements
Now deployment will be terminated if user starts it with
non-Ubuntu image.

README file describing requirements also was added.

Change-Id: Ia9e45fccbe22688c3daeabecfbb9d09c234494dd
Related-Bug: #1453583
This commit is contained in:
Dmytro Dovbii 2015-09-18 16:40:49 +03:00
parent 015807c607
commit 7af9b4e850
5 changed files with 98 additions and 11 deletions

View File

@ -30,13 +30,13 @@ Properties:
Methods:
initialize:
Body:
- $.environment: $.find(std:Environment).require()
- $._environment: $.find(std:Environment).require()
deploy:
Body:
- If: not $.getAttr(deployed, false)
Then:
- $.environment.reporter.report($this, 'Creating VM for CloudFoundry ')
- $._environment.reporter.report($this, 'Creating VM for CloudFoundry ')
- $securityGroupIngress:
- ToPort: 80
FromPort: 80
@ -50,39 +50,53 @@ Methods:
FromPort: 443
IpProtocol: tcp
External: true
- $.environment.securityGroupManager.addGroupIngress($securityGroupIngress)
- $._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...')
- $._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...')
- $._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...')
- $._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...')
- $._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...')
- $._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...')
- $._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)
- $._environment.reporter.report($this, 'CloudFoundry is started')
- $._environment.reporter.report($this, $result)
- $.setAttr(deployed, True)

View File

@ -0,0 +1,19 @@
=============
Cloud Foundry
=============
Cloud Foundry is an open platform as a service, providing a choice of clouds,
developer frameworks, and application services. Cloud Foundry makes it faster
and easier to build, test, deploy, and scale applications. It is an open source
project and is available through a variety of private cloud distributions and
public cloud instances.
This package deploys Cloud Foundry v2 in a single VM instance using cf_nise_installer:
https://github.com/yudai/cf_nise_installer
### Requirements
* Ubuntu 14.04 64bit (Trusty)
* 8GB+ free HDD space
* 2GB+ memory

View File

@ -0,0 +1,28 @@
# 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: Check OS Distribution
Body: |
return checkOS().stdout
Scripts:
checkOS:
Type: Application
Version: 1.0.0
EntryPoint: checkOS.sh
Options:
captureStdout: true
captureStderr: true

View File

@ -0,0 +1,22 @@
#!/bin/bash
# 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.
command_exists() {
command -v "$@" > /dev/null 2>&1
}
if command_exists lsb_release; then
lsb_release -sd
else
echo "unknown version"
fi

View File

@ -68,6 +68,10 @@ Forms:
- name: flavor
type: flavor
label: Instance flavor
requirements:
min_disk: 8
min_vcpus: 2
min_memory_mb: 2048
description: >-
Select registered in Openstack flavor. Consider that application performance
depends on this parameter.