diff prod/install-ess-db.sh @ 519:cb672d0888c6

add install script for ess database
author davis@ssdt-ohio.org
date Wed, 08 Nov 2023 09:49:17 -0500
parents
children cb688221b17b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prod/install-ess-db.sh	Wed Nov 08 09:49:17 2023 -0500
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# read required env variables
+BASEDIR="$PWD"
+source $BASEDIR/.env/ess-shared.properties
+source $BASEDIR/.env/ess-db.properties
+#
+# docker login
+echo "attempting to login to $artifactoryUrl"
+docker login $artifactoryUrl -u $artifactoryUser -p $artifactoryPassword
+# docker pull db image
+echo "attempting to pull $artifactoryUrl/ess-db:$dbVersion"
+docker pull $artifactoryUrl/ess-db:$dbVersion
+#
+# create employee self service specific docker network for $entityId
+echo "attempting to create $entityId-ess-net docker network"
+docker network create $entityId-ess-net
+# docker run ess-db (data mounted as volume) connected to $entityId-ess-net docker network
+echo "attempting to execute docker run command"
+docker run --name $entityId-ess-db \
+           --restart=unless-stopped \
+           --mount source=$entityId-ess-db,target=/var/lib/postgresql/data \
+           --network $entityId-ess-net \
+           -e POSTGRES_DB=essdb \
+           -e POSTGRES_PASSWORD=$dbPassword \
+           -d $artifactUrl/ess-db:$dbVersion
\ No newline at end of file