3 # Read configuration files
4 NEXUS_REPO=$(cat /opt/config/nexus_repo.txt)
5 ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt)
6 DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt)
7 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
8 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
9 MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
10 CODE_REPO=$(cat /opt/config/remote_repo.txt)
12 # Add host name to /etc/host to avoid warnings in openstack images
13 if [[ $CLOUD_ENV != "rackspace" ]]
15 echo 127.0.0.1 $(hostname) >> /etc/hosts
17 # Allow remote login as root
18 mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
19 cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
22 # Set private IP in /etc/network/interfaces manually in the presence of public interface
23 # Some VM images don't add the private interface automatically, we have to do it during the component installation
24 if [[ $CLOUD_ENV == "openstack_nofloat" ]]
26 LOCAL_IP=$(cat /opt/config/local_ip_addr.txt)
27 CIDR=$(cat /opt/config/oam_network_cidr.txt)
28 BITMASK=$(echo $CIDR | cut -d"/" -f2)
30 # Compute the netmask based on the network cidr
31 if [[ $BITMASK == "8" ]]
34 elif [[ $BITMASK == "16" ]]
37 elif [[ $BITMASK == "24" ]]
42 echo "auto eth1" >> /etc/network/interfaces
43 echo "iface eth1 inet static" >> /etc/network/interfaces
44 echo " address $LOCAL_IP" >> /etc/network/interfaces
45 echo " netmask $NETMASK" >> /etc/network/interfaces
46 echo " mtu $MTU" >> /etc/network/interfaces
50 # Download dependencies
51 echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
52 echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
54 apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate make maven
56 # Download scripts from Nexus
57 curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/aaf_vm_init.sh -o /opt/aaf_vm_init.sh
58 curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/aaf_serv.sh -o /opt/aaf_serv.sh
59 chmod +x /opt/aaf_vm_init.sh
60 chmod +x /opt/aaf_serv.sh
61 mv /opt/aaf_serv.sh /etc/init.d
62 update-rc.d aaf_serv.sh defaults
64 # Download and install docker-engine and docker-compose
65 echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | tee /etc/apt/sources.list.d/docker.list
67 apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
68 apt-get install -y --allow-unauthenticated docker-engine
71 curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose
72 chmod +x /opt/docker/docker-compose
74 # 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
76 if [ -s /opt/config/dns_ip_addr.txt ]
78 DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) "
80 if [ -s /opt/config/external_dns.txt ]
82 DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) "
84 echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker
86 cp /lib/systemd/system/docker.service /etc/systemd/system
87 sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service
88 service docker restart
90 # DNS IP address configuration
91 echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head
94 # Clone Gerrit repository and run docker containers
96 git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO
97 chmod +x /opt/authz/auth/auth-cass/docker/dinstall.sh
98 chmod +x /opt/authz/auth/auth-cass/docker/backup/backup.sh
99 chmod +x /opt/authz/auth/docker/dbuild.sh
100 chmod +x /opt/authz/auth/docker/drun.sh
101 chmod +x /opt/authz/auth/docker/dstart.sh
102 chmod +x /opt/authz/auth/docker/dstop.sh
103 # d.props is not a startable shell
104 # chmod +x /opt/authz/auth/docker/d.props
106 #Update maven settings
107 cat > /usr/share/maven/conf/settings.xml << EOF
108 <?xml version="1.0" encoding="UTF-8"?>
111 Licensed to the Apache Software Foundation (ASF) under one
112 or more contributor license agreements. See the NOTICE file
113 distributed with this work for additional information
114 regarding copyright ownership. The ASF licenses this file
115 to you under the Apache License, Version 2.0 (the
116 "License"); you may not use this file except in compliance
117 with the License. You may obtain a copy of the License at
119 http://www.apache.org/licenses/LICENSE-2.0
121 Unless required by applicable law or agreed to in writing,
122 software distributed under the License is distributed on an
123 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
124 KIND, either express or implied. See the License for the
125 specific language governing permissions and limitations
130 | This is the configuration file for Maven. It can be specified at two levels:
132 | 1. User Level. This settings.xml file provides configuration for a single user,
133 | and is normally provided in \${user.home}/.m2/settings.xml.
135 | NOTE: This location can be overridden with the CLI option:
137 | -s /path/to/user/settings.xml
139 | 2. Global Level. This settings.xml file provides configuration for all Maven
140 | users on a machine (assuming they're all using the same Maven
141 | installation). It's normally provided in
142 | \${maven.home}/conf/settings.xml.
144 | NOTE: This location can be overridden with the CLI option:
146 | -gs /path/to/global/settings.xml
148 | The sections in this sample file are intended to give you a running start at
149 | getting the most out of your Maven installation. Where appropriate, the default
150 | values (values used when the setting is not specified) are provided.
153 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
154 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
155 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
157 | The path to the local repository maven will use to store artifacts.
159 | Default: \${user.home}/.m2/repository
160 <localRepository>/path/to/local/repo</localRepository>
164 | This will determine whether maven prompts you when it needs input. If set to false,
165 | maven will use a sensible default value, perhaps based on some other setting, for
166 | the parameter in question.
169 <interactiveMode>true</interactiveMode>
173 | Determines whether maven should attempt to connect to the network when executing a build.
174 | This will have an effect on artifact downloads, artifact deployment, and others.
177 <offline>false</offline>
181 | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
182 | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
183 | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
187 | Specifies a further group identifier to use for plugin lookup.
188 <pluginGroup>com.your.plugins</pluginGroup>
193 | This is a list of proxies which can be used on this machine to connect to the network.
194 | Unless otherwise specified (by system property or command-line switch), the first proxy
195 | specification in this list marked as active will be used.
199 | Specification for one proxy, to be used in connecting to the network.
203 <active>true</active>
204 <protocol>http</protocol>
205 <username>proxyuser</username>
206 <password>proxypass</password>
207 <host>proxy.host.net</host>
209 <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
215 | This is a list of authentication profiles, keyed by the server-id used within the system.
216 | Authentication profiles can be used whenever maven must make a connection to a remote server.
220 | Specifies the authentication information to use when connecting to a particular server, identified by
221 | a unique name within the system (referred to by the 'id' attribute below).
223 | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
227 <id>deploymentRepo</id>
228 <username>repouser</username>
229 <password>repopwd</password>
233 <!-- Another sample, using keys to authenticate.
236 <privateKey>/path/to/private/key</privateKey>
237 <passphrase>optional; leave empty if not used.</passphrase>
243 | This is a list of mirrors to be used in downloading artifacts from remote repositories.
245 | It works like this: a POM may declare a repository to use in resolving certain artifacts.
246 | However, this repository may have problems with heavy traffic at times, so people have mirrored
247 | it to several places.
249 | That repository definition will have a unique id, so we can create a mirror reference for that
250 | repository, to be used as an alternate download site. The mirror site will be the preferred
251 | server for that repository.
255 | This is a list of profiles which can be activated in a variety of ways, and which can modify
256 | the build process. Profiles provided in the settings.xml are intended to provide local machine-
257 | specific paths and repository locations which allow the build to work in the local environment.
259 | For example, if you have an integration testing plugin - like cactus - that needs to know where
260 | your Tomcat instance is installed, you can provide a variable here such that the variable is
261 | dereferenced during the build process to configure the cactus plugin.
263 | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
264 | section of this document (settings.xml) - will be discussed later. Another way essentially
265 | relies on the detection of a system property, either matching a particular value for the property,
266 | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
267 | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
268 | Finally, the list of active profiles can be specified directly from the command line.
270 | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
271 | repositories, plugin repositories, and free-form properties to be used as configuration
272 | variables for plugins in the POM.
284 <!--Enable snapshots for the built in central repo to direct -->
285 <!--all requests to nexus via the mirror -->
289 <url>http://repo.maven.apache.org/maven2/</url>
290 <releases><enabled>true</enabled></releases>
291 <snapshots><enabled>true</enabled></snapshots>
298 <url>http://repo.maven.apache.org/maven2/</url>
299 <releases><enabled>true</enabled></releases>
300 <snapshots><enabled>true</enabled></snapshots>
302 </pluginRepositories>
306 <id>20_openecomp-public</id>
309 <id>20_openecomp-public</id>
310 <name>20_openecomp-public</name>
311 <url>https://nexus.onap.org/content/repositories/public/</url>
313 <enabled>true</enabled>
314 <updatePolicy>daily</updatePolicy>
317 <enabled>false</enabled>
323 <id>20_openecomp-public</id>
324 <name>20_openecomp-public</name>
325 <url>https://nexus.onap.org/content/repositories/public/</url>
327 <enabled>true</enabled>
328 <updatePolicy>daily</updatePolicy>
331 <enabled>false</enabled>
334 </pluginRepositories>
337 <id>30_openecomp-staging</id>
340 <id>30_openecomp-staging</id>
341 <name>30_openecomp-staging</name>
342 <url>https://nexus.onap.org/content/repositories/staging/</url>
344 <enabled>true</enabled>
345 <updatePolicy>daily</updatePolicy>
348 <enabled>false</enabled>
354 <id>30_openecomp-staging</id>
355 <name>30_openecomp-staging</name>
356 <url>https://nexus.onap.org/content/repositories/staging/</url>
358 <enabled>true</enabled>
359 <updatePolicy>daily</updatePolicy>
362 <enabled>false</enabled>
365 </pluginRepositories>
368 <id>40_openecomp-release</id>
371 <id>40_openecomp-release</id>
372 <name>40_openecomp-release</name>
373 <url>https://nexus.onap.org/content/repositories/releases/</url>
375 <enabled>true</enabled>
376 <updatePolicy>daily</updatePolicy>
379 <enabled>false</enabled>
385 <id>40_openecomp-release</id>
386 <name>40_openecomp-release</name>
387 <url>https://nexus.onap.org/content/repositories/releases/</url>
389 <enabled>true</enabled>
390 <updatePolicy>daily</updatePolicy>
393 <enabled>false</enabled>
396 </pluginRepositories>
400 <id>50_openecomp-snapshots</id>
403 <id>50_openecomp-snapshot</id>
404 <name>50_openecomp-snapshot</name>
405 <url>https://nexus.onap.org/content/repositories/snapshots/</url>
407 <enabled>false</enabled>
410 <enabled>true</enabled>
416 <id>50_openecomp-snapshot</id>
417 <name>50_openecomp-snapshot</name>
418 <url>https://nexus.onap.org/content/repositories/snapshots/</url>
420 <enabled>false</enabled>
423 <enabled>true</enabled>
426 </pluginRepositories>
429 <id>60_opendaylight-release</id>
432 <id>60_opendaylight-mirror</id>
433 <name>60_opendaylight-mirror</name>
434 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
436 <enabled>true</enabled>
437 <updatePolicy>daily</updatePolicy>
440 <enabled>false</enabled>
446 <id>60_opendaylight-mirror</id>
447 <name>60_opendaylight-mirror</name>
448 <url>https://nexus.opendaylight.org/content/repositories/public/</url>
450 <enabled>true</enabled>
451 <updatePolicy>daily</updatePolicy>
454 <enabled>false</enabled>
457 </pluginRepositories>
461 <id>70_opendaylight-snapshots</id>
464 <id>70_opendaylight-snapshot</id>
465 <name>70_opendaylight-snapshot</name>
466 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
468 <enabled>false</enabled>
471 <enabled>true</enabled>
477 <id>70_opendaylight-snapshot</id>
478 <name>70_opendaylight-snapshot</name>
479 <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
481 <enabled>false</enabled>
484 <enabled>true</enabled>
487 </pluginRepositories>
492 <activeProfile>10_nexus</activeProfile>
493 <activeProfile>20_openecomp-public</activeProfile>
494 <activeProfile>30_openecomp-staging</activeProfile>
495 <activeProfile>40_openecomp-release</activeProfile>
496 <activeProfile>50_openecomp-snapshots</activeProfile>
497 <activeProfile>60_opendaylight-release</activeProfile>
498 <activeProfile>70_opendaylight-snapshots</activeProfile>
506 mvn install -Dmaven.test.skip=true
508 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
509 if [[ $CLOUD_ENV != "rackspace" ]]
511 sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
512 grub-mkconfig -o /boot/grub/grub.cfg
513 sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
514 sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
515 echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
516 echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic