Refactor ONAP HEAT template config, part 2
[demo.git] / heat / ONAP / cloud-config / aaf_install.sh
1 #!/bin/bash
2
3 # Read configuration files
4 GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt)
5 CODE_REPO=$(cat /opt/config/remote_repo.txt)
6 HTTP_PROXY=$(cat /opt/config/http_proxy.txt)
7 HTTPS_PROXY=$(cat /opt/config/https_proxy.txt)
8
9 if [ $HTTP_PROXY != "no_proxy" ]
10 then
11     export http_proxy=$HTTP_PROXY
12     export https_proxy=$HTTPS_PROXY
13 fi
14
15
16 # Download dependencies
17 echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >>  /etc/apt/sources.list.d/java.list
18 echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >>  /etc/apt/sources.list.d/java.list
19 apt-get update
20 apt-get install --allow-unauthenticated -y openjdk-8-jdk maven
21
22 # Download scripts from Nexus
23 update-rc.d aaf_serv.sh defaults
24
25
26 # Clone Gerrit repository and run docker containers
27 cd /opt
28 git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO
29 chmod +x /opt/authz/auth/auth-cass/docker/dinstall.sh
30 chmod +x /opt/authz/auth/auth-cass/docker/backup/backup.sh
31 chmod +x /opt/authz/auth/docker/dbuild.sh
32 chmod +x /opt/authz/auth/docker/drun.sh
33 chmod +x /opt/authz/auth/docker/dstart.sh
34 chmod +x /opt/authz/auth/docker/dstop.sh
35
36 #Update maven settings
37 cat > /usr/share/maven/conf/settings.xml << EOF
38 <?xml version="1.0" encoding="UTF-8"?>
39
40 <!--
41 Licensed to the Apache Software Foundation (ASF) under one
42 or more contributor license agreements.  See the NOTICE file
43 distributed with this work for additional information
44 regarding copyright ownership.  The ASF licenses this file
45 to you under the Apache License, Version 2.0 (the
46 "License"); you may not use this file except in compliance
47 with the License.  You may obtain a copy of the License at
48
49     http://www.apache.org/licenses/LICENSE-2.0
50
51 Unless required by applicable law or agreed to in writing,
52 software distributed under the License is distributed on an
53 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
54 KIND, either express or implied.  See the License for the
55 specific language governing permissions and limitations
56 under the License.
57 -->
58
59 <!--
60  | This is the configuration file for Maven. It can be specified at two levels:
61  |
62  |  1. User Level. This settings.xml file provides configuration for a single user,
63 |                 and is normally provided in \${user.home}/.m2/settings.xml.
64  |
65  |                 NOTE: This location can be overridden with the CLI option:
66  |
67  |                 -s /path/to/user/settings.xml
68  |
69  |  2. Global Level. This settings.xml file provides configuration for all Maven
70  |                 users on a machine (assuming they're all using the same Maven
71  |                 installation). It's normally provided in
72 |                 \${maven.home}/conf/settings.xml.
73  |
74  |                 NOTE: This location can be overridden with the CLI option:
75  |
76  |                 -gs /path/to/global/settings.xml
77  |
78  | The sections in this sample file are intended to give you a running start at
79  | getting the most out of your Maven installation. Where appropriate, the default
80  | values (values used when the setting is not specified) are provided.
81  |
82  |-->
83 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
84           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
85           xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
86   <!-- localRepository
87    | The path to the local repository maven will use to store artifacts.
88    |
89 | Default: \${user.home}/.m2/repository
90   <localRepository>/path/to/local/repo</localRepository>
91   -->
92
93   <!-- interactiveMode
94    | This will determine whether maven prompts you when it needs input. If set to false,
95    | maven will use a sensible default value, perhaps based on some other setting, for
96    | the parameter in question.
97    |
98    | Default: true
99   <interactiveMode>true</interactiveMode>
100   -->
101
102   <!-- offline
103    | Determines whether maven should attempt to connect to the network when executing a build.
104    | This will have an effect on artifact downloads, artifact deployment, and others.
105    |
106    | Default: false
107   <offline>false</offline>
108   -->
109
110   <!-- pluginGroups
111    | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
112    | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
113    | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
114    |-->
115   <pluginGroups>
116     <!-- pluginGroup
117      | Specifies a further group identifier to use for plugin lookup.
118     <pluginGroup>com.your.plugins</pluginGroup>
119     -->
120   </pluginGroups>
121
122   <!-- proxies
123    | This is a list of proxies which can be used on this machine to connect to the network.
124    | Unless otherwise specified (by system property or command-line switch), the first proxy
125    | specification in this list marked as active will be used.
126    |-->
127   <proxies>
128     <proxy>
129       <id>optional</id>
130       <active>true</active>
131       <protocol>http</protocol>
132       <username>proxyuser</username>
133       <password>proxypass</password>
134       <host>$(cat /opt/config/http_proxy.txt | cut -d ':' -f1)</host>
135       <port>$(cat /opt/config/http_proxy.txt | cut -d ':' -f2)</port>
136       <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
137     </proxy>
138     <proxy>
139       <id>optional</id>
140       <active>true</active>
141       <protocol>https</protocol>
142       <username>proxyuser</username>
143       <password>proxypass</password>
144       <host>$(cat /opt/config/https_proxy.txt | cut -d ':' -f1)</host>
145       <port>$(cat /opt/config/https_proxy.txt | cut -d ':' -f2)</port>
146       <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
147     </proxy>
148   </proxies>
149
150
151   <!-- servers
152    | This is a list of authentication profiles, keyed by the server-id used within the system.
153    | Authentication profiles can be used whenever maven must make a connection to a remote server.
154    |-->
155   <servers>
156     <!-- server
157      | Specifies the authentication information to use when connecting to a particular server, identified by
158      | a unique name within the system (referred to by the 'id' attribute below).
159      |
160      | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
161      |       used together.
162      |
163     <server>
164       <id>deploymentRepo</id>
165       <username>repouser</username>
166       <password>repopwd</password>
167     </server>
168     -->
169
170     <!-- Another sample, using keys to authenticate.
171     <server>
172       <id>siteServer</id>
173       <privateKey>/path/to/private/key</privateKey>
174       <passphrase>optional; leave empty if not used.</passphrase>
175     </server>
176     -->
177   </servers>
178
179   <!-- mirrors
180    | This is a list of mirrors to be used in downloading artifacts from remote repositories.
181    |
182    | It works like this: a POM may declare a repository to use in resolving certain artifacts.
183    | However, this repository may have problems with heavy traffic at times, so people have mirrored
184    | it to several places.
185    |
186    | That repository definition will have a unique id, so we can create a mirror reference for that
187    | repository, to be used as an alternate download site. The mirror site will be the preferred
188    | server for that repository.
189    |-->
190
191   <!-- profiles
192    | This is a list of profiles which can be activated in a variety of ways, and which can modify
193    | the build process. Profiles provided in the settings.xml are intended to provide local machine-
194    | specific paths and repository locations which allow the build to work in the local environment.
195    |
196    | For example, if you have an integration testing plugin - like cactus - that needs to know where
197    | your Tomcat instance is installed, you can provide a variable here such that the variable is
198    | dereferenced during the build process to configure the cactus plugin.
199    |
200    | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
201    | section of this document (settings.xml) - will be discussed later. Another way essentially
202    | relies on the detection of a system property, either matching a particular value for the property,
203    | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
204    | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
205    | Finally, the list of active profiles can be specified directly from the command line.
206    |
207    | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
208    |       repositories, plugin repositories, and free-form properties to be used as configuration
209    |       variables for plugins in the POM.
210    |
211    |-->
212
213
214
215   
216   
217   <profiles>
218       <profile>
219           
220           <id>10_nexus</id>
221           <!--Enable snapshots for the built in central repo to direct -->
222           <!--all requests to nexus via the mirror -->
223           <repositories>
224               <repository>
225                   <id>10_nexus</id>
226                   <url>http://repo.maven.apache.org/maven2/</url>
227                   <releases><enabled>true</enabled></releases>
228                   <snapshots><enabled>true</enabled></snapshots>
229               </repository>
230           </repositories>
231           
232           <pluginRepositories>
233               <pluginRepository>
234                   <id>10_nexus</id>
235                   <url>http://repo.maven.apache.org/maven2/</url>
236                   <releases><enabled>true</enabled></releases>
237                   <snapshots><enabled>true</enabled></snapshots>
238               </pluginRepository>
239           </pluginRepositories>
240           
241       </profile>
242       <profile>
243           <id>20_openecomp-public</id>
244           <repositories>
245               <repository>
246                   <id>20_openecomp-public</id>
247                   <name>20_openecomp-public</name>
248                   <url>https://nexus.onap.org/content/repositories/public/</url>
249                   <releases>
250                       <enabled>true</enabled>
251                       <updatePolicy>daily</updatePolicy>
252                   </releases>
253                   <snapshots>
254                       <enabled>false</enabled>
255                   </snapshots>
256               </repository>
257           </repositories>
258           <pluginRepositories>
259               <pluginRepository>
260                   <id>20_openecomp-public</id>
261                   <name>20_openecomp-public</name>
262                   <url>https://nexus.onap.org/content/repositories/public/</url>
263                   <releases>
264                       <enabled>true</enabled>
265                       <updatePolicy>daily</updatePolicy>
266                   </releases>
267                   <snapshots>
268                       <enabled>false</enabled>
269                   </snapshots>
270               </pluginRepository>
271           </pluginRepositories>
272       </profile>
273       <profile>
274           <id>30_openecomp-staging</id>
275           <repositories>
276               <repository>
277                   <id>30_openecomp-staging</id>
278                   <name>30_openecomp-staging</name>
279                   <url>https://nexus.onap.org/content/repositories/staging/</url>
280                   <releases>
281                       <enabled>true</enabled>
282                       <updatePolicy>daily</updatePolicy>
283                   </releases>
284                   <snapshots>
285                       <enabled>false</enabled>
286                   </snapshots>
287               </repository>
288           </repositories>
289           <pluginRepositories>
290               <pluginRepository>
291                   <id>30_openecomp-staging</id>
292                   <name>30_openecomp-staging</name>
293                   <url>https://nexus.onap.org/content/repositories/staging/</url>
294                   <releases>
295                       <enabled>true</enabled>
296                       <updatePolicy>daily</updatePolicy>
297                   </releases>
298                   <snapshots>
299                       <enabled>false</enabled>
300                   </snapshots>
301               </pluginRepository>
302           </pluginRepositories>
303       </profile>
304       <profile>
305           <id>40_openecomp-release</id>
306           <repositories>
307               <repository>
308                   <id>40_openecomp-release</id>
309                   <name>40_openecomp-release</name>
310                   <url>https://nexus.onap.org/content/repositories/releases/</url>
311                   <releases>
312                       <enabled>true</enabled>
313                       <updatePolicy>daily</updatePolicy>
314                   </releases>
315                   <snapshots>
316                       <enabled>false</enabled>
317                   </snapshots>
318               </repository>
319           </repositories>
320           <pluginRepositories>
321               <pluginRepository>
322                   <id>40_openecomp-release</id>
323                   <name>40_openecomp-release</name>
324                   <url>https://nexus.onap.org/content/repositories/releases/</url>
325                   <releases>
326                       <enabled>true</enabled>
327                       <updatePolicy>daily</updatePolicy>
328                   </releases>
329                   <snapshots>
330                       <enabled>false</enabled>
331                   </snapshots>
332               </pluginRepository>
333           </pluginRepositories>
334       </profile>
335       
336       <profile>
337           <id>50_openecomp-snapshots</id>
338           <repositories>
339               <repository>
340                   <id>50_openecomp-snapshot</id>
341                   <name>50_openecomp-snapshot</name>
342                   <url>https://nexus.onap.org/content/repositories/snapshots/</url>
343                   <releases>
344                       <enabled>false</enabled>
345                   </releases>
346                   <snapshots>
347                       <enabled>true</enabled>
348                   </snapshots>
349               </repository>
350           </repositories>
351           <pluginRepositories>
352               <pluginRepository>
353                   <id>50_openecomp-snapshot</id>
354                   <name>50_openecomp-snapshot</name>
355                   <url>https://nexus.onap.org/content/repositories/snapshots/</url>
356                   <releases>
357                       <enabled>false</enabled>
358                   </releases>
359                   <snapshots>
360                       <enabled>true</enabled>
361                   </snapshots>
362               </pluginRepository>
363           </pluginRepositories>
364       </profile>
365       <profile>
366           <id>60_opendaylight-release</id>
367           <repositories>
368               <repository>
369                   <id>60_opendaylight-mirror</id>
370                   <name>60_opendaylight-mirror</name>
371                   <url>https://nexus.opendaylight.org/content/repositories/public/</url>
372                   <releases>
373                       <enabled>true</enabled>
374                       <updatePolicy>daily</updatePolicy>
375                   </releases>
376                   <snapshots>
377                       <enabled>false</enabled>
378                   </snapshots>
379               </repository>
380           </repositories>
381           <pluginRepositories>
382               <pluginRepository>
383                   <id>60_opendaylight-mirror</id>
384                   <name>60_opendaylight-mirror</name>
385                   <url>https://nexus.opendaylight.org/content/repositories/public/</url>
386                   <releases>
387                       <enabled>true</enabled>
388                       <updatePolicy>daily</updatePolicy>
389                   </releases>
390                   <snapshots>
391                       <enabled>false</enabled>
392                   </snapshots>
393               </pluginRepository>
394           </pluginRepositories>
395       </profile>
396       
397       <profile>
398           <id>70_opendaylight-snapshots</id>
399           <repositories>
400               <repository>
401                   <id>70_opendaylight-snapshot</id>
402                   <name>70_opendaylight-snapshot</name>
403                   <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
404                   <releases>
405                       <enabled>false</enabled>
406                   </releases>
407                   <snapshots>
408                       <enabled>true</enabled>
409                   </snapshots>
410               </repository>
411           </repositories>
412           <pluginRepositories>
413               <pluginRepository>
414                   <id>70_opendaylight-snapshot</id>
415                   <name>70_opendaylight-snapshot</name>
416                   <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
417                   <releases>
418                       <enabled>false</enabled>
419                   </releases>
420                   <snapshots>
421                       <enabled>true</enabled>
422                   </snapshots>
423               </pluginRepository>
424           </pluginRepositories>
425       </profile>
426   </profiles>
427   
428   <activeProfiles>
429       <activeProfile>10_nexus</activeProfile>
430       <activeProfile>20_openecomp-public</activeProfile>
431       <activeProfile>30_openecomp-staging</activeProfile>
432       <activeProfile>40_openecomp-release</activeProfile>
433       <activeProfile>50_openecomp-snapshots</activeProfile>
434       <activeProfile>60_opendaylight-release</activeProfile>
435       <activeProfile>70_opendaylight-snapshots</activeProfile>
436
437   </activeProfiles>
438   
439 </settings>
440 EOF
441
442 cd /opt/authz
443 mvn install -Dmaven.test.skip=true
444
445 cd /opt
446 ./aaf_vm_init.sh