comparison prod/install-inventory-app.sh @ 367:50e99c5b33af production vv2.9.0

flow: Merged <release> 'v2.9.0' to <master> ('production').
author Jodi Becher <becher@ssdt-ohio.org>
date Mon, 16 Aug 2021 18:46:57 +0100
parents cf7166c5c52f
children be08b5a62a77
comparison
equal deleted inserted replaced
359:dab812f30d3e 367:50e99c5b33af
1 #!/bin/bash
2 #
3 # read required env variables
4 BASEDIR="$PWD"
5 source $BASEDIR/.env/ssdt-inventory-shared.properties
6 source $BASEDIR/.env/ssdt-inventory-app.properties
7 #
8 # docker login
9 echo "Attempting to login to $artifactUrl"
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
11 # docker pull app image
12 echo "Attempting to pull $artifactUrl/inventory-app:$appVersion"
13 docker pull $artifactUrl/inventory-app:$appVersion
14 #
15 # Build docker run command based on setting in env files
16 echo "Building docker run command"
17 dockerRunCommand="docker run --name $entityId-inventory-app --restart=unless-stopped --network $entityId-inventory-net -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-inventory-db:5432/invdb"
18 dockerRunCommand="$dockerRunCommand -e SPRING_DATASOURCE_PASSWORD=$dbPassword -e SPRING_PROFILES_ACTIVE=prod -e APPLICATION_ADMIN_PASSWORD=$adminPassword -e JAVA_OPTS=$java_opts"
19 dockerRunCommand="$dockerRunCommand -e USAS_CONFIGURATION_HOST=$usasHost -e USAS_CONFIGURATION_PORT=$usasPort -e USAS_CONFIGURATION_APIKEY=$inventoryApiKey -e USAS_CONFIGURATION_REMOTEAPIKEY=$usasApiKey"
20 if [ ! -z "$virtualHost" ]; then
21 dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
22 fi
23 #
24 if [ ! -z "$virtualPort" ]; then
25 dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
26 fi
27 #
28 if [ ! -z "$letsencryptHost" ]; then
29 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
30 fi
31 #
32 if [ ! -z "$letsencryptEmail" ]; then
33 dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
34 fi
35 #
36 if [ ! -z "$hostPort" ]; then
37 dockerRunCommand="$dockerRunCommand -p $hostPort"
38 fi
39 #
40 dockerRunCommand="$dockerRunCommand -d $artifactUrl/inventory-app:$appVersion"
41 #
42 # Execute constructed docker run command to create $entityId-inventory-app container connected to db and docker network
43 echo "Executing docker run command"
44 $dockerRunCommand