comparison prod/install-itcm-db.sh @ 408:e49038cbb14c

Add scripts for ITC Management application
author Marc Davis <marc.davis@mcoecn.org>
date Mon, 10 Oct 2022 14:32:06 -0400
parents
children
comparison
equal deleted inserted replaced
405:4e35cb59f86c 408:e49038cbb14c
1 #!/bin/bash
2 #
3 # read required env variables
4 BASEDIR="$PWD"
5 source $BASEDIR/.env/itcm-shared.properties
6 source $BASEDIR/.env/itcm-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/itcm-$dbVersion"
13 docker pull $artifactUrl/itcm-db:$dbVersion
14 #
15 # create itc management specific docker network for $entityId
16 echo "Attempting to create $entityId-itcm-net docker network"
17 docker network create $entityId-itcm-net
18 # docker run itcm-db (data mounted as volume) connected to $entityId-itcm-net docker network
19 echo "Attempting to execute docker run command"
20 docker run --name $entityId-itcm-db \
21 --restart=unless-stopped \
22 --mount source=$entityId-itcm-db,target=/var/lib/postgresql/data \
23 --network $entityId-itcm-net \
24 -e POSTGRES_DB=itcmdb \
25 -e POSTGRES_PASSWORD=$dbPassword \
26 -d $artifactUrl/itcm-db:$dbVersion