annotate prod/install-itcm-db.sh @ 549:39326a8e4f3b

add export to java
author belknapSSDT <zach.belknap@mcoecn.org>
date Thu, 23 May 2024 10:03:26 -0400
parents e49038cbb14c
children
rev   line source
408
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
1 #!/bin/bash
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
2 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
3 # read required env variables
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
4 BASEDIR="$PWD"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
5 source $BASEDIR/.env/itcm-shared.properties
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
6 source $BASEDIR/.env/itcm-db.properties
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
7 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
8 # docker login
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
9 echo "attempting to login to $artifactUrl"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
11 # docker pull db image
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
12 echo "Attempting to pull $artifactUrl/itcm-$dbVersion"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
13 docker pull $artifactUrl/itcm-db:$dbVersion
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
14 #
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
15 # create itc management specific docker network for $entityId
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
16 echo "Attempting to create $entityId-itcm-net docker network"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
17 docker network create $entityId-itcm-net
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
18 # docker run itcm-db (data mounted as volume) connected to $entityId-itcm-net docker network
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
19 echo "Attempting to execute docker run command"
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
20 docker run --name $entityId-itcm-db \
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
21 --restart=unless-stopped \
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
22 --mount source=$entityId-itcm-db,target=/var/lib/postgresql/data \
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
23 --network $entityId-itcm-net \
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
24 -e POSTGRES_DB=itcmdb \
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
25 -e POSTGRES_PASSWORD=$dbPassword \
e49038cbb14c Add scripts for ITC Management application
Marc Davis <marc.davis@mcoecn.org>
parents:
diff changeset
26 -d $artifactUrl/itcm-db:$dbVersion