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