Mercurial > public > ssdt-docker
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/prod/install-inventory-db.sh Mon Aug 16 12:58:30 2021 -0400 @@ -0,0 +1,21 @@ +#!/bin/bash +# +# read required env variables +BASEDIR="$PWD" +source $BASEDIR/.env/ssdt-inventory-shared.properties +source $BASEDIR/.env/ssdt-inventory-db.properties +# +# docker login +echo "Attempting to login to $artifactUrl" +docker login $artifactUrl -u $artifactUser -p $artifactPassword +# docker pull db image +echo "Attempting to pull $artifactUrl/inventory-db:$dbVersion" +docker pull $artifactUrl/inventory-db:$dbVersion +# +# Create inventory specific docker network for $entityId +echo "Attempting to create $entityId-inventory-net docker network" +docker network create $entityId-inventory-net +# docker run inventory-db (data mounted as volume) connected to $entityId-inventory-net docker network +echo "Attempting to execute docker run command" +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 +