diff --git a/BIND/package/Classes/Bind.yaml b/BIND/package/Classes/Bind.yaml index 6f8cbe65..1f5b2d7c 100644 --- a/BIND/package/Classes/Bind.yaml +++ b/BIND/package/Classes/Bind.yaml @@ -32,39 +32,19 @@ Properties: Contract: $.string().notNull() Usage: InOut - privateIp: - Contract: $.string() - Usage: Out - - Methods: .init: Body: - $.environment: $.find(std:Environment).require() - - $.dnsSecKey: base64encode($.dnsSecKey) _createReplacements: Body: - Return: "%PUBLIC_IP%": $.instance.floatingIpAddress - "%PRIVATE_IP%": $.privateIp + "%PRIVATE_IP%": $.instance.joinedNetworks.first().ipList.where($ != $this.instance.floatingIpAddress).first() "%ZONE%": $.zoneName "%DNSSEC_KEY%": $.dnsSecKey - "%PRIVATE_NETWORK_CIDR%": $.environment.defaultNetworks.environment.describe().cidr - - _getIp4ForNetwork: - #Works only for IPv4 network with 255.255.255.0 netmask - Arguments: - - network: - Contract: $.class(res:NeutronNetwork).notNull() - Body: - - $gateIp: $network.describe().gateway - - $netAddr: $gateIp.split('.').take(3) - - Return: $.instance.ipAddresses.where(list($.split('.').take(3)) = $netAddr).first(null) - - _getPrivateIp: - Body: - - Return: $._getIp4ForNetwork($.environment.defaultNetworks.environment) + "%PRIVATE_NETWORK_CIDR%": $.instance.joinedNetworks.first().network.describe().cidr _addSecurityGroupRules: Body: @@ -88,7 +68,6 @@ Methods: - $._addSecurityGroupRules() - $.instance.deploy() - $._report('Run install script') - - $.privateIp: $._getPrivateIp() - $replacements: $._createReplacements() - $file: sys:Resources.string('deployBind.sh').replace($replacements) - conf:Linux.runCommand($.instance.agent, $file) diff --git a/BIND/package/UI/ui.yaml b/BIND/package/UI/ui.yaml index 8ffdecb3..81d42b9e 100644 --- a/BIND/package/UI/ui.yaml +++ b/BIND/package/UI/ui.yaml @@ -54,11 +54,11 @@ Forms: Enter zone name for BIND installation - name: dnsSecKey type: string - label: DNSSEC Key + label: DNSSEC Key (Base64-encoded) initial: >- - HNujJGI+ELhlIVa6a+h1L0/2XQTbU9RaH+/F7pOQmDfKWTGc58h0rHNjnIQtms5SBQsC6lni1Kcwq8s+3W4TmA + SE51akpHSStFTGhsSVZhNmEraDFMMC8yWFFUYlU5UmFIKy9GN3BPUW1EZktXVEdjNThoMHJITmpuSVF0bXM1U0JRc0M2bG5pMUtjd3E4cyszVzRUbUEK description: >- - Enter DNSSEC private key. This key will be used for update DNS records via DNSSEC. + Enter DNSSEC private key (Base64-encoded). This key will be used for update DNS records via DNSSEC. - instanceConfiguration: @@ -104,9 +104,9 @@ Forms: type: string label: Instance Naming Pattern required: false - initial: BIND + initial: BIND# maxLength: 64 - regexpValidator: '^[a-zA-z][-_\w]*$' + regexpValidator: '^[a-zA-z][_\w#-]*$' errorMessages: invalid: Just letters, numbers, underscores and hyphens are allowed. helpText: Just letters, numbers, underscores and hyphens are allowed. diff --git a/Clearwater/package/Classes/Clearwater.yaml b/Clearwater/package/Classes/Clearwater.yaml index 9504b4d1..01343139 100644 --- a/Clearwater/package/Classes/Clearwater.yaml +++ b/Clearwater/package/Classes/Clearwater.yaml @@ -13,27 +13,23 @@ Namespaces: =: com.mirantis.clearwater std: io.murano + res: io.murano.resources + meta: io.murano.metadata dns: com.mirantis.network.dns cwBase: com.mirantis.clearwater.components.base components: com.mirantis.clearwater.components + Name: Clearwater Extends: std:Application Properties: - keypair: - Contract: $.string() - osImageName: - Contract: $.string().notNull() - flavorName: - Contract: $.string().notNull() dnsApp: Contract: $.class(dns:Bind).notNull() - ellis: - Contract: $.class(components:Ellis) - Usage: Out + instanceTemplate: + Contract: $.template(res:LinuxInstance) components: Contract: - $.class(cwBase:ClearwaterComponentBase).notNull() @@ -42,19 +38,33 @@ Properties: Contract: $.string().notNull() Default: "" Usage: Out + bonoClusterSize: + Contract: $.int().notNull() + Default: 1 + sproutClusterSize: + Contract: $.int().notNull() + Default: 1 + homerClusterSize: + Contract: $.int().notNull() + Default: 1 + homesteadClusterSize: + Contract: $.int().notNull() + Default: 1 Methods: .init: Body: - $._environment: $.find(std:Environment).require() - - $.ellis: new(components:Ellis, $this) - - $.components: - - new(components:Bono, $this) - - new(components:Sprout, $this) - - new(components:Homer, $this) - - new(components:Ralf, $this) - - new(components:Homestead, $this) + - If: not $.components + Then: + - $.components: + - new(components:Ellis, $this, 'Ellis') + - new(components:Ralf, $this, Ralf, allowedFailures => 'quorum') + - new(components:Bono, $this, Bono, allowedFailures => 'quorum', clusterSize => $this.bonoClusterSize) + - new(components:Sprout, $this, Sprout, allowedFailures => 'quorum', clusterSize => $this.sproutClusterSize) + - new(components:Homer, $this, Homer, allowedFailures => 'quorum', clusterSize => $this.homerClusterSize) + - new(components:Homestead, $this, Homestead, allowedFailures => 'quorum', clusterSize => $this.homesteadClusterSize) getSecurityGroupRules: Body: @@ -88,19 +98,14 @@ Methods: deploy: Body: - - If: not $.getAttr(deployed, false) - Then: - - $._report('Start Clearwater deploy') - - $._environment.securityGroupManager.addGroupIngress($.getSecurityGroupRules()) - - $.dnsApp.deploy() - - $.ellis.deploy() - - $.components.pselect($.deploy()) - - $._report('Clearwater deployed') - - $._report(format('Use Ellis at {0} for create account and manage identities', - $.ellis.instance.floatingIpAddress)) - - $._report(format('Outbound edge proxy IP is {0}', - $.components.where($ is components:Bono).first().instance.floatingIpAddress)) - - $.setAttr(deployed, true) + - $this._report('Start Clearwater deploy') + - $this._environment.securityGroupManager.addGroupIngress($this.getSecurityGroupRules()) + - $this.dnsApp.deploy() + - $this.components.pselect($.deploy()) + - $ellisFloatingIp: $this.components.where($ is components:Ellis).cluster.items.first().floatingIpAddress + - $this._report(format('Use Ellis at {0} for create account and manage identities', $ellisFloatingIp)) + - $edgeProxyIp: $this.components.where($ is components:Bono).first().cluster.items.first().floatingIpAddress + - $this._report(format('Outbound edge proxy IP is {0}', $edgeProxyIp)) _report: Arguments: @@ -109,3 +114,39 @@ Methods: Body: - $._environment.reporter.report($this, $message) + # Lifecycle management + + scaleOutSprout: + Meta: + - meta:Title: + text: "Scale out Sprout" + + Scope: Public + Body: + - $this.components.where($ is components:Sprout).first().scaleOut() + + scaleOutBono: + Meta: + - meta:Title: + text: "Scale out Bono" + Scope: Public + Body: + - $this.components.where($ is components:Bono).first().scaleOut() + + scaleOutHomestead: + Meta: + - meta:Title: + text: "Scale out Homestead" + Scope: Public + Body: + - $this.components.where($ is components:Homestead).first().scaleOut() + + scaleOutRalf: + Meta: + - meta:Title: + text: "Scale out Ralf" + Scope: Public + Body: + - $this.components.where($ is components:Ralf).first().scaleOut() + + diff --git a/Clearwater/package/Classes/components/Bono.yaml b/Clearwater/package/Classes/components/Bono.yaml index 651427fd..6aa6cdba 100644 --- a/Clearwater/package/Classes/components/Bono.yaml +++ b/Clearwater/package/Classes/components/Bono.yaml @@ -19,7 +19,7 @@ Name: Bono Extends: base:ClearwaterComponentBase Methods: - _createSecurityGroupRules: + getSecurityRules: Body: - $rules: # STUN/TURN @@ -55,9 +55,4 @@ Methods: FromPort: 32768 ToPort: 65535 External: true - - Return: $rules - - getDeployScriptName: - Body: - - Return: "deployBono.sh" - + - Return: $rules \ No newline at end of file diff --git a/Clearwater/package/Classes/components/Ellis.yaml b/Clearwater/package/Classes/components/Ellis.yaml index 6c368c62..725e5379 100644 --- a/Clearwater/package/Classes/components/Ellis.yaml +++ b/Clearwater/package/Classes/components/Ellis.yaml @@ -20,7 +20,7 @@ Extends: base:ClearwaterComponentBase Methods: - _createSecurityGroupRules: + getSecurityRules: Body: - $rules: # HTTP @@ -33,8 +33,4 @@ Methods: ToPort: 443 IpProtocol: udp External: true - - Return: $rules - - getDeployScriptName: - Body: - - Return: "deployEllis.sh" + - Return: $rules \ No newline at end of file diff --git a/Clearwater/package/Classes/components/Homer.yaml b/Clearwater/package/Classes/components/Homer.yaml index b3525c96..3640c5ae 100644 --- a/Clearwater/package/Classes/components/Homer.yaml +++ b/Clearwater/package/Classes/components/Homer.yaml @@ -19,7 +19,7 @@ Name: Homer Extends: base:ClearwaterComponentBase Methods: - _createSecurityGroupRules: + getSecurityRules: Body: - $rules: # Ut/HTTP @@ -41,9 +41,4 @@ Methods: ToPort: 9160 External: false - - Return: $rules - - getDeployScriptName: - Body: - - Return: "deployHomer.sh" - + - Return: $rules \ No newline at end of file diff --git a/Clearwater/package/Classes/components/Homestead.yaml b/Clearwater/package/Classes/components/Homestead.yaml index 78e4938e..67794343 100644 --- a/Clearwater/package/Classes/components/Homestead.yaml +++ b/Clearwater/package/Classes/components/Homestead.yaml @@ -19,7 +19,7 @@ Name: Homestead Extends: base:ClearwaterComponentBase Methods: - _createSecurityGroupRules: + getSecurityRules: Body: - $rules: # REST-ful Provisioning API @@ -45,9 +45,4 @@ Methods: FromPort: 7199 ToPort: 7199 External: false - - Return: $rules - - getDeployScriptName: - Body: - - Return: "deployHomestead.sh" - + - Return: $rules \ No newline at end of file diff --git a/Clearwater/package/Classes/components/Ralf.yaml b/Clearwater/package/Classes/components/Ralf.yaml index 38f7807f..c28255cd 100644 --- a/Clearwater/package/Classes/components/Ralf.yaml +++ b/Clearwater/package/Classes/components/Ralf.yaml @@ -19,7 +19,7 @@ Name: Ralf Extends: base:ClearwaterComponentBase Methods: - _createSecurityGroupRules: + getSecurityRules: Body: - $rules: # Rf-like/HTTP API @@ -46,9 +46,4 @@ Methods: FromPort: 11211 ToPort: 11211 External: false - - Return: $rules - - getDeployScriptName: - Body: - - Return: "deployRalf.sh" - + - Return: $rules \ No newline at end of file diff --git a/Clearwater/package/Classes/components/Sprout.yaml b/Clearwater/package/Classes/components/Sprout.yaml index b8952d64..0c293e94 100644 --- a/Clearwater/package/Classes/components/Sprout.yaml +++ b/Clearwater/package/Classes/components/Sprout.yaml @@ -19,7 +19,7 @@ Name: Sprout Extends: base:ClearwaterComponentBase Methods: - _createSecurityGroupRules: + getSecurityRules: Body: - $rules: # Internal SIP @@ -46,9 +46,4 @@ Methods: FromPort: 11211 ToPort: 11211 External: false - - Return: $rules - - getDeployScriptName: - Body: - - Return: "deploySprout.sh" - + - Return: $rules \ No newline at end of file diff --git a/Clearwater/package/Classes/components/base/ClearwaterComponentBase.yaml b/Clearwater/package/Classes/components/base/ClearwaterComponentBase.yaml index f25d6201..d6f858e7 100644 --- a/Clearwater/package/Classes/components/base/ClearwaterComponentBase.yaml +++ b/Clearwater/package/Classes/components/base/ClearwaterComponentBase.yaml @@ -16,107 +16,115 @@ Namespaces: res: io.murano.resources sys: io.murano.system conf: io.murano.configuration + apps: io.murano.applications cw: com.mirantis.clearwater + + Name: ClearwaterComponentBase +Extends: + - apps:SoftwareComponent + - apps:OpenStackSecurityConfigurable + Properties: - instance: - Contract: $.class(res:LinuxMuranoInstance) + clusterSize: + Contract: $.int().notNull() + Default: 1 + + cluster: + Contract: $.class(apps:ServerReplicationGroup) + Usage: Out + + serverProvider: + Contract: $.class(apps:TemplateServerProvider) Usage: Out Methods: - .init: - Body: - - $._environment: $.find(std:Environment).require() - - $._componentName: typeinfo($).name.split(".").last() - - $.parent: $.find(cw:Clearwater).require() - - getDeployScriptName: - - _createSecurityGroupRules: - - _createInstance: - Body: - - $instance: new(res:LinuxMuranoInstance, $this, - name => format($._componentName), - flavor => $.parent.flavorName, - image => $.parent.osImageName, - keyname => $.parent.keypair, - securityGroupName => $._environment.securityGroupManager.defaultGroupName, - assignFloatingIp => true) - - Return: $instance - - _setUp: - Body: - - $.privateNetwork: $._environment.defaultNetworks.environment - - $.instance: $._createInstance() - - _createReplacements: Arguments: - instance: - Contract: $.class(res:LinuxMuranoInstance).notNull() + Contract: $.class(res:LinuxInstance).notNull() + - index: + Contract: $.int().notNull() Body: + - $instancePrivateIp: $instance.joinedNetworks.first().ipList.where($ != $instance.floatingIpAddress).first() - Return: + "%INDEX%": $index "%PUBLIC_IP%": $instance.floatingIpAddress - "%PRIVATE_IP%": $.privateIp - "%PRIVATE_NETWORK_CIDR%": $.privateNetwork.describe().cidr - "%PRIVATE_NETWORK_GATEWAY%": $.privateNetwork.describe().gateway + "%PRIVATE_IP%": $instancePrivateIp + "%PRIVATE_NETWORK_CIDR%": $instance.joinedNetworks.first().network.describe().cidr + "%PRIVATE_NETWORK_GATEWAY%": $instance.joinedNetworks.first().network.describe().gateway "%ZONE%": $.parent.dnsApp.zoneName "%DNSSEC_KEY%": $.parent.dnsApp.dnsSecKey - "%DNS_PRIVATE_IP%": $.parent.dnsApp.privateIp - "%ETCD_IP%": $.parent.etcdClusterIp or $.privateIp + "%DNS_PRIVATE_IP%": $.parent.dnsApp.instance.joinedNetworks.first().ipList.where($ = $instance.floatingIpAddress).first() + "%ETCD_IP%": $.parent.etcdClusterIp or $instancePrivateIp - _getIp4ForNetwork: - #Works only for IPv4 network with 255.255.255.0 netmask + getDeployScriptName: + Body: + - Return: $this.componentName + '/deploy.sh' + + getConfigureScriptName: + Body: + - Return: $this.componentName + '/configure.sh' + + .init: + Body: + - $._environment: $.find(std:Environment).require() + - $.componentName: typeinfo($).name.split(".").last() + - $.parent: $.find(cw:Clearwater).require() + - $.serverProvider: $.serverProvider or new(apps:TemplateServerProvider, $this, + template => $.parent.instanceTemplate, + serverNamePattern => $this.componentName + "-{}") + - $.cluster: $.cluster or new(apps:ServerReplicationGroup, $this, + provider => $this.serverProvider, minItems => 1, numItems => $this.clusterSize) + + onInstallServer: Arguments: - - network: - Contract: $.class(res:NeutronNetwork).notNull() + - instance: + Contract: $.class(res:LinuxInstance).notNull() + - serverGroup: + Contract: $.class(apps:ServerReplicationGroup).notNull() Body: - - $gateIp: $network.describe().gateway - - $netAddr: $gateIp.split('.').take(3) - - Return: $.instance.ipAddresses.where(list($.split('.').take(3)) = $netAddr).first(null) + - $index: $serverGroup.getServers().indexWhere($.name = $instance.name) + - $instancePrivateIp: $instance.joinedNetworks.first().ipList.where($ != $instance.floatingIpAddress).first() + - If: not $.parent.etcdClusterIp + Then: + - $this.parent.setEtcdClusterIp($instancePrivateIp) + - $replacements: $._createReplacements($instance, $index) + - $file: sys:Resources.string($.getDeployScriptName()).replace($replacements) + - conf:Linux.runCommand($instance.agent, $file) - _getPrivateIp: - Body: - - Return: $._getIp4ForNetwork($.privateNetwork) - addSecurityGroupRules: + + onConfigureServer: Arguments: - - rules: - Contract: - - FromPort: $.int().notNull() - ToPort: $.int().notNull() - IpProtocol: $.string().notNull() - External: $.bool().notNull() - Ethertype: $.string().check($ in list(null, 'IPv4', 'IPv6')) + - instance: + Contract: $.class(res:LinuxInstance).notNull() + - serverGroup: + Contract: $.class(apps:ServerReplicationGroup).notNull() Body: - - $._environment.securityGroupManager.addGroupIngress($rules) + - $index: $serverGroup.getServers().indexWhere($.name = $instance.name) + - $instancePrivateIp: $instance.joinedNetworks.first().ipList.where($ != $instance.floatingIpAddress).first() + - $replacements: $._createReplacements($instance, $index) + - $file: sys:Resources.string($.getConfigureScriptName()).replace($replacements) + - conf:Linux.runCommand($instance.agent, $file) + deploy: Body: - - If: not $.getAttr(deployed, false) - Then: - - $._report(format('{0} deploy started', $._componentName)) - - $._setUp() - - $.addSecurityGroupRules($._createSecurityGroupRules()) - - $.instance.deploy() - - $.privateIp: $._getPrivateIp() - - $replacements: $._createReplacements($.instance) - - $file: sys:Resources.string($.getDeployScriptName()).replace($replacements) - - conf:Linux.runCommand($.instance.agent, $file) - - If: not $.parent.etcdClusterIp - Then: - - $.parent.setEtcdClusterIp($.privateIp) - - $._report(format('{0} deploy finished', $._componentName)) + - $this.deployAt($this.cluster) - _report: - Arguments: - - message: - Contract: $.string().notNull() + scaleOut: Body: - - $._environment.reporter.report($this, $message) + - $.report(format("Scale up {} cluster", $.componentName)) + - $this.cluster.scale(1) + - $this.deploy() + + scaleIn: + Body: + - $this.cluster.scale(-1) + - $this.deploy() diff --git a/Clearwater/package/Resources/Bono/configure.sh b/Clearwater/package/Resources/Bono/configure.sh new file mode 100644 index 00000000..1a9092ec --- /dev/null +++ b/Clearwater/package/Resources/Bono/configure.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +configure() { +set -x +# Function to give DNS record type and IP address for specified IP address +ip2rr() { +if echo "$1" | grep -q -e '[^0-9.]' ; then +echo AAAA "$1" +else +echo A "$1" +fi +} +# Update DNS +retries=0 +while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF +server %DNS_PRIVATE_IP% +update add bono-%INDEX%.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +update add %INDEX%.bono.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +update add %ZONE%. 30 $(ip2rr %PUBLIC_IP%) +update add %ZONE%. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.%ZONE%. +update add %ZONE%. 30 NAPTR 0 0 "s" "SIP+D2U" "" _sip._udp.%ZONE%. +update add _sip._tcp.%ZONE%. 30 SRV 0 0 5060 %INDEX%.bono.%ZONE%. +update add _sip._udp.%ZONE%. 30 SRV 0 0 5060 %INDEX%.bono.%ZONE%. +send +EOF +} && [ $retries -lt 10 ] +do +retries=$((retries + 1)) +echo 'nsupdate failed - retrying (retry '$retries')...' +sleep 5 +done +# Use the DNS server. +echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf +echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq +service dnsmasq force-reload +} + +# Log all output to file. +configure 2>&1|tee -a /var/log/clearwater-bono.log diff --git a/Clearwater/package/Resources/Bono/deploy.sh b/Clearwater/package/Resources/Bono/deploy.sh new file mode 100644 index 00000000..4519acb0 --- /dev/null +++ b/Clearwater/package/Resources/Bono/deploy.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +deploy() { +set -x + +# Configure the APT software source. +echo 'deb http://repo.cw-ngv.com/archive/repo101 binary/' > /etc/apt/sources.list.d/clearwater.list +curl -L http://repo.cw-ngv.com/repo_key | apt-key add - +apt-get update +# Configure /etc/clearwater/local_config. +mkdir -p /etc/clearwater +etcd_ip=%ETCD_IP% +[ -n "$etcd_ip" ] || etcd_ip=%PRIVATE_IP% +cat > /etc/clearwater/local_config << EOF +management_local_ip=%PRIVATE_IP% +local_ip=%PRIVATE_IP% +public_ip=%PUBLIC_IP% +public_hostname=%INDEX%.bono.%ZONE% +etcd_cluster=$etcd_ip +EOF + +# Now install the software. +DEBIAN_FRONTEND=noninteractive apt-get install bono --yes --force-yes +DEBIAN_FRONTEND=noninteractive apt-get install clearwater-config-manager --yes --force-yes +} + +# Log all output to file. +deploy 2>&1|tee -a /var/log/clearwater-bono.log diff --git a/Clearwater/package/Resources/Ellis/configure.sh b/Clearwater/package/Resources/Ellis/configure.sh new file mode 100644 index 00000000..a2d55ab0 --- /dev/null +++ b/Clearwater/package/Resources/Ellis/configure.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +configure() { +set -x +# Function to give DNS record type and IP address for specified IP address +ip2rr() { +if echo "$1" | grep -q -e '[^0-9.]' ; then +echo AAAA "$1" +else +echo A "$1" +fi +} +# Update DNS +retries=0 +while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF +server %DNS_PRIVATE_IP% +update add ellis-%INDEX%.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +update add ellis.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +send +EOF +} && [ $retries -lt 10 ] +do +retries=$((retries + 1)) +echo 'nsupdate failed - retrying (retry '$retries')...' +sleep 5 +done +# Use the DNS server. +echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf +echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq +service dnsmasq force-reload + + +} + +# Log all output to file. +configure 2>&1|tee -a /var/log/clearwater-ellis.log diff --git a/Clearwater/package/Resources/deployEllis.sh b/Clearwater/package/Resources/Ellis/deploy.sh similarity index 72% rename from Clearwater/package/Resources/deployEllis.sh rename to Clearwater/package/Resources/Ellis/deploy.sh index 08b92c09..4410aa5d 100644 --- a/Clearwater/package/Resources/deployEllis.sh +++ b/Clearwater/package/Resources/Ellis/deploy.sh @@ -2,6 +2,7 @@ deploy() { set -x + # Configure the APT software source. echo 'deb http://repo.cw-ngv.com/archive/repo101 binary/' > /etc/apt/sources.list.d/clearwater.list curl -L http://repo.cw-ngv.com/repo_key | apt-key add - @@ -9,15 +10,18 @@ apt-get update # Configure /etc/clearwater/local_config. mkdir -p /etc/clearwater etcd_ip=%PRIVATE_IP% +[ -n "$etcd_ip" ] || etcd_ip=%PRIVATE_IP% cat > /etc/clearwater/local_config << EOF local_ip=%PRIVATE_IP% public_ip=%PUBLIC_IP% -public_hostname=ellis-0.%ZONE% +public_hostname=ellis-%INDEX%.%ZONE% etcd_cluster=$etcd_ip EOF + # Now install the software. DEBIAN_FRONTEND=noninteractive apt-get install ellis --yes --force-yes DEBIAN_FRONTEND=noninteractive apt-get install clearwater-config-manager --yes --force-yes + # Wait until etcd is up and running before uploading the shared_config /usr/share/clearwater/clearwater-etcd/scripts/wait_for_etcd # Configure and upload /etc/clearwater/shared_config. @@ -43,41 +47,17 @@ turn_workaround=secret ellis_api_key=secret ellis_cookie_key=secret EOF + sudo /usr/share/clearwater/clearwater-config-manager/scripts/upload_shared_config # Tweak /etc/clearwater/shared_config to use homer's management hostname instead of signaling. # This works around https://github.com/Metaswitch/ellis/issues/153. -sed -e 's/^xdms_hostname=.*$/xdms_hostname=homer-0.%ZONE%:7888/g' -i /etc/clearwater/shared_config +sed -e 's/^xdms_hostname=.*$/xdms_hostname=homer-1.%ZONE%:7888/g' -i /etc/clearwater/shared_config sed -i 's|# server_names_hash_bucket_size.*|server_names_hash_bucket_size 64;|g' /etc/nginx/nginx.conf service clearwater-infrastructure restart service ellis stop # Allocate a allocate a pool of numbers to assign to users. /usr/share/clearwater/ellis/env/bin/python /usr/share/clearwater/ellis/src/metaswitch/ellis/tools/create_numbers.py --start 6505550000 --count 1000 --realm %ZONE% -# Function to give DNS record type and IP address for specified IP address -ip2rr() { -if echo "$1" | grep -q -e '[^0-9.]' ; then -echo AAAA "$1" -else -echo A "$1" -fi -} -# Update DNS -retries=0 -while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF -server %DNS_PRIVATE_IP% -update add ellis-0.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -update add ellis.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -send -EOF -} && [ $retries -lt 10 ] -do -retries=$((retries + 1)) -echo 'nsupdate failed - retrying (retry '$retries')...' -sleep 5 -done -# Use the DNS server. -echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf -echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq -service dnsmasq force-reload + } # Log all output to file. diff --git a/Clearwater/package/Resources/Homer/configure.sh b/Clearwater/package/Resources/Homer/configure.sh new file mode 100644 index 00000000..59eec114 --- /dev/null +++ b/Clearwater/package/Resources/Homer/configure.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +configure() { +set -x +# Function to give DNS record type and IP address for specified IP address +ip2rr() { +if echo "$1" | grep -q -e '[^0-9.]' ; then +echo AAAA "$1" +else +echo A "$1" +fi +} +# Update DNS +retries=0 +while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF +server %DNS_PRIVATE_IP% +update add homer-%INDEX%.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +update add homer.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +send +EOF +} && [ $retries -lt 10 ] +do +retries=$((retries + 1)) +echo 'nsupdate failed - retrying (retry '$retries')...' +sleep 5 +done +# Use the DNS server. +echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf +echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq +service dnsmasq force-reload +} + +# Log all output to file. +configure 2>&1|tee -a /var/log/clearwater-homer.log diff --git a/Clearwater/package/Resources/deployHomer.sh b/Clearwater/package/Resources/Homer/deploy.sh similarity index 57% rename from Clearwater/package/Resources/deployHomer.sh rename to Clearwater/package/Resources/Homer/deploy.sh index 02b2c05c..d354a114 100644 --- a/Clearwater/package/Resources/deployHomer.sh +++ b/Clearwater/package/Resources/Homer/deploy.sh @@ -1,6 +1,7 @@ #!/bin/bash deploy() { + # Log all output to file. exec > >(tee -a /var/log/clearwater-homer.log) 2>&1 set -x @@ -16,39 +17,14 @@ cat > /etc/clearwater/local_config << EOF management_local_ip=%PRIVATE_IP% local_ip=%PRIVATE_IP% public_ip=%PUBLIC_IP% -public_hostname=homer-0.%ZONE% +public_hostname=homer-%INDEX%.%ZONE% etcd_cluster=$etcd_ip EOF + # Now install the software. DEBIAN_FRONTEND=noninteractive apt-get install clearwater-cassandra --yes --force-yes DEBIAN_FRONTEND=noninteractive apt-get install homer --yes --force-yes DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes -# Function to give DNS record type and IP address for specified IP address -ip2rr() { -if echo "$1" | grep -q -e '[^0-9.]' ; then -echo AAAA "$1" -else -echo A "$1" -fi -} -# Update DNS -retries=0 -while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF -server %DNS_PRIVATE_IP% -update add homer-0.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -update add homer.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -send -EOF -} && [ $retries -lt 10 ] -do -retries=$((retries + 1)) -echo 'nsupdate failed - retrying (retry '$retries')...' -sleep 5 -done -# Use the DNS server. -echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf -echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq -service dnsmasq force-reload } # Log all output to file. diff --git a/Clearwater/package/Resources/Homestead/configure.sh b/Clearwater/package/Resources/Homestead/configure.sh new file mode 100644 index 00000000..d522211a --- /dev/null +++ b/Clearwater/package/Resources/Homestead/configure.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +configure() { +set -x +# Function to give DNS record type and IP address for specified IP address +ip2rr() { +if echo "$1" | grep -q -e '[^0-9.]' ; then +echo AAAA "$1" +else +echo A "$1" +fi +} +# Update DNS +retries=0 +while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF +server %DNS_PRIVATE_IP% +update add homestead-%INDEX%.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +update add hs-prov.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) +update add hs.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) +send +EOF +} && [ $retries -lt 10 ] +do +retries=$((retries + 1)) +echo 'nsupdate failed - retrying (retry '$retries')...' +sleep 5 +done +# Use the DNS server. +echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf +echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq +service dnsmasq force-reload +} + +# Log all output to file. +configure 2>&1|tee -a /var/log/clearwater-homestead.log diff --git a/Clearwater/package/Resources/deployHomestead.sh b/Clearwater/package/Resources/Homestead/deploy.sh similarity index 51% rename from Clearwater/package/Resources/deployHomestead.sh rename to Clearwater/package/Resources/Homestead/deploy.sh index be293b3a..9b12124a 100644 --- a/Clearwater/package/Resources/deployHomestead.sh +++ b/Clearwater/package/Resources/Homestead/deploy.sh @@ -15,39 +15,13 @@ cat > /etc/clearwater/local_config << EOF management_local_ip=%PRIVATE_IP% local_ip=%PRIVATE_IP% public_ip=%PRIVATE_IP% -public_hostname=homestead-0.%ZONE% +public_hostname=homestead-%INDEX%.%ZONE% etcd_cluster=$etcd_ip EOF + # Now install the software. DEBIAN_FRONTEND=noninteractive apt-get install homestead homestead-prov clearwater-prov-tools --yes DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes -# Function to give DNS record type and IP address for specified IP address -ip2rr() { -if echo "$1" | grep -q -e '[^0-9.]' ; then -echo AAAA "$1" -else -echo A "$1" -fi -} -# Update DNS -retries=0 -while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF -server %DNS_PRIVATE_IP% -update add homestead-0.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -update add hs-prov.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) -update add hs.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) -send -EOF -} && [ $retries -lt 10 ] -do -retries=$((retries + 1)) -echo 'nsupdate failed - retrying (retry '$retries')...' -sleep 5 -done -# Use the DNS server. -echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf -echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq -service dnsmasq force-reload } # Log all output to file. diff --git a/Clearwater/package/Resources/Ralf/configure.sh b/Clearwater/package/Resources/Ralf/configure.sh new file mode 100644 index 00000000..134e95a2 --- /dev/null +++ b/Clearwater/package/Resources/Ralf/configure.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +configure() { +set -x +# Function to give DNS record type and IP address for specified IP address +ip2rr() { + if echo "$1" | grep -q -e '[^0-9.]' ; then + echo AAAA "$1" + else + echo A "$1" + fi +} +# Update DNS +retries=0 +while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF +server %DNS_PRIVATE_IP% +update add ralf-%INDEX%.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +update add ralf.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) +send +EOF +} && [ $retries -lt 10 ] +do + retries=$((retries + 1)) + echo 'nsupdate failed - retrying (retry '$retries')...' + sleep 5 +done +# Use the DNS server. +echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf +echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq +service dnsmasq force-reload +} + +# Log all output to file. +configure 2>&1|tee -a /var/log/clearwater-ralf.log diff --git a/Clearwater/package/Resources/deployRalf.sh b/Clearwater/package/Resources/Ralf/deploy.sh similarity index 58% rename from Clearwater/package/Resources/deployRalf.sh rename to Clearwater/package/Resources/Ralf/deploy.sh index bf5d770b..020e85f8 100644 --- a/Clearwater/package/Resources/deployRalf.sh +++ b/Clearwater/package/Resources/Ralf/deploy.sh @@ -15,7 +15,7 @@ cat > /etc/clearwater/local_config << EOF management_local_ip=%PRIVATE_IP% local_ip=%PRIVATE_IP% public_ip=%PRIVATE_IP% -public_hostname=ralf-0.%ZONE% +public_hostname=ralf-%INDEX%.%ZONE% etcd_cluster=$etcd_ip EOF # Create /etc/chronos/chronos.conf. @@ -33,35 +33,10 @@ enabled = true [exceptions] max_ttl = 600 EOF + # Now install the software. DEBIAN_FRONTEND=noninteractive apt-get install ralf --yes --force-yes DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes -# Function to give DNS record type and IP address for specified IP address -ip2rr() { - if echo "$1" | grep -q -e '[^0-9.]' ; then - echo AAAA "$1" - else - echo A "$1" - fi -} -# Update DNS -retries=0 -while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF -server %DNS_PRIVATE_IP% -update add ralf-0.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -update add ralf.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) -send -EOF -} && [ $retries -lt 10 ] -do - retries=$((retries + 1)) - echo 'nsupdate failed - retrying (retry '$retries')...' - sleep 5 -done -# Use the DNS server. -echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf -echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq -service dnsmasq force-reload } # Log all output to file. diff --git a/Clearwater/package/Resources/Sprout/configure.sh b/Clearwater/package/Resources/Sprout/configure.sh new file mode 100644 index 00000000..489b3341 --- /dev/null +++ b/Clearwater/package/Resources/Sprout/configure.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +configure() { +set -x + +# Function to give DNS record type and IP address for specified IP address +ip2rr() { +if echo "$1" | grep -q -e '[^0-9.]' ; then +echo AAAA "$1" +else +echo A "$1" +fi +} +# Update DNS +retries=0 +while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF +server %DNS_PRIVATE_IP% +update add sprout-%INDEX%.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) +update add %INDEX%.sprout.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) +update add sprout.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) +update add scscf.sprout.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) +update add icscf.sprout.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) +update add sprout.%ZONE%. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.sprout.%ZONE%. +update add _sip._tcp.sprout.%ZONE%. 30 SRV 0 0 5054 %INDEX%.sprout.%ZONE%. +update add icscf.sprout.%ZONE%. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.icscf.sprout.%ZONE%. +update add _sip._tcp.icscf.sprout.%ZONE%. 30 SRV 0 0 5052 %INDEX%.sprout.%ZONE%. +update add scscf.sprout.%ZONE%. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.scscf.sprout.%ZONE%. +update add _sip._tcp.scscf.sprout.%ZONE%. 30 SRV 0 0 5054 %INDEX%.sprout.%ZONE%. +send +EOF +} && [ $retries -lt 10 ] +do +retries=$((retries + 1)) +echo 'nsupdate failed - retrying (retry '$retries')...' +sleep 5 +done +# Use the DNS server. +echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf +echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq +service dnsmasq force-reload +} + +# Log all output to file. +configure 2>&1|tee -a /var/log/clearwater-sprout.log diff --git a/Clearwater/package/Resources/Sprout/deploy.sh b/Clearwater/package/Resources/Sprout/deploy.sh new file mode 100644 index 00000000..2e1c6d39 --- /dev/null +++ b/Clearwater/package/Resources/Sprout/deploy.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +deploy() { +set -x + +# Configure the APT software source. +echo 'deb http://repo.cw-ngv.com/archive/repo101 binary/' > /etc/apt/sources.list.d/clearwater.list +curl -L http://repo.cw-ngv.com/repo_key | apt-key add - +apt-get update +# Configure /etc/clearwater/local_config. +mkdir -p /etc/clearwater +etcd_ip=%ETCD_IP% +[ -n "$etcd_ip" ] || etcd_ip=%PRIVATE_IP% +cat > /etc/clearwater/local_config << EOF +management_local_ip=%PRIVATE_IP% +local_ip=%PRIVATE_IP% +public_ip=%PRIVATE_IP% +public_hostname=%INDEX%.sprout.%ZONE% +etcd_cluster=$etcd_ip +EOF +# Create /etc/chronos/chronos.conf. +mkdir -p /etc/chronos +cat > /etc/chronos/chronos.conf << EOF +[http] +bind-address = %PRIVATE_IP% +bind-port = 7253 +threads = 50 +[logging] +folder = /var/log/chronos +level = 2 +[alarms] +enabled = true +[exceptions] +max_ttl = 600 +EOF + +# Now install the software. +DEBIAN_FRONTEND=noninteractive apt-get install sprout --yes --force-yes +DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes +} + +# Log all output to file. +deploy 2>&1 | tee -a /var/log/clearwater-sprout.log diff --git a/Clearwater/package/Resources/deployBono.sh b/Clearwater/package/Resources/deployBono.sh deleted file mode 100644 index d026fd9a..00000000 --- a/Clearwater/package/Resources/deployBono.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -deploy() { -set -x - -# Configure the APT software source. -echo 'deb http://repo.cw-ngv.com/archive/repo101 binary/' > /etc/apt/sources.list.d/clearwater.list -curl -L http://repo.cw-ngv.com/repo_key | apt-key add - -apt-get update -# Configure /etc/clearwater/local_config. -mkdir -p /etc/clearwater -etcd_ip=%ETCD_IP% -[ -n "$etcd_ip" ] || etcd_ip=%PRIVATE_IP% -cat > /etc/clearwater/local_config << EOF -management_local_ip=%PRIVATE_IP% -local_ip=%PRIVATE_IP% -public_ip=%PUBLIC_IP% -public_hostname=0.bono.%ZONE% -etcd_cluster=$etcd_ip -EOF -# Now install the software. -DEBIAN_FRONTEND=noninteractive apt-get install bono --yes --force-yes -DEBIAN_FRONTEND=noninteractive apt-get install clearwater-config-manager --yes --force-yes -# Function to give DNS record type and IP address for specified IP address -ip2rr() { -if echo "$1" | grep -q -e '[^0-9.]' ; then -echo AAAA "$1" -else -echo A "$1" -fi -} -# Update DNS -retries=0 -while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF -server %DNS_PRIVATE_IP% -update add bono-0.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -update add 0.bono.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -update add %ZONE%. 30 $(ip2rr %PUBLIC_IP%) -update add %ZONE%. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.%ZONE%. -update add %ZONE%. 30 NAPTR 0 0 "s" "SIP+D2U" "" _sip._udp.%ZONE%. -update add _sip._tcp.%ZONE%. 30 SRV 0 0 5060 0.bono.%ZONE%. -update add _sip._udp.%ZONE%. 30 SRV 0 0 5060 0.bono.%ZONE%. -send -EOF -} && [ $retries -lt 10 ] -do -retries=$((retries + 1)) -echo 'nsupdate failed - retrying (retry '$retries')...' -sleep 5 -done -# Use the DNS server. -echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf -echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq -service dnsmasq force-reload -} - -# Log all output to file. -deploy 2>&1|tee -a /var/log/clearwater-bono.log diff --git a/Clearwater/package/Resources/deploySprout.sh b/Clearwater/package/Resources/deploySprout.sh deleted file mode 100644 index a710d9b0..00000000 --- a/Clearwater/package/Resources/deploySprout.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -deploy() { -set -x -# Set up the signaling network namespace on each boot by creating an init file and -# linking to it from runlevel 2 and 3 - -# Configure the APT software source. -echo 'deb http://repo.cw-ngv.com/archive/repo101 binary/' > /etc/apt/sources.list.d/clearwater.list -curl -L http://repo.cw-ngv.com/repo_key | apt-key add - -apt-get update -# Configure /etc/clearwater/local_config. -mkdir -p /etc/clearwater -etcd_ip=%ETCD_IP% -[ -n "$etcd_ip" ] || etcd_ip=%PRIVATE_IP% -cat > /etc/clearwater/local_config << EOF -management_local_ip=%PRIVATE_IP% -local_ip=%PRIVATE_IP% -public_ip=%PRIVATE_IP% -public_hostname=0.sprout.%ZONE% -etcd_cluster=$etcd_ip -EOF -# Create /etc/chronos/chronos.conf. -mkdir -p /etc/chronos -cat > /etc/chronos/chronos.conf << EOF -[http] -bind-address = %PRIVATE_IP% -bind-port = 7253 -threads = 50 -[logging] -folder = /var/log/chronos -level = 2 -[alarms] -enabled = true -[exceptions] -max_ttl = 600 -EOF -# Now install the software. -DEBIAN_FRONTEND=noninteractive apt-get install sprout --yes --force-yes -DEBIAN_FRONTEND=noninteractive apt-get install clearwater-management --yes --force-yes -# Function to give DNS record type and IP address for specified IP address -ip2rr() { -if echo "$1" | grep -q -e '[^0-9.]' ; then -echo AAAA "$1" -else -echo A "$1" -fi -} -# Update DNS -retries=0 -while ! { nsupdate -y "%ZONE%:%DNSSEC_KEY%" -v << EOF -server %DNS_PRIVATE_IP% -update add sprout-0.%ZONE%. 30 $(ip2rr %PUBLIC_IP%) -update add 0.sprout.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) -update add sprout.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) -update add scscf.sprout.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) -update add icscf.sprout.%ZONE%. 30 $(ip2rr %PRIVATE_IP%) -update add sprout.%ZONE%. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.sprout.%ZONE%. -update add _sip._tcp.sprout.%ZONE%. 30 SRV 0 0 5054 0.sprout.%ZONE%. -update add icscf.sprout.%ZONE%. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.icscf.sprout.%ZONE%. -update add _sip._tcp.icscf.sprout.%ZONE%. 30 SRV 0 0 5052 0.sprout.%ZONE%. -update add scscf.sprout.%ZONE%. 30 NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp.scscf.sprout.%ZONE%. -update add _sip._tcp.scscf.sprout.%ZONE%. 30 SRV 0 0 5054 0.sprout.%ZONE%. -send -EOF -} && [ $retries -lt 10 ] -do -retries=$((retries + 1)) -echo 'nsupdate failed - retrying (retry '$retries')...' -sleep 5 -done -# Use the DNS server. -echo 'nameserver %DNS_PRIVATE_IP%' > /etc/dnsmasq.resolv.conf -echo 'RESOLV_CONF=/etc/dnsmasq.resolv.conf' >> /etc/default/dnsmasq -service dnsmasq force-reload -} - -# Log all output to file. -deploy 2>&1 | tee -a /var/log/clearwater-sprout.log diff --git a/Clearwater/package/UI/ui.yaml b/Clearwater/package/UI/ui.yaml index 5ec9f3ff..88164e25 100644 --- a/Clearwater/package/UI/ui.yaml +++ b/Clearwater/package/UI/ui.yaml @@ -12,18 +12,37 @@ Version: 2.2 +Templates: + customJoinNet: + - ?: + type: io.murano.resources.ExistingNeutronNetwork + internalNetworkName: $.instanceConfiguration.network[0] + internalSubnetworkName: $.instanceConfiguration.network[1] + Application: ?: type: com.mirantis.clearwater.Clearwater - keypair: $.commonInstanceConfiguration.keypair - zoneName: $.commonInstanceConfiguration.zoneName - osImageName: $.commonInstanceConfiguration.osImage - flavorName: $.commonInstanceConfiguration.flavor - dnssecKey: $.commonInstanceConfiguration.dnsseckey - dnsApp: $.components.dnsServer + instanceTemplate: + ?: + type: io.murano.resources.LinuxMuranoInstance + name: anything + flavor: $.instanceConfiguration.flavor + image: $.instanceConfiguration.osImage + keyname: $.instanceConfiguration.keyPair + availabilityZone: $.instanceConfiguration.availabilityZone + assignFloatingIp: true + networks: + useEnvironmentNetwork: $.instanceConfiguration.network[0]=null + useFlatNetwork: false + customNetworks: switch($.instanceConfiguration.network[0], $=null=>list(), $!=null=>$customJoinNet) + dnsApp: $.appConfig.dnsServer + bonoClusterSize: $.appConfig.bonoClusterSize + sproutClusterSize: $.appConfig.sproutClusterSize + homerClusterSize: $.appConfig.homerClusterSize + homesteadClusterSize: $.appConfig.homesteadClusterSize Forms: - - commonInstanceConfiguration: + - instanceConfiguration: fields: - name: keypair type: keypair @@ -32,6 +51,12 @@ Forms: Select the Key Pair to control access to instances. You can login to instances using this KeyPair after the deployment of application. required: false + - name: flavor + type: flavor + label: Instance flavor + description: >- + Select registered in Openstack flavor. Consider that application performance + depends on this parameter. - name: osImage type: image label: Instance image @@ -39,17 +64,39 @@ Forms: description: >- Select valid Ubuntu 14.04 image with cloud-init preinstalled for the application. Image should already be prepared and registered in glance. - - name: flavor - type: flavor - label: Instance flavor - description: >- - Select registered in Openstack flavor. Consider that application performance - depends on this parameter. + - name: availabilityZone + type: azone + label: Availability zone + description: Select availability zone where application would be installed. + required: false + - name: network + type: network + label: Network + description: Select a network to join. 'Auto' corresponds to a default environment's network. + required: false + murano_networks: translate - - components: + - appConfig: fields: - name: dnsServer type: com.mirantis.network.dns.Bind label: DNS server description: >- Add internal DNS server application. DNS is used by Clearewater to refer to its nodes + + - name: bonoClusterSize + type: integer + label: Bono cluster size + initial: 1 + - name: sproutClusterSize + type: integer + label: Sprout cluster size + initial: 1 + - name: homerClusterSize + type: integer + label: Homer cluster size + initial: 1 + - name: homesteadClusterSize + type: integer + label: Homestead cluster size + initial: 1 \ No newline at end of file diff --git a/Clearwater/package/manifest.yaml b/Clearwater/package/manifest.yaml index ef8545f6..de0ce70c 100644 --- a/Clearwater/package/manifest.yaml +++ b/Clearwater/package/manifest.yaml @@ -19,6 +19,7 @@ Description: | Author: 'Mirantis, Inc' Tags: [vIMS] Classes: + com.mirantis.clearwater.components.base.ClearwaterReplicaProvider: components/base/ClearwaterComponentBase.yaml com.mirantis.clearwater.Clearwater: Clearwater.yaml com.mirantis.clearwater.components.base.ClearwaterComponentBase: components/base/ClearwaterComponentBase.yaml com.mirantis.clearwater.components.Bono: components/Bono.yaml @@ -31,3 +32,5 @@ Classes: Require: com.mirantis.network.dns.Bind: + io.murano.applications: +