diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prod/install-itcm-db.sh	Mon Oct 10 14:32:06 2022 -0400
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# read required env variables
+BASEDIR="$PWD"
+source $BASEDIR/.env/itcm-shared.properties
+source $BASEDIR/.env/itcm-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/itcm-$dbVersion"
+docker pull $artifactUrl/itcm-db:$dbVersion
+#
+# create itc management specific docker network for $entityId
+echo "Attempting to create $entityId-itcm-net docker network"
+docker network create $entityId-itcm-net
+# docker run itcm-db (data mounted as volume) connected to $entityId-itcm-net docker network
+echo "Attempting to execute docker run command"
+docker run --name $entityId-itcm-db \
+           --restart=unless-stopped \
+           --mount source=$entityId-itcm-db,target=/var/lib/postgresql/data \
+           --network $entityId-itcm-net \
+           -e POSTGRES_DB=itcmdb \
+           -e POSTGRES_PASSWORD=$dbPassword \
+           -d $artifactUrl/itcm-db:$dbVersion
\ No newline at end of file