annotate prod/import-inventory.sh @ 535:bd42d00aa1f1

Update protections on update-ess-app.sh to allow execution
author Matt Calmes <calmes@ssdt-ohio.org>
date Mon, 06 May 2024 10:20:41 -0400
parents cf7166c5c52f
children
rev   line source
363
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
1 #!/bin/bash
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
2 #
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
3 BASEDIR="$PWD"
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
4 # read required environment variables
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
5 source $BASEDIR/.env/ssdt-inventory-shared.properties
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
6 source $BASEDIR/.env/ssdt-inventory-import.properties
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
7 #
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
8 # docker login
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
9 echo "Attempting to login to $artifactUrl"
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
11 # docker pull
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
12 echo "Attempting to pull $artifactUrl/inventory-importapp:$importVersion"
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
13 docker pull $artifactUrl/inventory-importapp:$importVersion
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
14 #
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
15 echo "Building docker run command"
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
16 dockerParams="--rm --name $entityId-inventory-importapp -v $importPath:/extracts --network $entityId-inventory-net"
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
17 dockerParams="$dockerParams -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-inventory-db:5432/invdb -e SPRING_DATASOURCE_PASSWORD=$dbPassword"
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
18 dockerParams="$dockerParams -e SPRING_PROFILES_ACTIVE=prod -e APPLICATION_ADMIN_PASSWORD=$adminPassword -i $artifactUrl/inventory-importapp:$importVersion"
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
19 echo "Executing docker run command"
cf7166c5c52f INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff changeset
20 docker run $dockerParams