changeset 606:2aebef3e31bf

add ipdp install scripts
author Justin Kleinknecht <justin.kleinknecht@mcoecn.org>
date Tue, 01 Jul 2025 20:50:56 +0100
parents ad36483ba0c2
children 3ec3180d23a4
files prod/install-ipdp-db.sh prod/install-ipdp.sh
diffstat 2 files changed, 90 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prod/install-ipdp-db.sh	Tue Jul 01 20:50:56 2025 +0100
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# read required env variables
+BASEDIR="$PWD"
+source $BASEDIR/.env/ipdp-shared.properties
+source $BASEDIR/.env/ipdp-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/ipdp-db:$dbVersion"
+docker pull $artifactoryUrl/ipdp-db:$dbVersion
+#
+# create employee self service specific docker network for $entityId
+echo "attempting to create $entityId-ipdp-net docker network"
+docker network create $entityId-ipdp-net
+# docker run ipdp-db (data mounted as volume) connected to $entityId-ipdp-net docker network
+echo "attempting to execute docker run command"
+docker run --name $entityId-ipdp-db \
+           --restart=unlipdp-stopped \
+           --mount source=$entityId-ipdp-db,target=/var/lib/postgresql/data \
+           --network $entityId-ipdp-net \
+           -e POSTGRES_DB=ipdpdb \
+           -e POSTGRES_PASSWORD=$dbPassword \
+           -d $artifactUrl/ipdp-db:$dbVersion
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prod/install-ipdp.sh	Tue Jul 01 20:50:56 2025 +0100
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# Copyright (c) 2025.  Ohio Department of Education. - All Rights Reserved.
+# Unauthorized copying of this file, in any medium, is strictly prohibited.
+# Written by the State Software Development Team (http://ssdt.oecn.k12.oh.us/)
+#
+#
+
+#
+# read required env variables
+BASEDIR="$PWD"
+source $BASEDIR/.env/ipdp-shared.properties
+source $BASEDIR/.env/ipdp-app.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/ipdp-app:$appVersion"
+docker pull $artifactUrl/ipdp-app:$appVersion
+#
+# Builder docker run command based on settings in env files
+echo "Building docker run command"
+dockerRunCommand="docker run --name $entityId-ipdp-app
+  --restart=unlipdp-stopped
+  --network $entityId-ipdp-net
+  -e SPRING_DATASOURCE_URL=jdbc:postgresql://$entityId-ipdp-db:5432/ipdpdb
+  -e SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
+  -e SPRING_DATASOURCE_USERNAME=postgres
+  -e SPRING_DATASOURCE_PASSWORD=$dbPassword
+  -e SPRING_PROFILES_ACTIVE=prod
+  -e APPLICATION_ADMIN_PASSWORD=$adminPassword
+  -e APPLICATION_ADMIN_RESET=$resetAdminPassword
+  -e USPS_CONFIGURATION_HOST=$uspsHost
+  -e USPS_CONFIGURATION_PORT=$uspsPort
+  -e USPS_CONFIGURATION_APIKEY=$uspsApiKey
+  -e USPS_CONFIGURATION_REMOTEAPIKEY=$uspsRemoteApiKey
+  -e USPS_CONFIGURATION_CONTEXT=$uspsContext
+  -e JAVA_OPTS=$java_opts"
+#
+if [ ! -z "$virtualHost" ]; then
+    dockerRunCommand="$dockerRunCommand -e VIRTUAL_HOST=$virtualHost"
+fi
+#
+if [ ! -z "$virtualPort" ]; then
+    dockerRunCommand="$dockerRunCommand -e VIRTUAL_PORT=$virtualPort"
+fi
+#
+if [ ! -z "$letsencryptHost" ]; then
+    dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_HOST=$letsencryptHost"
+fi
+#
+if [ ! -z "$letsencryptEmail" ]; then
+    dockerRunCommand="$dockerRunCommand -e LETSENCRYPT_EMAIL=$letsencryptEmail"
+fi
+#
+if [ ! -z "$hostPort" ]; then
+    dockerRunCommand="$dockerRunCommand -p $hostPort"
+fi
+#
+dockerRunCommand="$dockerRunCommand -d $artifactUrl/ipdp-app:$appVersion"
+#
+# Execute constructed docker run command to create $entityId-ipdp-app container connected to db and docker network
+echo "Executing docker run command"
+$dockerRunCommand