comparison prod/install-inventory-db.sh @ 363:cf7166c5c52f

INV-196 Move inventory scripts to prod directory
author Matt Calmes <calmes@ssdt-ohio.org>
date Mon, 16 Aug 2021 12:58:30 -0400
parents
children
comparison
equal deleted inserted replaced
362:91d530304bbf 363:cf7166c5c52f
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-db.properties
7 #
8 # docker login
9 echo "Attempting to login to $artifactUrl"
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
11 # docker pull db image
12 echo "Attempting to pull $artifactUrl/inventory-db:$dbVersion"
13 docker pull $artifactUrl/inventory-db:$dbVersion
14 #
15 # Create inventory specific docker network for $entityId
16 echo "Attempting to create $entityId-inventory-net docker network"
17 docker network create $entityId-inventory-net
18 # docker run inventory-db (data mounted as volume) connected to $entityId-inventory-net docker network
19 echo "Attempting to execute docker run command"
20 docker run --name $entityId-inventory-db --restart=unless-stopped --mount source=$entityId-inventory-db,target=/var/lib/postgresql/data --network $entityId-inventory-net -e POSTGRES_DB=invdb -e POSTGRES_PASSWORD=$dbPassword -d $artifactUrl/inventory-db:$dbVersion
21