upload heat templates
[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             __nexus_docker_repo__: { get_param: nexus_docker_repo }
182             __nexus_username__: { get_param: nexus_username }
183             __nexus_password__: { get_param: nexus_password }
184             __gitlab_username__: { get_param: gitlab_username }
185             __gitlab_password__: { get_param: gitlab_password }
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           template: |
249             #!/bin/bash
250
251             # DNS/GW IP address configuration
252             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
253             resolvconf -u
254             
255             # Download dependencies
256             add-apt-repository -y ppa:openjdk-r/ppa
257             apt-get update
258             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
259
260             # Download scripts from Nexus
261             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/aai_vm_init.sh -o /opt/aai_vm_init.sh
262             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/aai_serv.sh -o /opt/aai_serv.sh
263             chmod +x /opt/aai_vm_init.sh
264             chmod +x /opt/aai_serv.sh
265             mv /opt/aai_serv.sh /etc/init.d
266             update-rc.d aai_serv.sh defaults
267
268             # Download and install docker-engine and docker-compose
269             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
270             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
271             apt-get update
272             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
273             apt-get install -y docker-engine
274             service docker start
275
276             mkdir -p /opt/openecomp/aai/logs
277             mkdir -p /opt/openecomp/aai/data
278             mkdir /opt/docker
279             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
280             chmod +x /opt/docker/docker-compose
281             
282             # Store credentials in files
283             mkdir -p /opt/config
284             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
285             echo "__nexus_username__" > /opt/config/nexus_username.txt
286             echo "__nexus_password__" > /opt/config/nexus_password.txt
287             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
288             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
289             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
290             echo "gerrit.openecomp.org" > /opt/config/gitlab_certname.txt
291             # Execute docker instructions
292             cd /opt
293             ./aai_vm_init.sh
294
295
296   # MSO instantiation
297   mso_private_port:
298     type: OS::Neutron::Port
299     properties:
300       network: { get_resource: oam_ecomp }
301       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.5.1}]
302
303   mso_vm:
304     type: OS::Nova::Server
305     properties:
306       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
307       flavor: 4 GB General Purpose v1
308       name: vm1-mso
309       key_name: { get_resource: vm_key }
310       networks:
311         - network: { get_param: public_net_id }
312         - port: { get_resource: mso_private_port }
313       user_data_format: RAW
314       user_data:
315         str_replace:
316           params:
317             __nexus_repo__: { get_param: nexus_repo }
318             __nexus_docker_repo__: { get_param: nexus_docker_repo }
319             __nexus_username__: { get_param: nexus_username }
320             __nexus_password__: { get_param: nexus_password }
321             __gitlab_username__: { get_param: gitlab_username }
322             __gitlab_password__: { get_param: gitlab_password }
323             __openstack_username__: { get_param: openstack_username }
324             __openstack_tenant_id__: { get_param: openstack_tenant_id }
325             __openstack_api_key__: { get_param: openstack_api_key }
326             __dmaap_topic__: { get_param: dmaap_topic }
327             __artifacts_version__: { get_param: artifacts_version }
328           template: |
329             #!/bin/bash
330
331             # DNS/GW IP address configuration
332             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
333             resolvconf -u
334
335             # Download dependencies
336             add-apt-repository -y ppa:openjdk-r/ppa
337             apt-get update
338             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate
339
340             # Download scripts from Nexus
341             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mso_vm_init.sh -o /opt/mso_vm_init.sh
342             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mso_serv.sh -o /opt/mso_serv.sh
343             chmod +x /opt/mso_vm_init.sh
344             chmod +x /opt/mso_serv.sh
345             mv /opt/mso_serv.sh /etc/init.d
346             update-rc.d mso_serv.sh defaults
347
348             # Download and install docker-engine and docker-compose
349             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
350             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
351             apt-get update
352             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
353             apt-get install -y docker-engine
354             service docker start
355
356             mkdir /opt/docker
357             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
358             chmod +x /opt/docker/docker-compose
359
360             # Store credentials in files
361             mkdir -p /opt/config
362             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
363             echo "__nexus_username__" > /opt/config/nexus_username.txt
364             echo "__nexus_password__" > /opt/config/nexus_password.txt
365             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
366             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
367             echo "__openstack_username__" > /opt/config/openstack_username.txt
368             echo "__openstack_tenant_id__" > /opt/config/tenant_id.txt
369             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
370            
371
372             # Run docker-compose to spin up containers
373             cd /opt
374             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/mso/docker-config.git test_lab
375             MSO_ENCRYPTION_KEY=$(cat /opt/test_lab/encryption.key)
376             echo -n "__openstack_api_key__" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt
377             ./mso_vm_init.sh
378
379
380   # Message Router instantiation
381   mrouter_private_port:
382     type: OS::Neutron::Port
383     properties:
384       network: { get_resource: oam_ecomp }
385       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.11.1}]
386
387   mrouter_vm:
388     type: OS::Nova::Server
389     properties:
390       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
391       flavor: 15 GB I/O v1
392       name: vm1-message-router
393       key_name: { get_resource: vm_key }
394       networks:
395         - network: { get_param: public_net_id }
396         - port: { get_resource: mrouter_private_port }
397       user_data_format: RAW
398       user_data:
399         str_replace:
400           params:
401             __nexus_repo__: { get_param: nexus_repo }
402             __nexus_docker_repo__: { get_param: nexus_docker_repo }
403             __nexus_username__: { get_param: nexus_username }
404             __nexus_password__: { get_param: nexus_password }
405             __gitlab_username__: { get_param: gitlab_username }
406             __gitlab_password__: { get_param: gitlab_password }
407             __artifacts_version__: { get_param: artifacts_version }
408           template: |
409             #!/bin/bash
410
411             # DNS/GW IP address configuration
412             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
413             resolvconf -u
414
415             # Download dependencies
416             add-apt-repository -y ppa:openjdk-r/ppa
417             apt-get update
418             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
419             
420             # Download scripts from Nexus
421             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mr_vm_init.sh -o /opt/mr_vm_init.sh
422             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/mr_serv.sh -o /opt/mr_serv.sh
423             chmod +x /opt/mr_vm_init.sh
424             chmod +x /opt/mr_serv.sh
425             mv /opt/mr_serv.sh /etc/init.d
426             update-rc.d mr_serv.sh defaults
427
428             # Download and install docker-engine and docker-compose
429             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
430             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
431             apt-get update
432             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
433             apt-get install -y docker-engine
434             service docker start
435
436             mkdir /opt/docker
437             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
438             chmod +x /opt/docker/docker-compose
439
440             # Store credentials in files
441             mkdir -p /opt/config
442             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
443             echo "__nexus_username__" > /opt/config/nexus_username.txt
444             echo "__nexus_password__" > /opt/config/nexus_password.txt
445             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
446             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
447
448             # Run docker-compose to spin up containers
449             cd /opt
450             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/message-router.git dcae-startup-vm-message-router
451             ./mr_vm_init.sh
452
453
454   # RobotE2E instantiation
455   robot_private_port:
456     type: OS::Neutron::Port
457     properties:
458       network: { get_resource: oam_ecomp }
459       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.10.1}]
460  
461   robot_vm:
462     type: OS::Nova::Server
463     properties:
464       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
465       flavor: 2 GB General Purpose v1
466       name: vm1-robot
467       key_name: { get_resource: vm_key }
468       networks:
469         - network: { get_param: public_net_id }
470         - port: { get_resource: robot_private_port }
471       user_data_format: RAW
472       user_data:
473         str_replace:
474           params:
475             __nexus_repo__: { get_param: nexus_repo }
476             __nexus_docker_repo__: { get_param: nexus_docker_repo }
477             __nexus_username__: { get_param: nexus_username }
478             __nexus_password__: { get_param: nexus_password }
479             __gitlab_username__: { get_param: gitlab_username }
480             __gitlab_password__: { get_param: gitlab_password }
481             __network_name__: { get_attr: [oam_ecomp, name] }
482             __openstack_username__: { get_param: openstack_username }
483             __openstack_api_key__: { get_param : openstack_api_key }
484             __openstack_password__: { get_param: openstack_password }
485             __artifacts_version__: { get_param: artifacts_version }
486             __openstack_region__: { get_param: openstack_region }
487           template: |
488             #!/bin/bash
489
490             # DNS/GW IP address configuration
491             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
492             resolvconf -u
493  
494             # Download dependencies
495             add-apt-repository -y ppa:openjdk-r/ppa
496             apt-get update
497             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
498
499             # Download scripts from Nexus
500             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/robot_vm_init.sh -o /opt/robot_vm_init.sh
501             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/robot_serv.sh -o /opt/robot_serv.sh
502             chmod +x /opt/robot_vm_init.sh
503             chmod +x /opt/robot_serv.sh
504             mv /opt/robot_serv.sh /etc/init.d
505             update-rc.d robot_serv.sh defaults
506  
507             # Download and install docker-engine and docker-compose
508             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
509             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
510             apt-get update
511             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
512             apt-get install -y docker-engine
513             #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
514             service docker start
515  
516             mkdir /opt/docker
517             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
518             chmod +x /opt/docker/docker-compose
519  
520             # Store credentials in files
521             mkdir -p /opt/config
522             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
523             echo "__nexus_repo__" > /opt/config/nexus_repo.txt
524             echo "__nexus_username__" > /opt/config/nexus_username.txt
525             echo "__nexus_password__" > /opt/config/nexus_password.txt
526             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
527             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
528             echo "__network_name__" > /opt/config/network.txt
529             echo "__openstack_username__" > /opt/config/openstack_username.txt
530             echo "__openstack_password__" > /opt/config/openstack_password.txt
531             echo "__openstack_api_key__" > /opt/config/openstack_api_key.txt
532             echo "__openstack_region__" > /opt/config/region.txt
533
534             # Execute RobotETE-specific instructions: create share folder to run as a docker volume
535             mkdir -p /opt/eteshare/logs
536             mkdir -p /opt/eteshare/config
537
538             # Run docker-compose to spin up containers
539             cd /opt
540             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/testsuite/properties.git testsuite/properties
541             ./robot_vm_init.sh
542
543
544   # VID instantiation
545   vid_private_port:
546     type: OS::Neutron::Port
547     properties:
548       network: { get_resource: oam_ecomp }
549       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.8.1}]
550
551   vid_vm:
552     type: OS::Nova::Server
553     properties:
554       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
555       flavor: 2 GB General Purpose v1
556       name: vm1-vid
557       key_name: { get_resource: vm_key }
558       networks:
559         - network: { get_param: public_net_id }
560         - port: { get_resource: vid_private_port }
561       user_data_format: RAW
562       user_data:
563         str_replace:
564           params:
565             __nexus_repo__: { get_param: nexus_repo }
566             __nexus_docker_repo__: { get_param: nexus_docker_repo }
567             __nexus_username__: { get_param: nexus_username }
568             __nexus_password__: { get_param: nexus_password }
569             __gitlab_username__: { get_param: gitlab_username }
570             __gitlab_password__: { get_param: gitlab_password }
571             __artifacts_version__: { get_param: artifacts_version }
572           template: |
573             #!/bin/bash
574
575             # DNS/GW IP address configuration
576             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
577             resolvconf -u
578
579             # Download dependencies
580             add-apt-repository -y ppa:openjdk-r/ppa
581             apt-get update
582             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk make git ntp ntpdate
583
584             # Download scripts from Nexus
585             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/vid_vm_init.sh -o /opt/vid_vm_init.sh
586             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/vid_serv.sh -o /opt/vid_serv.sh
587             chmod +x /opt/vid_vm_init.sh
588             chmod +x /opt/vid_serv.sh
589             mv /opt/vid_serv.sh /etc/init.d
590             update-rc.d vid_serv.sh defaults
591
592             # Download and install docker-engine and docker-compose
593             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
594             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
595             apt-get update
596             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
597             apt-get install -y docker-engine
598             service docker start
599
600             mkdir /opt/docker
601             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
602             chmod +x /opt/docker/docker-compose
603
604             # Store credentials in files
605             mkdir -p /opt/config
606             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
607             echo "__nexus_username__" > /opt/config/nexus_username.txt
608             echo "__nexus_password__" > /opt/config/nexus_password.txt
609             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
610             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
611
612             # Run script to spin up containers
613             cd /opt
614             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/vid.git
615             ./vid_vm_init.sh
616
617
618   # SDN-C instantiation
619   sdnc_private_port:
620     type: OS::Neutron::Port
621     properties:
622       network: { get_resource: oam_ecomp }
623       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.7.1}]
624
625   sdnc_vm:
626     type: OS::Nova::Server
627     properties:
628       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
629       flavor: 4 GB General Purpose v1
630       name: vm1-sdnc
631       key_name: { get_resource: vm_key }
632       networks:
633         - network: { get_param: public_net_id }
634         - port: { get_resource: sdnc_private_port }
635       user_data_format: RAW
636       user_data:
637         str_replace:
638           params:
639             __nexus_repo__: { get_param: nexus_repo }
640             __nexus_docker_repo__: { get_param: nexus_docker_repo }
641             __nexus_username__: { get_param: nexus_username }
642             __nexus_password__: { get_param: nexus_password }
643             __gitlab_username__: { get_param: gitlab_username }
644             __gitlab_password__: { get_param: gitlab_password }
645             __artifacts_version__: { get_param: artifacts_version }
646           template: |
647             #!/bin/bash
648
649             # DNS/GW IP address configuration
650             mkdir /opt/config
651             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
652             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
653             resolvconf -u
654
655             # Download dependencies
656             add-apt-repository -y ppa:openjdk-r/ppa
657             apt-get update
658             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
659
660             # Download scripts from Nexus
661             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/sdnc_vm_init.sh -o /opt/sdnc_vm_init.sh
662             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/sdnc_serv.sh -o /opt/sdnc_serv.sh
663             chmod +x /opt/sdnc_vm_init.sh
664             chmod +x /opt/sdnc_serv.sh
665             mv /opt/sdnc_serv.sh /etc/init.d
666             update-rc.d sdnc_serv.sh defaults
667             
668             # Download and install docker-engine and docker-compose
669             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
670             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
671             apt-get update
672             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
673             apt-get install -y docker-engine
674             service docker start
675
676             mkdir /opt/docker
677             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
678             chmod +x /opt/docker/docker-compose
679             
680             # Store credentials in files
681             mkdir -p /opt/config
682             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
683             echo "__nexus_username__" > /opt/config/nexus_username.txt
684             echo "__nexus_password__" > /opt/config/nexus_password.txt
685             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
686             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
687
688             # Run docker-compose to spin up containers
689             cd /opt
690             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/sdnc/oam.git sdnc
691             ./sdnc_vm_init.sh
692
693
694   # SDC instantiation
695   sdc_private_port:
696     type: OS::Neutron::Port
697     properties:
698       network: { get_resource: oam_ecomp }
699       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.3.1}]
700
701   sdc_volume_local:
702     type: OS::Cinder::Volume
703     properties:
704       name: vol1-sdc-local
705       size: 50
706       volume_type: SSD
707       image: Ubuntu 16.04 LTS (Xenial Xerus) (PVHVM)
708
709   sdc_volume_data:
710     type: OS::Cinder::Volume
711     properties:
712       name: vol1-sdc-data
713       size: 100
714       volume_type: SSD
715
716   sdc_volume_attachment:
717     type: OS::Cinder::VolumeAttachment
718     properties:
719       volume_id: { get_resource: sdc_volume_data }
720       instance_uuid: { get_resource: sdc_vm }
721       mountpoint: /dev/xvdb
722
723   sdc_vm:
724     type: OS::Nova::Server
725     properties:
726       flavor: 15 GB Compute v1
727       name: vm1-sdc
728       key_name: { get_resource: vm_key }
729       block_device_mapping:
730         - volume_id: { get_resource: sdc_volume_local }
731           device_name: vda
732       networks:
733         - network: { get_param: public_net_id }
734         - port: { get_resource: sdc_private_port }
735       user_data_format: RAW
736       user_data:
737         str_replace:
738           params:
739             __nexus_repo__: { get_param: nexus_repo }
740             __nexus_docker_repo__: { get_param: nexus_docker_repo }
741             __nexus_username__: { get_param: nexus_username }
742             __nexus_password__: { get_param: nexus_password }
743             __gitlab_username__: { get_param: gitlab_username }
744             __gitlab_password__: { get_param: gitlab_password }
745             __env_name__: { get_param: dmaap_topic }
746             __artifacts_version__: { get_param: artifacts_version }
747           template: |
748             #!/bin/bash
749             # DNS/GW IP address configuration
750             mkdir /opt/config
751             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
752             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
753             resolvconf -u
754           
755             # Download dependencies
756             add-apt-repository -y ppa:openjdk-r/ppa
757             apt-get update
758             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
759             
760             # Download scripts from Nexus
761             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_vm_init.sh -o /opt/asdc_vm_init.sh
762             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/asdc_serv.sh -o /opt/asdc_serv.sh
763             chmod +x /opt/asdc_vm_init.sh
764             chmod +x /opt/asdc_serv.sh
765             mv /opt/asdc_serv.sh /etc/init.d
766             update-rc.d asdc_serv.sh defaults
767             
768             # Download and install docker-engine and docker-compose
769             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
770             echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
771             apt-get update
772             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
773             apt-get install -y docker-engine
774             service docker start
775             mkdir /opt/docker
776             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
777             chmod +x /opt/docker/docker-compose
778
779             # Create partition and mount the external volume
780             curl --user '__nexus_username__:__nexus_password__' __nexus_repo__/org.openecomp.boot/asdc_ext_volume_partitions.txt -o /opt/asdc_ext_volume_partitions.txt
781             sfdisk /dev/xvdb < /opt/asdc_ext_volume_partitions.txt
782             mkfs -t ext4 /dev/xvdb1
783             mkdir -p /data
784             mount /dev/xvdb1 /data
785             echo "/dev/xvdb1  /data           ext4    errors=remount-ro,noatime,barrier=0 0       1" >> /etc/fstab
786
787             # Store credentials in files
788             mkdir -p /opt/config
789             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
790             echo "__nexus_username__" > /opt/config/nexus_username.txt
791             echo "__nexus_password__" > /opt/config/nexus_password.txt
792             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
793             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
794             echo "__env_name__" > /opt/config/env_name.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 775 /data
803             chmod 775 /data/logs/BE
804             chmod 775 /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             # DNS/GW IP address configuration
860             mkdir /opt/config
861             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
862             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
863             resolvconf -u
864             
865             # Download dependencies
866             add-apt-repository -y ppa:openjdk-r/ppa
867             apt-get update
868             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk unzip mysql-client-core-5.6 ntp ntpdate
869             
870             # Download scripts from Nexus
871             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/portal_vm_init.sh -o /opt/portal_vm_init.sh
872             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/portal_serv.sh -o /opt/portal_serv.sh
873             chmod +x /opt/portal_vm_init.sh
874             chmod +x /opt/portal_serv.sh
875             mv /opt/portal_serv.sh /etc/init.d
876             update-rc.d portal_serv.sh defaults
877             
878             # Download and install docker-engine and docker-compose
879             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
880             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
881             apt-get update
882             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
883             apt-get install -y docker-engine
884             service docker start
885             mkdir /opt/docker
886             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
887             chmod +x /opt/docker/docker-compose
888
889             # Store credentials in files
890             mkdir -p /opt/config
891             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
892             echo "__nexus_username__" > /opt/config/nexus_username.txt
893             echo "__nexus_password__" > /opt/config/nexus_password.txt
894             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
895             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
896
897             # Run Portal-specific instructions
898             mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
899             cd /opt
900             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/portal.git
901
902             # Run docker-compose to spin up containers
903             ./portal_vm_init.sh
904
905
906   # DCAE Controller instantiation
907   dcae_c_private_port:
908     type: OS::Neutron::Port
909     properties:
910       network: { get_resource: oam_ecomp }
911       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.4.1}]
912   dcae_c_vm:
913     type: OS::Nova::Server
914     properties:
915       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
916       flavor: 8 GB General Purpose v1
917       name: vm1-dcae-controller
918       key_name: { get_resource: vm_key }
919       networks:
920         - network: { get_param: public_net_id }
921         - port: { get_resource: dcae_c_private_port }
922       user_data_format: RAW
923       user_data: 
924         str_replace:
925           params:
926             __nexus_repo__: { get_param: nexus_repo }
927             __nexus_docker_repo__: { get_param: nexus_docker_repo }
928             __nexus_username__: { get_param: nexus_username }
929             __nexus_password__: { get_param: nexus_password }
930             __nexus_url_snapshots__: { get_param: nexus_url_snapshot }
931             __gitlab_username__: { get_param: gitlab_username }
932             __gitlab_password__: { get_param: gitlab_password }
933             __gitlab_branch__: { get_param: gitlab_branch }
934             __dcae_zone__: { get_param: dcae_zone }
935             __dcae_state__: { get_param: dcae_state }
936             __artifacts_version__: { get_param: artifacts_version }
937             __tenant_id__: { get_param: openstack_tenant_id }
938             __openstack_private_network_name__: { get_attr: [oam_ecomp, name] }
939             __openstack_user__: { get_param: openstack_username }
940             __openstack_password__: { get_param: openstack_api_key }
941             __key_name__: { get_param: key_name }
942             __rand_str__: { get_resource: random-str }
943             __pub_key__: { get_param: pub_key }
944             __nexus_repo_root__: { get_param: nexus_repo_root }
945             __openstack_region__: { get_param: openstack_region }
946           template: |
947             #!/bin/bash
948             # DNS/GW IP address configuration
949             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
950             resolvconf -u
951
952             # Download dependencies
953             add-apt-repository -y ppa:openjdk-r/ppa
954             apt-get update
955             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk make git ntp ntpdate
956
957             # Download scripts from Nexus
958             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/dcae_vm_init.sh -o /opt/dcae_vm_init.sh
959             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/dcae_serv.sh -o /opt/dcae_serv.sh
960             chmod +x /opt/dcae_vm_init.sh
961             chmod +x /opt/dcae_serv.sh
962             mv /opt/dcae_serv.sh /etc/init.d
963             update-rc.d dcae_serv.sh defaults
964
965             # Download and install docker-engine and docker-compose
966             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
967             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
968             apt-get update
969             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
970             apt-get install -y docker-engine
971             service docker start
972             mkdir /opt/docker
973             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
974             chmod +x /opt/docker/docker-compose
975             
976             # DCAE Controller specific deployment
977             cd /opt
978             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/controller.git dcae-startup-vm-controller
979
980             cd dcae-startup-vm-controller
981             mkdir -p /opt/app/dcae-controller
982             cat > /opt/app/dcae-controller/config.yaml << EOF_CONFIG
983             ZONE: __dcae_zone__
984             STATE: __dcae_state__
985             DCAE-VERSION: 0.1.0-SNAPSHOT
986             HORIZON-URL: https://mycloud.rackspace.com/cloud/__tenant_id__
987             KEYSTONE-URL: https://identity.api.rackspacecloud.com/v2.0
988             OPENSTACK-TENANT-ID: __tenant_id__
989             OPENSTACK-TENANT-NAME: OPEN-ECOMP
990             OPENSTACK-REGION: __openstack_region__
991             OPENSTACK-PRIVATE-NETWORK: __openstack_private_network_name__
992             OPENSTACK-USER: __openstack_user__
993             OPENSTACK-PASSWORD: __openstack_password__
994             OPENSTACK-KEYNAME: __key_name_____rand_str___dcae
995             OPENSTACK-PUBKEY: __pub_key__
996             
997             NEXUS-URL-ROOT: __nexus_repo_root__
998             NEXUS-USER: __nexus_username__
999             NEXUS-PASSWORD: __nexus_password__
1000             NEXUS-URL-SNAPSHOTS: __nexus_url_snapshots__
1001             NEXUS-RAWURL: __nexus_repo__
1002             
1003             DOCKER-REGISTRY: __nexus_docker_repo__
1004
1005             GIT-MR-REPO: https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/dcae/demo/startup/message-router.git
1006             EOF_CONFIG
1007
1008             # Store credentials in files
1009             mkdir -p /opt/config
1010             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1011             echo "__nexus_username__" > /opt/config/nexus_username.txt
1012             echo "__nexus_password__" > /opt/config/nexus_password.txt
1013             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1014             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1015             echo "__gitlab_branch__" > /opt/config/gitlab_branch.txt
1016
1017             cd /opt
1018             ./dcae_vm_init.sh
1019
1020
1021   # Policy engine instantiation
1022   policy_private_port:
1023     type: OS::Neutron::Port
1024     properties:
1025       network: { get_resource: oam_ecomp }
1026       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.6.1}]
1027
1028   policy_volume:
1029     type: OS::Cinder::Volume
1030     properties:
1031       name: vol1-policy
1032       size: 50
1033       volume_type: SSD
1034       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
1035
1036   policy_vm:
1037     type: OS::Nova::Server
1038     properties:
1039       flavor: 15 GB Compute v1
1040       name: vm1-policy
1041       key_name: { get_resource: vm_key }
1042       block_device_mapping:
1043         - volume_id: { get_resource: policy_volume }
1044           device_name: vda
1045       networks:
1046         - network: { get_param: public_net_id }
1047         - port: { get_resource: policy_private_port }
1048       user_data_format: RAW
1049       user_data:
1050         str_replace:
1051           params:
1052             __nexus_repo__: { get_param: nexus_repo }
1053             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1054             __nexus_username__: { get_param: nexus_username }
1055             __nexus_password__: { get_param: nexus_password }
1056             __gitlab_username__: { get_param: gitlab_username }
1057             __gitlab_password__: { get_param: gitlab_password }
1058             __artifacts_version__: { get_param: artifacts_version }
1059           template: |
1060             #!/bin/bash
1061             # DNS/GW IP address configuration
1062             mkdir /opt/config
1063             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
1064             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
1065             resolvconf -u
1066
1067             # Download dependencies
1068             add-apt-repository -y ppa:openjdk-r/ppa
1069             apt-get update
1070             apt-get install -y apt-transport-https ca-certificates wget openjdk-8-jdk ntp ntpdate
1071
1072             # Download scripts from Nexus
1073             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/policy_vm_init.sh -o /opt/policy_vm_init.sh
1074             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/policy_serv.sh -o /opt/policy_serv.sh
1075             chmod +x /opt/policy_vm_init.sh
1076             chmod +x /opt/policy_serv.sh
1077             mv /opt/policy_serv.sh /etc/init.d
1078             update-rc.d policy_serv.sh defaults
1079
1080             # Download and install docker-engine and docker-compose
1081             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1082             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1083             apt-get update
1084             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1085             apt-get install -y docker-engine
1086             service docker start
1087             mkdir /opt/docker
1088             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1089             chmod +x /opt/docker/docker-compose
1090
1091             # Store credentials in files
1092             mkdir -p /opt/config
1093             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1094             echo "__nexus_username__" > /opt/config/nexus_username.txt
1095             echo "__nexus_password__" > /opt/config/nexus_password.txt
1096             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1097             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1098
1099             # Run docker-compose to spin up containers
1100             cd /opt
1101             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/policy/docker.git policy
1102
1103             ./policy_vm_init.sh
1104
1105
1106   # APP-C instantiation
1107   appc_private_port:
1108     type: OS::Neutron::Port
1109     properties:
1110       network: { get_resource: oam_ecomp }
1111       fixed_ips: [{"subnet": { get_resource: oam_ecomp_subnet }, "ip_address": 10.0.2.1}]
1112
1113   appc_vm:
1114     type: OS::Nova::Server
1115     properties:
1116       image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
1117       flavor: 4 GB General Purpose v1
1118       name: vm1-appc
1119       key_name: { get_resource: vm_key }
1120       networks:
1121         - network: { get_param: public_net_id }
1122         - port: { get_resource: appc_private_port }
1123       user_data_format: RAW
1124       user_data:
1125         str_replace:
1126           params:
1127             __nexus_repo__: { get_param: nexus_repo }
1128             __nexus_docker_repo__: { get_param: nexus_docker_repo }
1129             __nexus_username__: { get_param: nexus_username }
1130             __nexus_password__: { get_param: nexus_password }
1131             __gitlab_username__: { get_param: gitlab_username }
1132             __gitlab_password__: { get_param: gitlab_password }
1133             __dmaap_topic__: { get_param: dmaap_topic }
1134             __artifacts_version__: { get_param: artifacts_version }
1135           template: |
1136             #!/bin/bash
1137
1138             # DNS/GW IP address configuration
1139             mkdir /opt/config
1140             echo "10.0.0.1" > /opt/config/dns_gw_ip.txt
1141             echo "nameserver 10.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
1142             resolvconf -u
1143
1144             # Download dependencies
1145             add-apt-repository -y ppa:openjdk-r/ppa
1146             apt-get update
1147             apt-get install -y apt-transport-https ca-certificates wget openjdk-7-jdk ntp ntpdate
1148
1149             # Download scripts from Nexus
1150             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/appc_vm_init.sh -o /opt/appc_vm_init.sh
1151             curl -k __nexus_repo__/org.openecomp.demo/boot/__artifacts_version__/appc_serv.sh -o /opt/appc_serv.sh
1152             chmod +x /opt/appc_vm_init.sh
1153             chmod +x /opt/appc_serv.sh
1154             mv /opt/appc_serv.sh /etc/init.d
1155             update-rc.d appc_serv.sh defaults
1156             
1157             # Download and install docker-engine and docker-compose
1158             apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
1159             echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
1160             apt-get update
1161             apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
1162             apt-get install -y docker-engine
1163             service docker start
1164
1165             mkdir /opt/docker
1166             curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
1167             chmod +x /opt/docker/docker-compose
1168             
1169             # Store credentials in files
1170             mkdir -p /opt/config
1171             echo "__nexus_docker_repo__" > /opt/config/nexus_docker_repo.txt
1172             echo "__nexus_username__" > /opt/config/nexus_username.txt
1173             echo "__nexus_password__" > /opt/config/nexus_password.txt
1174             echo "__gitlab_username__" > /opt/config/gitlab_username.txt
1175             echo "__gitlab_password__" > /opt/config/gitlab_password.txt
1176             echo "__dmaap_topic__" > /opt/config/dmaap_topic.txt
1177
1178             # Run docker-compose to spin up containers
1179             cd /opt
1180             git clone https://__gitlab_username__:__gitlab_password__@gerrit.openecomp.org/r/a/appc/deployment.git appc
1181             ./appc_vm_init.sh
1182