Build Congress RPM package
[apex.git] / build / overcloud-full.sh
1 #!/bin/sh
2 ##############################################################################
3 # Copyright (c) 2015 Tim Rozet (Red Hat), Dan Radez (Red Hat) and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -e
11 source ./cache.sh
12 source ./variables.sh
13 source ./functions.sh
14
15 populate_cache "$rdo_images_uri/overcloud-full.tar"
16
17 if [ ! -d images/ ]; then mkdir images; fi
18 tar -xf cache/overcloud-full.tar -C images/
19 mv -f images/overcloud-full.qcow2 images/overcloud-full_build.qcow2
20
21 # Add extra space to the overcloud image
22 qemu-img resize images/overcloud-full_build.qcow2 +1G
23 LIBGUESTFS_BACKEND=direct virt-customize -a images/overcloud-full_build.qcow2 \
24                                          --run-command 'resize2fs /dev/sda'
25
26 ##########################################################
27 #####  Prep initial overcloud image with common deps #####
28 ##########################################################
29
30 # prep opnfv-puppet-tripleo for undercloud
31 clone_fork opnfv-puppet-tripleo
32 pushd opnfv-puppet-tripleo > /dev/null
33 git archive --format=tar.gz --prefix=tripleo/ HEAD > ../opnfv-puppet-tripleo.tar.gz
34 popd > /dev/null
35
36 # download customized os-net-config
37 rm -fr os-net-config
38 git clone https://github.com/trozet/os-net-config.git -b stable/colorado
39 pushd os-net-config > /dev/null
40 pushd os_net_config > /dev/null
41 git archive --format=tar.gz --prefix=os_net_config/ HEAD > ../../os-net-config.tar.gz
42 popd > /dev/null
43 popd > /dev/null
44
45 pushd images > /dev/null
46
47 dpdk_pkg_str=''
48 for package in ${dpdk_rpms[@]}; do
49   curl -O "$dpdk_uri_base/$package"
50   dpdk_pkg_str+=" --upload $package:/root/dpdk_rpms"
51 done
52
53 # tar up the congress puppet module
54 rm -rf puppet-congress
55 git clone -b stable/mitaka https://github.com/radez/puppet-congress
56 pushd puppet-congress > /dev/null
57 git archive --format=tar.gz --prefix=congress/ origin/stable/mitaka > ../puppet-congress.tar.gz
58 popd > /dev/null
59
60 # create fd.io yum repo file
61 cat > /tmp/fdio-master.repo << EOF
62 [fdio-master]
63 name=fd.io master branch latest merge
64 baseurl=https://nexus.fd.io/content/repositories/fd.io.master.centos7/
65 enabled=1
66 gpgcheck=0
67 EOF
68
69 cat > /tmp/tacker.repo << EOF
70 [tacker-trozet]
71 name=Tacker RPMs built from https://github.com/trozet/ tacker repositories
72 baseurl=http://radez.fedorapeople.org/tacker/
73 enabled=1
74 gpgcheck=0
75 EOF
76
77 # tar up the fd.io module
78 rm -rf puppet-fdio
79 git clone https://github.com/radez/puppet-fdio
80 pushd puppet-fdio > /dev/null
81 git archive --format=tar.gz --prefix=fdio/ HEAD > ../puppet-fdio.tar.gz
82 popd > /dev/null
83
84 # tar up vsperf
85 rm -rf vsperf vsperf.tar.gz
86 git clone https://gerrit.opnfv.org/gerrit/vswitchperf vsperf
87 tar czf vsperf.tar.gz vsperf
88
89 # tar up the tacker puppet module
90 rm -rf puppet-tacker
91 # TODO move this back to radez puppet-tacker after PR is accepted
92 git clone -b fix_db_sync https://github.com/trozet/puppet-tacker
93 pushd puppet-tacker > /dev/null
94 git archive --format=tar.gz --prefix=tacker/ HEAD > ../puppet-tacker.tar.gz
95 popd > /dev/null
96
97 # installing forked opnfv-puppet-tripleo
98 # enable connection tracking for protocal sctp
99 # upload dpdk rpms but do not install
100 # enable connection tracking for protocal sctp
101 # install the congress rpms
102 # upload and explode the congress puppet module
103 # install doctor driver ## Can be removed in Newton
104 # install fd.io yum repo and packages
105 # upload puppet fdio
106 # git clone vsperf into the overcloud image
107 # upload tacker repo and install the packages
108 # upload the tacker puppet module and untar it
109 LIBGUESTFS_BACKEND=direct virt-customize \
110     --upload ../opnfv-puppet-tripleo.tar.gz:/etc/puppet/modules \
111     --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \
112     --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \
113     --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \
114     --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf opnfv-puppet-tripleo.tar.gz" \
115     --run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \
116     --run-command "mkdir /root/dpdk_rpms" \
117     $dpdk_pkg_str \
118     --install "centos-release-qemu-ev" \
119     --run-command "yum update -y" \
120     --run-command "yum remove -y qemu-system-x86" \
121     --upload ../os-net-config.tar.gz:/usr/lib/python2.7/site-packages \
122     --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf os-net-config.tar.gz" \
123     --upload ../noarch/openstack-congress-2016.1-1.el7.centos.noarch.rpm:/root/ \
124     --install /root/openstack-congress-2016.1-1.el7.centos.noarch.rpm \
125     --install "python2-congressclient" \
126     --upload puppet-congress.tar.gz:/etc/puppet/modules/ \
127     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-congress.tar.gz" \
128     --run-command "cd /usr/lib/python2.7/site-packages/congress/datasources && curl -O $doctor_driver" \
129     --run-command "sed -i \"s/'--detailed-exitcodes',/'--detailed-exitcodes','-l','syslog','-l','console',/g\" /var/lib/heat-config/hooks/puppet" \
130     --upload /tmp/fdio-master.repo:/etc/yum.repos.d/fdio-master.repo \
131     --install unzip,vpp,honeycomb \
132     --upload puppet-fdio.tar.gz:/etc/puppet/modules \
133     --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \
134     --upload vsperf.tar.gz:/var/opt \
135     --run-command "cd /var/opt && tar xzf vsperf.tar.gz" \
136     --upload /tmp/tacker.repo:/etc/yum.repos.d/ \
137     --install "python-tackerclient" \
138     --upload ../noarch/openstack-tacker-2015.2-1.noarch.rpm:/root/ \
139     --install /root/openstack-tacker-2015.2-1.noarch.rpm \
140     --upload puppet-tacker.tar.gz:/etc/puppet/modules/ \
141     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-tacker.tar.gz" \
142     -a overcloud-full_build.qcow2
143
144 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
145 popd > /dev/null