fa25ac458d77f3081934bf9b3369b1403e39e66b
[demo.git] / heat / OpenECOMP / openecomp_rackspace.yaml
1 heat_template_version: 2013-05-23
2
3 description: Heat template to deploy OpenECOMP components
4
5 parameters:
6
7   # Generic parameters used across all OpenECOMP components
8   public_net_id:
9     type: string
10     label: Public network name or ID
11     description: Public network that enables remote connection to the compute instance
12
13   key_name:
14     type: string
15     label: Key pair name
16     description: Public/Private key pair name
17
18   pub_key:
19     type: string
20     label: Public key
21     description: Public key or SSL certificate to be installed on the compute instance
22
23   nexus_repo:
24     type: string
25     label: Nexus Repository
26     description: Complete URL for the Nexus repository.
27
28   nexus_docker_repo:
29     type: string
30     label: Nexus Docker Images Repository
31     description: Complete URL for the Nexus repository for docker images.
32
33   nexus_username:
34     type: string
35     label: Nexus Repository Username
36     description: Nexus Repository username
37
38   nexus_password:
39     type: string
40     label: Nexus Repository Password
41     description: Nexus Repository Password
42     
43   gitlab_username:
44     type: string
45     label: Gitlab Repository Username
46     description: Gitlab Repository username
47
48   gitlab_password:
49     type: string
50     label: Gitlab Repository Password
51     description: Gitlab Repository Password
52
53   dmaap_topic:
54     type: string
55     label: DmaaP Topic
56     description: DmaaP Topic that MSO and A&AI listen to
57
58   artifacts_version:
59     type: string
60     label: Artifacts Version
61     description: Artifacts version of OpenECOMP components
62
63
64   # Parameters for DCAE instantiation
65   dcae_zone:
66     type: string
67     label: DCAE Zone
68     description: DCAE Zone to use in VM names created by DCAE controller
69
70   dcae_state:
71     type: string
72     label: DCAE State
73     description: DCAE State to use in VM names created by DCAE controller
74
75   openstack_tenant_id:
76     type: string
77     label: Rackspace tenant ID
78     description: Rackspace tenant ID
79
80   openstack_username:
81     type: string
82     label: Rackspace username
83     description: Rackspace username
84
85   openstack_api_key:
86     type: string
87     label: Rackspace API Key
88     description: Rackspace API Key
89
90   openstack_password:
91     type: string
92     label: Rackspace Password
93     description: Rackspace Password
94
95   nexus_repo_root:
96     type: string
97     label: Root URL of nexus repository
98     description: Root URL of nexus repository
99     
100   nexus_url_snapshot:
101     type: string
102     label: Snapshot of Maven repository for DCAE deployment
103     description: Snapshot of Maven repository
104
105   openstack_region:
106     type: string
107     label: Rackspace Region
108     description: Rackspace region where the DCAE controller will spin the VMs
109
110   gitlab_branch:
111     type: string
112     label: Branch of the Gitlab repository
113     description: Branch of the Gitlab repository
114     
115
116 resources:
117   random-str:
118     type: OS::Heat::RandomString
119     properties:
120       length: 4
121
122   # Public key used to access OpenECOMP components
123   vm_key:
124     type: OS::Nova::KeyPair
125     properties:
126       name: 
127         str_replace:
128           template: base_rand
129           params:
130             base: { get_param: key_name }
131             rand: { get_resource: random-str }         
132       public_key: { get_param: pub_key }
133       save_private_key: false
134
135
136   # OpenECOMP management private network
137   oam_ecomp:
138     type: OS::Neutron::Net
139     properties:
140       name: 
141         str_replace:
142           template: oam_ecomp_rand
143           params:
144             rand: { get_resource: random-str }
145
146   oam_ecomp_subnet:
147     type: OS::Neutron::Subnet
148     properties:
149       name: 
150         str_replace:
151           template: oam_ecomp_rand
152           params:
153             rand: { get_resource: random-str }
154       network_id: { get_resource: oam_ecomp }
155       cidr: 10.0.0.0/8
156     value: { get_attr: [oam_ecomp, name] }
157
158
159   # DNS Server instantiation
160   dns_private_port:
161     type: OS::Neutron::Port
162     properties:
163       network: { get_resource: oam_ecomp }
164       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.0.1}]
165
166   dns_vm:
167     type: OS::Nova::Server
168     properties:
169       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
170       flavor: 4 GB General Purpose v1
171       name: vm1-dns-server
172       key_name: { get_resource: vm_key }
173       networks:
174         - network: { get_param: public_net_id }
175         - port: { get_resource: dns_private_port }
176       user_data_format: RAW
177       user_data:
178         str_replace:
179           params:
180             __nexus_repo__: { get_param: nexus_repo }
181             __artifacts_version__: { get_param: artifacts_version }
182           template: |
183             #!/bin/bash
184
185             # Download dependencies
186             add-apt-repository -y ppa:openjdk-r/ppa
187             apt-get update
188             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk bind9 bind9utils bind9-doc ntp ntpdate
189
190             # Download script
191             mkdir /etc/bind/zones
192
193             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/db_simpledemo_openecomp_org -o /etc/bind/zones/db.simpledemo.openecomp.org
194             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/named.conf.options -o /etc/bind/named.conf.options
195             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/named.conf.local -o /etc/bind/named.conf.local
196
197             # Configure Bind
198             modprobe ip_gre
199             sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
200             service bind9 restart
201
202
203   # A&AI instantiation
204   aai_private_port:
205     type: OS::Neutron::Port
206     properties:
207       network: { get_resource: oam_ecomp }
208       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.1.1}]
209
210   aai_volume:
211     type: OS::Cinder::Volume
212     properties:
213       name: vol1-aai
214       size: 50
215       volume_type: SSD
216       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
217
218   aai_vm:
219     type: OS::Nova::Server
220     depends_on: sdc_vm
221     properties:
222       flavor: 15 GB Compute v1
223       name: vm1-aai
224       key_name: { get_resource: vm_key }
225       block_device_mapping:
226         - volume_id: { get_resource: aai_volume }
227           device_name: vda
228       networks:
229         - network: { get_param: public_net_id }
230         - port: { get_resource: aai_private_port }
231       user_data_format: RAW
232       user_data:
233         str_replace:
234           params:
235             __nexus_repo__: { get_param: nexus_repo }
236             __nexus_docker_repo__: { get_param: nexus_docker_repo }
237             __nexus_username__: { get_param: nexus_username }
238             __nexus_password__: { get_param: nexus_password }
239             __gitlab_username__: { get_param: gitlab_username }
240             __gitlab_password__: { get_param: gitlab_password }
241             __dmaap_topic__: { get_param: dmaap_topic }
242             __artifacts_version__: { get_param: artifacts_version }
243           template: |
244             #!/bin/bash
245
246             # DNS/GW IP address configuration
247             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
248             resolvconf -u
249             
250             # Download dependencies
251             add-apt-repository -y ppa:openjdk-r/ppa
252             apt-get update
253             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
254
255             # Download scripts from Nexus
256             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/aai_vm_init.sh -o /opt/aai_vm_init.sh
257             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/aai_serv.sh -o /opt/aai_serv.sh
258             chmod +x /opt/aai_vm_init.sh
259             chmod +x /opt/aai_serv.sh
260             mv /opt/aai_serv.sh /etc/init.d
261             update-rc.d aai_serv.sh defaults
262
263             # Download and install docker-engine and docker-compose
264             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
265             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
266             apt-get update
267             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
268             apt-get install -y docker-engine
269             service docker start
270
271             mkdir -p /opt/openecomp/aai/logs
272             mkdir -p /opt/openecomp/aai/data
273             mkdir /opt/docker
274             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
275             chmod +x /opt/docker/docker-compose
276             
277             # Store credentials in files
278             mkdir -p /opt/config
279             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
280             echo "__nexus_username__" > /opt/config/nexus_username.txt
281             echo "__nexus_password__" > /opt/config/nexus_password.txt
282             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
283             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
284             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
285             echo "gerrit.openecomp.org" > /opt/config/gitlab_certname.txt
286             
287             # Execute docker instructions
288             cd /opt
289             ./aai_vm_init.sh
290
291
292   # MSO instantiation
293   mso_private_port:
294     type: OS::Neutron::Port
295     properties:
296       network: { get_resource: oam_ecomp }
297       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.5.1}]
298
299   mso_vm:
300     type: OS::Nova::Server
301     properties:
302       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
303       flavor: 4 GB General Purpose v1
304       name: vm1-mso
305       key_name: { get_resource: vm_key }
306       networks:
307         - network: { get_param: public_net_id }
308         - port: { get_resource: mso_private_port }
309       user_data_format: RAW
310       user_data:
311         str_replace:
312           params:
313             __nexus_repo__: { get_param: nexus_repo }
314             __nexus_docker_repo__: { get_param: nexus_docker_repo }
315             __nexus_username__: { get_param: nexus_username }
316             __nexus_password__: { get_param: nexus_password }
317             __gitlab_username__: { get_param: gitlab_username }
318             __gitlab_password__: { get_param: gitlab_password }
319             __openstack_username__: { get_param: openstack_username }
320             __openstack_tenant_id__: { get_param: openstack_tenant_id }
321             __openstack_api_key__: { get_param: openstack_api_key }
322             __dmaap_topic__: { get_param: dmaap_topic }
323             __artifacts_version__: { get_param: artifacts_version }
324           template: |
325             #!/bin/bash
326
327             # DNS/GW IP address configuration
328             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
329             resolvconf -u
330
331             # Download dependencies
332             add-apt-repository -y ppa:openjdk-r/ppa
333             apt-get update
334             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
335
336             # Download scripts from Nexus
337             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mso_vm_init.sh -o /opt/mso_vm_init.sh
338             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mso_serv.sh -o /opt/mso_serv.sh
339             chmod +x /opt/mso_vm_init.sh
340             chmod +x /opt/mso_serv.sh
341             mv /opt/mso_serv.sh /etc/init.d
342             update-rc.d mso_serv.sh defaults
343
344             # Download and install docker-engine and docker-compose
345             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
346             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
347             apt-get update
348             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
349             apt-get install -y docker-engine
350             service docker start
351
352             mkdir /opt/docker
353             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
354             chmod +x /opt/docker/docker-compose
355
356             # Store credentials in files
357             mkdir -p /opt/config
358             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
359             echo "__nexus_username__" > /opt/config/nexus_username.txt
360             echo "__nexus_password__" > /opt/config/nexus_password.txt
361             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
362             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
363             echo "__openstack_username__" > /opt/config/openstack_username.txt
364             echo "__openstack_tenant_id__" > /opt/config/tenant_id.txt
365             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
366            
367
368             # Run docker-compose to spin up containers
369             cd /opt
370             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/mso/docker-config.git test_lab
371             MSO_ENCRYPTION_KEY=$(cat /opt/test_lab/encryption.key)
372             echo -n "__openstack_api_key__" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt
373             ./mso_vm_init.sh
374
375
376   # Message Router instantiation
377   mrouter_private_port:
378     type: OS::Neutron::Port
379     properties:
380       network: { get_resource: oam_ecomp }
381       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.11.1}]
382
383   mrouter_vm:
384     type: OS::Nova::Server
385     properties:
386       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
387       flavor: 15 GB I/O v1
388       name: vm1-message-router
389       key_name: { get_resource: vm_key }
390       networks:
391         - network: { get_param: public_net_id }
392         - port: { get_resource: mrouter_private_port }
393       user_data_format: RAW
394       user_data:
395         str_replace:
396           params:
397             __nexus_repo__: { get_param: nexus_repo }
398             __nexus_docker_repo__: { get_param: nexus_docker_repo }
399             __nexus_username__: { get_param: nexus_username }
400             __nexus_password__: { get_param: nexus_password }
401             __gitlab_username__: { get_param: gitlab_username }
402             __gitlab_password__: { get_param: gitlab_password }
403             __artifacts_version__: { get_param: artifacts_version }
404           template: |
405             #!/bin/bash
406
407             # DNS/GW IP address configuration
408             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
409             resolvconf -u
410
411             # Download dependencies
412             add-apt-repository -y ppa:openjdk-r/ppa
413             apt-get update
414             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
415             
416             # Download scripts from Nexus
417             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mr_vm_init.sh -o /opt/mr_vm_init.sh
418             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mr_serv.sh -o /opt/mr_serv.sh
419             chmod +x /opt/mr_vm_init.sh
420             chmod +x /opt/mr_serv.sh
421             mv /opt/mr_serv.sh /etc/init.d
422             update-rc.d mr_serv.sh defaults
423
424             # Download and install docker-engine and docker-compose
425             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
426             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
427             apt-get update
428             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
429             apt-get install -y docker-engine
430             service docker start
431
432             mkdir /opt/docker
433             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
434             chmod +x /opt/docker/docker-compose
435
436             # Store credentials in files
437             mkdir -p /opt/config
438             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
439             echo "__nexus_username__" > /opt/config/nexus_username.txt
440             echo "__nexus_password__" > /opt/config/nexus_password.txt
441             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
442             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
443
444             # Run docker-compose to spin up containers
445             cd /opt
446             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/message-router.git dcae-startup-vm-message-router
447             ./mr_vm_init.sh
448
449
450   # RobotE2E instantiation
451   robot_private_port:
452     type: OS::Neutron::Port
453     properties:
454       network: { get_resource: oam_ecomp }
455       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.10.1}]
456  
457   robot_vm:
458     type: OS::Nova::Server
459     properties:
460       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
461       flavor: 2 GB General Purpose v1
462       name: vm1-robot
463       key_name: { get_resource: vm_key }
464       networks:
465         - network: { get_param: public_net_id }
466         - port: { get_resource: robot_private_port }
467       user_data_format: RAW
468       user_data:
469         str_replace:
470           params:
471             __nexus_repo__: { get_param: nexus_repo }
472             __nexus_docker_repo__: { get_param: nexus_docker_repo }
473             __nexus_username__: { get_param: nexus_username }
474             __nexus_password__: { get_param: nexus_password }
475             __gitlab_username__: { get_param: gitlab_username }
476             __gitlab_password__: { get_param: gitlab_password }
477             __network_name__: { get_attr: [oam_ecomp, name] }
478             __openstack_username__: { get_param: openstack_username }
479             __openstack_api_key__: { get_param : openstack_api_key }
480             __openstack_password__: { get_param: openstack_password }
481             __artifacts_version__: { get_param: artifacts_version }
482             __openstack_region__: { get_param: openstack_region }
483           template: |
484             #!/bin/bash
485
486             # DNS/GW IP address configuration
487             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
488             resolvconf -u
489  
490             # Download dependencies
491             add-apt-repository -y ppa:openjdk-r/ppa
492             apt-get update
493             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
494             echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
495
496             # Download scripts from Nexus
497             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/robot_vm_init.sh -o /opt/robot_vm_init.sh
498             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/robot_serv.sh -o /opt/robot_serv.sh
499             chmod +x /opt/robot_vm_init.sh
500             chmod +x /opt/robot_serv.sh
501             mv /opt/robot_serv.sh /etc/init.d
502             update-rc.d robot_serv.sh defaults
503  
504             # Download and install docker-engine and docker-compose
505             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
506             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
507             apt-get update
508             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
509             apt-get install -y docker-engine
510             #sed -i 's|^ExecStart=/usr/bin/dockerd \s*-H \s*fd://\s*$|ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375|' /lib/systemd/system/docker.service
511             service docker start
512  
513             mkdir /opt/docker
514             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
515             chmod +x /opt/docker/docker-compose
516  
517             # Store credentials in files
518             mkdir -p /opt/config
519             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
520             echo "__nexus_repo__" > /opt/config/nexus_repo.txt
521             echo "__nexus_username__" > /opt/config/nexus_username.txt
522             echo "__nexus_password__" > /opt/config/nexus_password.txt
523             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
524             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
525             echo "__network_name__" > /opt/config/network.txt
526             echo "__openstack_username__" > /opt/config/openstack_username.txt
527             echo "__openstack_password__" > /opt/config/openstack_password.txt
528             echo "__openstack_api_key__" > /opt/config/openstack_api_key.txt
529             echo "__openstack_region__" > /opt/config/region.txt
530             echo "__artifacts_version__" > /opt/config/artifacts_version.txt
531
532             # Execute RobotETE-specific instructions: create share folder to run as a docker volume
533             mkdir -p /opt/eteshare/logs
534             mkdir -p /opt/eteshare/config
535
536             # Run docker-compose to spin up containers
537             cd /opt
538             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/testsuite/properties.git testsuite/properties
539             ./robot_vm_init.sh
540
541
542   # VID instantiation
543   vid_private_port:
544     type: OS::Neutron::Port
545     properties:
546       network: { get_resource: oam_ecomp }
547       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.8.1}]
548
549   vid_vm:
550     type: OS::Nova::Server
551     properties:
552       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
553       flavor: 2 GB General Purpose v1
554       name: vm1-vid
555       key_name: { get_resource: vm_key }
556       networks:
557         - network: { get_param: public_net_id }
558         - port: { get_resource: vid_private_port }
559       user_data_format: RAW
560       user_data:
561         str_replace:
562           params:
563             __nexus_repo__: { get_param: nexus_repo }
564             __nexus_docker_repo__: { get_param: nexus_docker_repo }
565             __nexus_username__: { get_param: nexus_username }
566             __nexus_password__: { get_param: nexus_password }
567             __gitlab_username__: { get_param: gitlab_username }
568             __gitlab_password__: { get_param: gitlab_password }
569             __artifacts_version__: { get_param: artifacts_version }
570           template: |
571             #!/bin/bash
572
573             # DNS/GW IP address configuration
574             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
575             resolvconf -u
576
577             # Download dependencies
578             add-apt-repository -y ppa:openjdk-r/ppa
579             apt-get update
580             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk make git ntp ntpdate
581
582             # Download scripts from Nexus
583             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/vid_vm_init.sh -o /opt/vid_vm_init.sh
584             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/vid_serv.sh -o /opt/vid_serv.sh
585             chmod +x /opt/vid_vm_init.sh
586             chmod +x /opt/vid_serv.sh
587             mv /opt/vid_serv.sh /etc/init.d
588             update-rc.d vid_serv.sh defaults
589
590             # Download and install docker-engine and docker-compose
591             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
592             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
593             apt-get update
594             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
595             apt-get install -y docker-engine
596             service docker start
597
598             mkdir /opt/docker
599             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
600             chmod +x /opt/docker/docker-compose
601
602             # Store credentials in files
603             mkdir -p /opt/config
604             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
605             echo "__nexus_username__" > /opt/config/nexus_username.txt
606             echo "__nexus_password__" > /opt/config/nexus_password.txt
607             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
608             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
609
610             # Run script to spin up containers
611             cd /opt
612             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/vid.git
613             ./vid_vm_init.sh
614
615
616   # SDN-C instantiation
617   sdnc_private_port:
618     type: OS::Neutron::Port
619     properties:
620       network: { get_resource: oam_ecomp }
621       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.7.1}]
622
623   sdnc_vm:
624     type: OS::Nova::Server
625     properties:
626       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
627       flavor: 4 GB General Purpose v1
628       name: vm1-sdnc
629       key_name: { get_resource: vm_key }
630       networks:
631         - network: { get_param: public_net_id }
632         - port: { get_resource: sdnc_private_port }
633       user_data_format: RAW
634       user_data:
635         str_replace:
636           params:
637             __nexus_repo__: { get_param: nexus_repo }
638             __nexus_docker_repo__: { get_param: nexus_docker_repo }
639             __nexus_username__: { get_param: nexus_username }
640             __nexus_password__: { get_param: nexus_password }
641             __gitlab_username__: { get_param: gitlab_username }
642             __gitlab_password__: { get_param: gitlab_password }
643             __artifacts_version__: { get_param: artifacts_version }
644           template: |
645             #!/bin/bash
646
647             # DNS/GW IP address configuration
648             mkdir /opt/config
649             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
650             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
651             resolvconf -u
652
653             # Download dependencies
654             add-apt-repository -y ppa:openjdk-r/ppa
655             apt-get update
656             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
657
658             # Download scripts from Nexus
659             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/sdnc_vm_init.sh -o /opt/sdnc_vm_init.sh
660             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/sdnc_serv.sh -o /opt/sdnc_serv.sh
661             chmod +x /opt/sdnc_vm_init.sh
662             chmod +x /opt/sdnc_serv.sh
663             mv /opt/sdnc_serv.sh /etc/init.d
664             update-rc.d sdnc_serv.sh defaults
665             
666             # Download and install docker-engine and docker-compose
667             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
668             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
669             apt-get update
670             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
671             apt-get install -y docker-engine
672             service docker start
673
674             mkdir /opt/docker
675             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
676             chmod +x /opt/docker/docker-compose
677             
678             # Store credentials in files
679             mkdir -p /opt/config
680             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
681             echo "__nexus_username__" > /opt/config/nexus_username.txt
682             echo "__nexus_password__" > /opt/config/nexus_password.txt
683             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
684             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
685
686             # Run docker-compose to spin up containers
687             cd /opt
688             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/sdnc/oam.git sdnc
689             ./sdnc_vm_init.sh
690
691
692   # SDC instantiation
693   sdc_private_port:
694     type: OS::Neutron::Port
695     properties:
696       network: { get_resource: oam_ecomp }
697       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.3.1}]
698
699   sdc_volume_local:
700     type: OS::Cinder::Volume
701     properties:
702       name: vol1-sdc-local
703       size: 50
704       volume_type: SSD
705       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
706
707   sdc_volume_data:
708     type: OS::Cinder::Volume
709     properties:
710       name: vol1-sdc-data
711       size: 100
712       volume_type: SSD
713
714   sdc_volume_attachment:
715     type: OS::Cinder::VolumeAttachment
716     properties:
717       volume_id: { get_resource: sdc_volume_data }
718       instance_uuid: { get_resource: sdc_vm }
719       mountpoint: /dev/xvdb
720
721   sdc_vm:
722     type: OS::Nova::Server
723     properties:
724       flavor: 15 GB Compute v1
725       name: vm1-sdc
726       key_name: { get_resource: vm_key }
727       block_device_mapping:
728         - volume_id: { get_resource: sdc_volume_local }
729           device_name: vda
730       networks:
731         - network: { get_param: public_net_id }
732         - port: { get_resource: sdc_private_port }
733       user_data_format: RAW
734       user_data:
735         str_replace:
736           params:
737             __nexus_repo__: { get_param: nexus_repo }
738             __nexus_docker_repo__: { get_param: nexus_docker_repo }
739             __nexus_username__: { get_param: nexus_username }
740             __nexus_password__: { get_param: nexus_password }
741             __gitlab_username__: { get_param: gitlab_username }
742             __gitlab_password__: { get_param: gitlab_password }
743             __env_name__: { get_param: dmaap_topic }
744             __artifacts_version__: { get_param: artifacts_version }
745           template: |
746             #!/bin/bash
747             
748             # DNS/GW IP address configuration
749             mkdir /opt/config
750             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
751             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
752             resolvconf -u
753           
754             # Download dependencies
755             add-apt-repository -y ppa:openjdk-r/ppa
756             apt-get update
757             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
758             
759             # Download scripts from Nexus
760             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_vm_init.sh -o /opt/asdc_vm_init.sh
761             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_serv.sh -o /opt/asdc_serv.sh
762             chmod +x /opt/asdc_vm_init.sh
763             chmod +x /opt/asdc_serv.sh
764             mv /opt/asdc_serv.sh /etc/init.d
765             update-rc.d asdc_serv.sh defaults
766             
767             # Download and install docker-engine and docker-compose
768             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
769             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
770             apt-get update
771             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
772             apt-get install -y docker-engine
773             service docker start
774             mkdir /opt/docker
775             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
776             chmod +x /opt/docker/docker-compose
777
778             # Create partition and mount the external volume
779             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_ext_volume_partitions.txt -o /opt/asdc_ext_volume_partitions.txt
780             sfdisk /dev/xvdb < /opt/asdc_ext_volume_partitions.txt
781             mkfs -t ext4 /dev/xvdb1
782             mkdir -p /data
783             mount /dev/xvdb1 /data
784             echo "/dev/xvdb1  /data           ext4    errors=remount-ro,noatime,barrier=0 0       1" >> /etc/fstab
785
786             # Store credentials in files
787             mkdir -p /opt/config
788             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
789             echo "__nexus_username__" > /opt/config/nexus_username.txt
790             echo "__nexus_password__" > /opt/config/nexus_password.txt
791             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
792             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
793             echo "__env_name__" > /opt/config/env_name.txt
794             echo "10.0.11.1" > /opt/config/mr_ip_addr.txt
795
796             # Run SDC-specific instructions
797             cd /opt
798             mkdir -p /data/environments
799             mkdir -p /data/scripts
800             mkdir -p /data/logs/BE
801             mkdir -p /data/logs/FE
802             chmod 777 /data
803             chmod 777 /data/logs/BE
804             chmod 777 /data/logs/FE
805
806             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/sdc.git
807
808             cat > /root/.bash_aliases << EOF
809             alias dcls='/data/scripts/docker_clean.sh \$1'
810             alias dlog='/data/scripts/docker_login.sh \$1'
811             alias rund='/data/scripts/docker_run.sh'
812             alias health='/data/scripts/docker_health.sh'
813             EOF
814
815             # Run docker-compose to spin up containers
816             ./asdc_vm_init.sh
817             
818
819   # PORTAL instantiation
820   portal_private_port:
821     type: OS::Neutron::Port
822     properties:
823       network: { get_resource: oam_ecomp }
824       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.9.1}]
825
826   portal_volume:
827     type: OS::Cinder::Volume
828     properties:
829       name: vol1-portal
830       size: 50
831       volume_type: SSD
832       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
833
834   portal_vm:
835     type: OS::Nova::Server
836     properties:
837       flavor: 15 GB Memory v1
838       name: vm1-portal
839       key_name: { get_resource: vm_key }
840       block_device_mapping:
841         - volume_id: { get_resource: portal_volume }
842           device_name: vda
843       networks:
844         - network: { get_param: public_net_id }
845         - port: { get_resource: portal_private_port }
846       user_data_format: RAW
847       user_data:
848         str_replace:
849           params:
850             __nexus_repo__: { get_param: nexus_repo }
851             __nexus_docker_repo__: { get_param: nexus_docker_repo }
852             __nexus_username__: { get_param: nexus_username }
853             __nexus_password__: { get_param: nexus_password }
854             __gitlab_username__: { get_param: gitlab_username }
855             __gitlab_password__: { get_param: gitlab_password }
856             __artifacts_version__: { get_param: artifacts_version }
857           template: |
858             #!/bin/bash
859             
860             # DNS/GW IP address configuration
861             mkdir /opt/config
862             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
863             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
864             resolvconf -u
865             
866             # Download dependencies
867             add-apt-repository -y ppa:openjdk-r/ppa
868             apt-get update
869             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk unzip mysql-client-core-5.6 ntp ntpdate
870             
871             # Download scripts from Nexus
872             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/portal_vm_init.sh -o /opt/portal_vm_init.sh
873             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/portal_serv.sh -o /opt/portal_serv.sh
874             chmod +x /opt/portal_vm_init.sh
875             chmod +x /opt/portal_serv.sh
876             mv /opt/portal_serv.sh /etc/init.d
877             update-rc.d portal_serv.sh defaults
878             
879             # Download and install docker-engine and docker-compose
880             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
881             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
882             apt-get update
883             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
884             apt-get install -y docker-engine
885             service docker start
886             mkdir /opt/docker
887             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
888             chmod +x /opt/docker/docker-compose
889
890             # Store credentials in files
891             mkdir -p /opt/config
892             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
893             echo "__nexus_username__" > /opt/config/nexus_username.txt
894             echo "__nexus_password__" > /opt/config/nexus_password.txt
895             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
896             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
897
898             # Run Portal-specific instructions
899             mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
900             cd /opt
901             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/portal.git
902
903             # Run docker-compose to spin up containers
904             ./portal_vm_init.sh
905
906
907   # DCAE Controller instantiation
908   dcae_c_private_port:
909     type: OS::Neutron::Port
910     properties:
911       network: { get_resource: oam_ecomp }
912       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.4.1}]
913   dcae_c_vm:
914     type: OS::Nova::Server
915     properties:
916       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
917       flavor: 8 GB General Purpose v1
918       name: vm1-dcae-controller
919       key_name: { get_resource: vm_key }
920       networks:
921         - network: { get_param: public_net_id }
922         - port: { get_resource: dcae_c_private_port }
923       user_data_format: RAW
924       user_data: 
925         str_replace:
926           params:
927             __nexus_repo__: { get_param: nexus_repo }
928             __nexus_docker_repo__: { get_param: nexus_docker_repo }
929             __nexus_username__: { get_param: nexus_username }
930             __nexus_password__: { get_param: nexus_password }
931             __nexus_url_snapshots__: { get_param: nexus_url_snapshot }
932             __gitlab_username__: { get_param: gitlab_username }
933             __gitlab_password__: { get_param: gitlab_password }
934             __gitlab_branch__: { get_param: gitlab_branch }
935             __dcae_zone__: { get_param: dcae_zone }
936             __dcae_state__: { get_param: dcae_state }
937             __artifacts_version__: { get_param: artifacts_version }
938             __tenant_id__: { get_param: openstack_tenant_id }
939             __openstack_private_network_name__: { get_attr: [oam_ecomp, name] }
940             __openstack_user__: { get_param: openstack_username }
941             __openstack_password__: { get_param: openstack_api_key }
942             __key_name__: { get_param: key_name }
943             __rand_str__: { get_resource: random-str }
944             __pub_key__: { get_param: pub_key }
945             __nexus_repo_root__: { get_param: nexus_repo_root }
946             __openstack_region__: { get_param: openstack_region }
947           template: |
948             #!/bin/bash
949             
950             # DNS/GW IP address configuration
951             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
952             resolvconf -u
953
954             # Download dependencies
955             add-apt-repository -y ppa:openjdk-r/ppa
956             apt-get update
957             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk make git ntp ntpdate
958
959             # Download scripts from Nexus
960             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/dcae_vm_init.sh -o /opt/dcae_vm_init.sh
961             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/dcae_serv.sh -o /opt/dcae_serv.sh
962             chmod +x /opt/dcae_vm_init.sh
963             chmod +x /opt/dcae_serv.sh
964             mv /opt/dcae_serv.sh /etc/init.d
965             update-rc.d dcae_serv.sh defaults
966
967             # Download and install docker-engine and docker-compose
968             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
969             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
970             apt-get update
971             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
972             apt-get install -y docker-engine
973             service docker start
974             mkdir /opt/docker
975             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
976             chmod +x /opt/docker/docker-compose
977             
978             # DCAE Controller specific deployment
979             cd /opt
980             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/controller.git dcae-startup-vm-controller
981
982             cd dcae-startup-vm-controller
983             mkdir -p /opt/app/dcae-controller
984             cat > /opt/app/dcae-controller/config.yaml << EOF_CONFIG
985             ZONE: __dcae_zone__
986             STATE: __dcae_state__
987             DCAE-VERSION: __artifacts_version__
988             HORIZON-URL: https://mycloud.rackspace.com/cloud/__tenant_id__
989             KEYSTONE-URL: https://identity.api.rackspacecloud.com/v2.0
990             OPENSTACK-TENANT-ID: __tenant_id__
991             OPENSTACK-TENANT-NAME: OPEN-ECOMP
992             OPENSTACK-REGION: __openstack_region__
993             OPENSTACK-PRIVATE-NETWORK: __openstack_private_network_name__
994             OPENSTACK-USER: __openstack_user__
995             OPENSTACK-PASSWORD: __openstack_password__
996             OPENSTACK-KEYNAME: __key_name_____rand_str___dcae
997             OPENSTACK-PUBKEY: __pub_key__
998             
999             NEXUS-URL-ROOT: __nexus_repo_root__
1000             NEXUS-USER: __nexus_username__
1001             NEXUS-PASSWORD: __nexus_password__
1002             NEXUS-URL-SNAPSHOTS: __nexus_url_snapshots__
1003             NEXUS-RAWURL: __nexus_repo__
1004             
1005             DOCKER-REGISTRY: __nexus_docker_repo__
1006
1007             GIT-MR-REPO: https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/message-router.git
1008             EOF_CONFIG
1009
1010             # Store credentials in files
1011             mkdir -p /opt/config
1012             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1013             echo "__nexus_username__" > /opt/config/nexus_username.txt
1014             echo "__nexus_password__" > /opt/config/nexus_password.txt
1015             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1016             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1017             echo "__gitlab_branch__" > /opt/config/gitlab_branch.txt
1018
1019             cd /opt
1020             ./dcae_vm_init.sh
1021
1022
1023   # Policy engine instantiation
1024   policy_private_port:
1025     type: OS::Neutron::Port
1026     properties:
1027       network: { get_resource: oam_ecomp }
1028       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.6.1}]
1029
1030   policy_volume:
1031     type: OS::Cinder::Volume
1032     properties:
1033       name: vol1-policy
1034       size: 50
1035       volume_type: SSD
1036       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
1037
1038   policy_vm:
1039     type: OS::Nova::Server
1040     properties:
1041       flavor: 15 GB Compute v1
1042       name: vm1-policy
1043       key_name: { get_resource: vm_key }
1044       block_device_mapping:
1045         - volume_id: { get_resource: policy_volume }
1046           device_name: vda
1047       networks:
1048         - network: { get_param: public_net_id }
1049         - port: { get_resource: policy_private_port }
1050       user_data_format: RAW
1051       user_data:
1052         str_replace:
1053           params:
1054             __nexus_repo__: { get_param: nexus_repo }
1055             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1056             __nexus_username__: { get_param: nexus_username }
1057             __nexus_password__: { get_param: nexus_password }
1058             __gitlab_username__: { get_param: gitlab_username }
1059             __gitlab_password__: { get_param: gitlab_password }
1060             __artifacts_version__: { get_param: artifacts_version }
1061           template: |
1062             #!/bin/bash
1063             
1064             # DNS/GW IP address configuration
1065             mkdir /opt/config
1066             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
1067             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
1068             resolvconf -u
1069
1070             # Download dependencies
1071             add-apt-repository -y ppa:openjdk-r/ppa
1072             apt-get update
1073             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
1074
1075             # Download scripts from Nexus
1076             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/policy_vm_init.sh -o /opt/policy_vm_init.sh
1077             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/policy_serv.sh -o /opt/policy_serv.sh
1078             chmod +x /opt/policy_vm_init.sh
1079             chmod +x /opt/policy_serv.sh
1080             mv /opt/policy_serv.sh /etc/init.d
1081             update-rc.d policy_serv.sh defaults
1082
1083             # Download and install docker-engine and docker-compose
1084             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1085             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1086             apt-get update
1087             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1088             apt-get install -y docker-engine
1089             service docker start
1090             mkdir /opt/docker
1091             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1092             chmod +x /opt/docker/docker-compose
1093
1094             # Store credentials in files
1095             mkdir -p /opt/config
1096             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1097             echo "__nexus_username__" > /opt/config/nexus_username.txt
1098             echo "__nexus_password__" > /opt/config/nexus_password.txt
1099             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1100             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1101
1102             # Run docker-compose to spin up containers
1103             cd /opt
1104             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/policy/docker.git policy
1105
1106             ./policy_vm_init.sh
1107
1108
1109   # APP-C instantiation
1110   appc_private_port:
1111     type: OS::Neutron::Port
1112     properties:
1113       network: { get_resource: oam_ecomp }
1114       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.2.1}]
1115
1116   appc_vm:
1117     type: OS::Nova::Server
1118     properties:
1119       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
1120       flavor: 4 GB General Purpose v1
1121       name: vm1-appc
1122       key_name: { get_resource: vm_key }
1123       networks:
1124         - network: { get_param: public_net_id }
1125         - port: { get_resource: appc_private_port }
1126       user_data_format: RAW
1127       user_data:
1128         str_replace:
1129           params:
1130             __nexus_repo__: { get_param: nexus_repo }
1131             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1132             __nexus_username__: { get_param: nexus_username }
1133             __nexus_password__: { get_param: nexus_password }
1134             __gitlab_username__: { get_param: gitlab_username }
1135             __gitlab_password__: { get_param: gitlab_password }
1136             __dmaap_topic__: { get_param: dmaap_topic }
1137             __artifacts_version__: { get_param: artifacts_version }
1138           template: |
1139             #!/bin/bash
1140
1141             # DNS/GW IP address configuration
1142             mkdir /opt/config
1143             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
1144             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
1145             resolvconf -u
1146
1147             # Download dependencies
1148             add-apt-repository -y ppa:openjdk-r/ppa
1149             apt-get update
1150             apt-get install -y apt-transport-https ca-certificates wget openjdk-7-jdk ntp ntpdate
1151
1152             # Download scripts from Nexus
1153             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/appc_vm_init.sh -o /opt/appc_vm_init.sh
1154             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/appc_serv.sh -o /opt/appc_serv.sh
1155             chmod +x /opt/appc_vm_init.sh
1156             chmod +x /opt/appc_serv.sh
1157             mv /opt/appc_serv.sh /etc/init.d
1158             update-rc.d appc_serv.sh defaults
1159             
1160             # Download and install docker-engine and docker-compose
1161             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1162             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1163             apt-get update
1164             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1165             apt-get install -y docker-engine
1166             service docker start
1167
1168             mkdir /opt/docker
1169             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1170             chmod +x /opt/docker/docker-compose
1171             
1172             # Store credentials in files
1173             mkdir -p /opt/config
1174             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1175             echo "__nexus_username__" > /opt/config/nexus_username.txt
1176             echo "__nexus_password__" > /opt/config/nexus_password.txt
1177             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1178             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1179             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
1180
1181             # Run docker-compose to spin up containers
1182             cd /opt
1183             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/appc/deployment.git appc
1184             ./appc_vm_init.sh
1185