blob: b2e7aa2c6511fc841a283a7f3934a9d114dc570d [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001/*-
2 * ============LICENSE_START=======================================================
3 * SDC
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
19 */
20
21var normativeTypesRootYml = "tosca_definitions_version: tosca_simple_yaml_1_0_0_wd03"+
22
23"template_name: tosca-normative-types-root"+
24"template_author: TOSCA TC"+
25"template_version: 1.0.0.wd03-SNAPSHOT"+
26"description: Contains the normative types definition."+
27"node_types:"+
28" tosca.nodes.Root:"+
29" abstract: true"+
30" description: >"+
31" This is the default (root) TOSCA Node Type that all other TOSCA nodes should extends."+
32" This allows all TOSCA nodes to have a consistent set of features for modeling and management"+
33" (e.g, consistent definitions for requirements, capabilities, and lifecycle interfaces)."+
34" tags:"+
35" icon: /images/root.png"+
36" attributes:"+
37" tosca_id:"+
38" type: string"+
39" tosca_name:"+
40" type: string"+
41" requirements:"+
42" dependency:"+
43" type: tosca.capabilities.Root"+
44" lower_bound: 0"+
45" upper_bound: unbounded"+
46" capabilities:"+
47" root:"+
48" type: tosca.capabilities.Root"+
49" interfaces:"+
50" tosca.interfaces.node.lifecycle.Standard:"+
51" description: >"+
52" This lifecycle interface defines the essential, normative operations that TOSCA nodes may support."+
53" create:"+
54" description: Standard lifecycle create operation."+
55" configure:"+
56" description: Standard lifecycle configure operation (pre-start)."+
57" start:"+
58" description: Standard lifecycle start operation."+
59" post_start:"+
60" description: Standard lifecycle post-configure operation (post-start)"+
61" stop:"+
62" description: Standard lifecycle stop operation."+
63" delete:"+
64" description: Standard lifecycle delete operation."+
65"capability_types:"+
66" tosca.capabilities.Root:"+
67" description: This is the default (root) TOSCA Capability Type definition that all other TOSCA Capability Types derive from."+
68"relationship_types:"+
69" tosca.relationships.Root:"+
70" abstract: true"+
71" description: This is the default (root) TOSCA Relationship Type definition that all other TOSCA Relationship Types derive from."+
72" valid_targets: [ tosca.capabilities.Root ]"+
73" attributes:"+
74" tosca_id:"+
75" type: string"+
76" tosca_name:"+
77" type: string"+
78" interfaces:"+
79" tosca.interfaces.relationship.Configure:"+
80" description: >"+
81" The lifecycle interfaces define the essential, normative operations that each TOSCA Relationship Types may support."+
82" pre_configure_source:"+
83" description: Operation to pre-configure the source endpoint."+
84" pre_configure_target:"+
85" description: Operation to pre-configure the target endpoint."+
86" post_configure_source:"+
87" description: Operation to post-configure the source endpoint."+
88" post_configure_target:"+
89" description: Operation to post-configure the target endpoint."+
90" add_target:"+
91" description: Operation to notify the source node of a target node being added via a relationship."+
92" add_source:"+
93" description: Operation to notify the target node of a source node which is now available via a relationship."+
94" remove_target:"+
95" description: Operation to notify the source node of a target node being removed from a relationship."+
96" remove_source:"+
97" description: Operation to notify the target node of a source node being removed from a relationship."+
98" target_changed:"+
99" description: Operation to notify source some property or attribute of the target."+
100" source_changed:"+
101" description: Operation to notify target some property or attribute of the source."+
102"artifact_types:"+
103" tosca.artifacts.Root:"+
104" description: The TOSCA Artifact Type all other TOSCA Artifact Types derive from.";
105
106
107var mysqlTypeYml =
108"tosca_definitions_version: tosca_simple_yaml_1_0_0_wd03"+
109"description: MySQL RDBMS installation on a specific mounted volume path."+
110"template_name: mysql-type"+
111"template_version: 2.0.0-SNAPSHOT"+
112"template_author: FastConnect"+
113
114"imports:"+
115' - "tosca-normative-types:1.0.0.wd03-SNAPSHOT"'+
116
117"node_types:"+
118" alien.nodes.Mysql:"+
119" derived_from: tosca.nodes.Database"+
120" description: >"+
121" A node to install MySQL v5.5 database with data"+
122" on a specific attached volume."+
123" capabilities:"+
124" host:"+
125" type: alien.capabilities.MysqlDatabase"+
126" properties:"+
127" valid_node_types: [ tosca.nodes.WebApplication ]"+
128" requirements:"+
129" - host: tosca.nodes.Compute"+
130" type: tosca.relationships.HostedOn"+
131" tags:"+
132" icon: /images/mysql.png"+
133" properties:"+
134" db_port:"+
135" type: integer"+
136" default: 3306"+
137" description: The port on which the underlying database service will listen to data."+
138" db_name:"+
139" type: string"+
140" required: true"+
141" default: wordpress"+
142" description: The logical name of the database."+
143" db_user:"+
144" type: string"+
145" default: pass"+
146" description: The special user account used for database administration."+
147" db_password:"+
148" type: string"+
149" default: pass"+
150" description: The password associated with the user account provided in the ‘db_user’ property."+
151" bind_address:"+
152" type: boolean"+
153" default: true"+
154" required: false"+
155" description: If true,the server accepts TCP/IP connections on all server host IPv4 interfaces."+
156" storage_path:"+
157" type: string"+
158" default: /mountedStorage"+
159" constraints:"+
160' - valid_values: [ "/mountedStorage", "/var/mysql" ]'+
161" interfaces:"+
162" Standard:"+
163" create: scripts/install_mysql.sh"+
164" start:"+
165" inputs:"+
166" VOLUME_HOME: { get_property: [SELF, storage_path] }"+
167" PORT: { get_property: [SELF, db_port] }"+
168" DB_NAME: { get_property: [SELF, db_name] }"+
169" DB_USER: { get_property: [SELF, db_user] }"+
170" DB_PASSWORD: { get_property: [SELF, db_password] }"+
171" BIND_ADRESS: { get_property: [SELF, bind_address] }"+
172" implementation: scripts/start_mysql.sh"+
173" "+
174"capability_types:"+
175" alien.capabilities.MysqlDatabase:"+
176" derived_from: tosca.capabilities.Container";
177
178
179var installMySqlSH =
180'#!/bin/bash'+
181
182'echo "Debian based MYSQL install 5..."'+
183'LOCK="/tmp/lockaptget"'+
184
185'while true; do'+
186' if mkdir "${LOCK}" &>/dev/null; then'+
187' echo "MySQL take the lock"'+
188' break;'+
189' fi'+
190' echo "Waiting the end of one of our recipes..."'+
191' sleep 0.5'+
192'done'+
193
194'while sudo fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do'+
195' echo "Waiting for other software managers to finish..."'+
196' sleep 0.5'+
197'done'+
198'sudo rm -f /var/lib/dpkg/lock'+
199
200'sudo apt-get update || (sleep 15; sudo apt-get update || exit ${1})'+
201'sudo DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server-5.5 pwgen || exit ${1}'+
202'rm -rf "${LOCK}"'+
203
204'sudo /etc/init.d/mysql stop'+
205'sudo rm -rf /var/lib/apt/lists/*'+
206'sudo rm -rf /var/lib/mysql/*'+
207'echo "MySQL Installation complete."';