3 # Read configuration files
4 ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt)
5 DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt)
6 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
7 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
8 MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
9 CODE_REPO=$(cat /opt/config/remote_repo.txt)
10 HTTP_PROXY=$(cat /opt/config/http_proxy.txt)
11 HTTPS_PROXY=$(cat /opt/config/https_proxy.txt)
13 if [ $HTTP_PROXY != " " ]
15 export http_proxy=$HTTP_PROXY
16 export https_proxy=$HTTPS_PROXY
20 # Add host name to /etc/host to avoid warnings in openstack images
21 if [[ $CLOUD_ENV != "rackspace" ]]
23 echo 127.0.0.1 $(hostname) >> /etc/hosts
25 # Allow remote login as root
26 mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
27 cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
30 # Set private IP in /etc/network/interfaces manually in the presence of public interface
31 # Some VM images don't add the private interface automatically, we have to do it during the component installation
32 if [[ $CLOUD_ENV == "openstack_nofloat" ]]
34 LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
35 CIDR=$(cat /opt/config/oam_network_cidr.txt)
36 BITMASK=$(echo $CIDR | cut -d"/" -f2)
38 # Compute the netmask based on the network cidr
39 if [[ $BITMASK == "8" ]]
42 elif [[ $BITMASK == "16" ]]
45 elif [[ $BITMASK == "24" ]]
50 echo "auto eth1" >> /etc/network/interfaces
51 echo "iface eth1 inet static" >> /etc/network/interfaces
52 echo " address $LOCAL_IP" >> /etc/network/interfaces
53 echo " netmask $NETMASK" >> /etc/network/interfaces
54 echo " mtu $MTU" >> /etc/network/interfaces
58 # Download dependencies
59 echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
60 echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
62 apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate make maven
64 # Download scripts from Nexus
65 unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip aaf_vm_init.sh > /opt/aaf_vm_init.sh
66 unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip aaf_serv.sh > /opt/aaf_serv.sh
67 unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh
68 chmod +x /opt/imagetest.sh
69 chmod +x /opt/aaf_vm_init.sh
70 chmod +x /opt/aaf_serv.sh
71 mv /opt/aaf_serv.sh /etc/init.d
72 update-rc.d aaf_serv.sh defaults
74 # Download and install docker-engine and docker-compose
75 echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | tee /etc/apt/sources.list.d/docker.list
77 apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
78 apt-get install -y --allow-unauthenticated docker-engine
81 curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
82 chmod +x /opt/docker/docker-compose
84 # Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP
86 if [ -s /opt/config/dns_ip_addr.txt ]
88 DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) "
90 if [ -s /opt/config/external_dns.txt ]
92 DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) "
94 echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker
96 cp /lib/systemd/system/docker.service /etc/systemd/system
97 sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service
98 if [ $HTTP_PROXY != "no_proxy" ]
103 service docker restart
105 # DNS IP address configuration
106 echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head
109 # Clone Gerrit repository and run docker containers
111 git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO
112 chmod +x /opt/authz/auth/auth-cass/docker/dinstall.sh
113 chmod +x /opt/authz/auth/auth-cass/docker/backup/backup.sh
114 chmod +x /opt/authz/auth/docker/dbuild.sh
115 chmod +x /opt/authz/auth/docker/drun.sh
116 chmod +x /opt/authz/auth/docker/dstart.sh
117 chmod +x /opt/authz/auth/docker/dstop.sh
118 # d.props is not a startable shell
119 # chmod +x /opt/authz/auth/docker/d.props
121 #Update maven settings
122 cat > /usr/share/maven/conf/settings.xml << EOF
123 <?xml version="1.0" encoding="UTF-8"?>
126 Licensed to the Apache Software Foundation (ASF) under one
127 or more contributor license agreements. See the NOTICE file
128 distributed with this work for additional information
129 regarding copyright ownership. The ASF licenses this file
130 to you under the Apache License, Version 2.0 (the
131 "License"); you may not use this file except in compliance
132 with the License. You may obtain a copy of the License at
134 http://www.apache.org/licenses/LICENSE-2.0
136 Unless required by applicable law or agreed to in writing,
137 software distributed under the License is distributed on an
138 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
139 KIND, either express or implied. See the License for the
140 specific language governing permissions and limitations
145 | This is the configuration file for Maven. It can be specified at two levels:
147 | 1. User Level. This settings.xml file provides configuration for a single user,
148 | and is normally provided in \${user.home}/.m2/settings.xml.
150 | NOTE: This location can be overridden with the CLI option:
152 | -s /path/to/user/settings.xml
154 | 2. Global Level. This settings.xml file provides configuration for all Maven
155 | users on a machine (assuming they're all using the same Maven
156 | installation). It's normally provided in
157 | \${maven.home}/conf/settings.xml.
159 | NOTE: This location can be overridden with the CLI option:
161 | -gs /path/to/global/settings.xml
163 | The sections in this sample file are intended to give you a running start at
164 | getting the most out of your Maven installation. Where appropriate, the default
165 | values (values used when the setting is not specified) are provided.
168 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
169 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
170 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
172 | The path to the local repository maven will use to store artifacts.
174 | Default: \${user.home}/.m2/repository
175 <localRepository>/path/to/local/repo</localRepository>
179 | This will determine whether maven prompts you when it needs input. If set to false,
180 | maven will use a sensible default value, perhaps based on some other setting, for
181 | the parameter in question.
184 <interactiveMode>true</interactiveMode>
188 | Determines whether maven should attempt to connect to the network when executing a build.
189 | This will have an effect on artifact downloads, artifact deployment, and others.
192 <offline>false</offline>
196 | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
197 | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
198 | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
202 | Specifies a further group identifier to use for plugin lookup.
203 <pluginGroup>com.your.plugins</pluginGroup>
208 | This is a list of proxies which can be used on this machine to connect to the network.
209 | Unless otherwise specified (by system property or command-line switch), the first proxy
210 | specification in this list marked as active will be used.
215 <active>true</active>
216 <protocol>http</protocol>
217 <username>proxyuser</username>
218 <password>proxypass</password>
219 <host>$(cat /opt/config/http_proxy.txt | cut -d ':' -f1)</host>
220 <port>$(cat /opt/config/http_proxy.txt | cut -d ':' -f2)</port>
221 <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
225 <active>true</active>
226 <protocol>https</protocol>
227 <username>proxyuser</username>
228 <password>proxypass</password>
229 <host>$(cat /opt/config/https_proxy.txt | cut -d ':' -f1)</host>
230 <port>$(cat /opt/config/https_proxy.txt | cut -d ':' -f2)</port>
231 <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
237 | This is a list of authentication profiles, keyed by the server-id used within the system.
238 | Authentication profiles can be used whenever maven must make a connection to a remote server.
242 | Specifies the authentication information to use when connecting to a particular server, identified by
243 | a unique name within the system (referred to by the 'id' attribute below).
245 | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
249 <id>deploymentRepo</id>
250 <username>repouser</username>
251 <password>repopwd</password>
255 <!-- Another sample, using keys to authenticate.
258 <privateKey>/path/to/private/key</privateKey>
259 <passphrase>optional; leave empty if not used.</passphrase>
265 | This is a list of mirrors to be used in downloading artifacts from remote repositories.
267 | It works like this: a POM may declare a repository to use in resolving certain artifacts.
268 | However, this repository may have problems with heavy traffic at times, so people have mirrored
269 | it to several places.
271 | That repository definition will have a unique id, so we can create a mirror reference for that
272 | repository, to be used as an alternate download site. The mirror site will be the preferred
273 | server for that repository.
277 | This is a list of profiles which can be activated in a variety of ways, and which can modify
278 | the build process. Profiles provided in the settings.xml are intended to provide local machine-
279 | specific paths and repository locations which allow the build to work in the local environment.
281 | For example, if you have an integration testing plugin - like cactus - that needs to know where
282 | your Tomcat instance is installed, you can provide a variable here such that the variable is
283 | dereferenced during the build process to configure the cactus plugin.
285 | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
286 | section of this document (settings.xml) - will be discussed later. Another way essentially
287 | relies on the detection of a system property, either matching a particular value for the property,
288 | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
289 | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
290 | Finally, the list of active profiles can be specified directly from the command line.
292 | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
293 | repositories, plugin repositories, and free-form properties to be used as configuration
294 | variables for plugins in the POM.
306 <!--Enable snapshots for the built in central repo to direct -->
307 <!--all requests to nexus via the mirror -->
311 <url>http://repo.maven.apache.org/maven2/</url>
312 <releases><enabled>true</enabled></releases>
313 <snapshots><enabled>true</enabled></snapshots>
320 <url>http://repo.maven.apache.org/maven2/</url>
321 <releases><enabled>true</enabled></releases>
322 <snapshots><enabled>true</enabled></snapshots>
324 </pluginRepositories>
328 <id>20_openecomp-public</id>
331 <id>20_openecomp-public</id>
332 <name>20_openecomp-public</name>
333 <url>https://nexus.onap.org/content/repositories/public/</url>
335 <enabled>true</enabled>
336 <updatePolicy>daily</updatePolicy>
339 <enabled>false</enabled>
345 <id>20_openecomp-public</id>
346 <name>20_openecomp-public</name>
347 <url>https://nexus.onap.org/content/repositories/public/</url>
349 <enabled>true</enabled>
350 <updatePolicy>daily</updatePolicy>
353 <enabled>false</enabled>
356 </pluginRepositories>
359 <id>30_openecomp-staging</id>
362 <id>30_openecomp-staging</id>
363 <name>30_openecomp-staging</name>
364 <url>https://nexus.onap.org/content/repositories/staging/</url>
366 <enabled>true</enabled>
367 <updatePolicy>daily</updatePolicy>
370 <enabled>false</enabled>
376 <id>30_openecomp-staging</id>
377 <name>30_openecomp-staging</name>
378 <url>https://nexus.onap.org/content/repositories/staging/</url>
380 <enabled>true</enabled>
381 <updatePolicy>daily</updatePolicy>
384 <enabled>false</enabled>
387 </pluginRepositories>
390 <id>40_openecomp-release</id>
393 <id>40_openecomp-release</id>
394 <name>40_openecomp-release</name>
395 <url>https://nexus.onap.org/content/repositories/releases/</url>
397 <enabled>true</enabled>
398 <updatePolicy>daily</updatePolicy>
401 <enabled>false</enabled>
407 <id>40_openecomp-release</id>
408 <name>40_openecomp-release</name>
409 <url>https://nexus.onap.org/content/repositories/releases/</url>
411 <enabled>true</enabled>
412 <updatePolicy>daily</updatePolicy>
415 <enabled>false</enabled>
418 </pluginRepositories>
422 <id>50_openecomp-snapshots</id>
425 <id>50_openecomp-snapshot</id>
426 <name>50_openecomp-snapshot</name>
427 <url>https://nexus.onap.org/content/repositories/snapshots/</url>
429 <enabled>false</enabled>
432 <enabled>true</enabled>
438 <id>50_openecomp-snapshot</id>
439 <name>50_openecomp-snapshot</name>
440 <url>https://nexus.onap.org/content/repositories/snapshots/</url>
442 <enabled>false</enabled>
445 <enabled>true</enabled>
448 </pluginRepositories>
451 <id>60_opendaylight-release</id>
454 <id>60_opendaylight-mirror</id>
455 <name>60_opendaylight-mirror</name>
456 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
458 <enabled>true</enabled>
459 <updatePolicy>daily</updatePolicy>
462 <enabled>false</enabled>
468 <id>60_opendaylight-mirror</id>
469 <name>60_opendaylight-mirror</name>
470 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
472 <enabled>true</enabled>
473 <updatePolicy>daily</updatePolicy>
476 <enabled>false</enabled>
479 </pluginRepositories>
483 <id>70_opendaylight-snapshots</id>
486 <id>70_opendaylight-snapshot</id>
487 <name>70_opendaylight-snapshot</name>
488 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
490 <enabled>false</enabled>
493 <enabled>true</enabled>
499 <id>70_opendaylight-snapshot</id>
500 <name>70_opendaylight-snapshot</name>
501 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
503 <enabled>false</enabled>
506 <enabled>true</enabled>
509 </pluginRepositories>
514 <activeProfile>10_nexus</activeProfile>
515 <activeProfile>20_openecomp-public</activeProfile>
516 <activeProfile>30_openecomp-staging</activeProfile>
517 <activeProfile>40_openecomp-release</activeProfile>
518 <activeProfile>50_openecomp-snapshots</activeProfile>
519 <activeProfile>60_opendaylight-release</activeProfile>
520 <activeProfile>70_opendaylight-snapshots</activeProfile>
528 mvn install -Dmaven.test.skip=true
530 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
531 if [[ $CLOUD_ENV != "rackspace" ]]
533 sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
534 grub-mkconfig -o /boot/grub/grub.cfg
535 sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
536 sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
537 echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
538 echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic