annotate prod/install-workflows-db.sh @ 484:237618ae3f10

USASR-5154 revert
author belknapSSDT <zach.belknap@mcoecn.org>
date Thu, 28 Sep 2023 16:33:14 -0400
parents 5909f75b4f13
children
rev   line source
383
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
1 #!/bin/bash
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
2 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
3 # read required env variables
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
4 BASEDIR="$PWD"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
5 source $BASEDIR/.env/ssdt-workflows-shared.properties
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
6 source $BASEDIR/.env/ssdt-workflows-db.properties
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
7 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
8 # docker login
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
9 echo "Attempting to login to $artifactUrl"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
11 # docker pull db image
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
12 echo "Attempting to pull $artifactUrl/ssdt-workflows-$dbVersion"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
13 docker pull $artifactUrl/ssdt-workflows-db:$dbVersion
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
14 #
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
15 # Create workflows specific docker network for $entityId
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
16 echo "Attempting to create $entityId-workflows-net docker network"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
17 docker network create $entityId-workflows-net
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
18 #docker run workflows-db (data mounted as volume) connected to $entityId-workflows-net docker network
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
19 echo "Attempting to execute docker run command"
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
20 docker run --name $entityId-workflows-db \
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
21 --restart=unless-stopped \
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
22 --mount source=$entityId-workflows-db,target=/var/lib/postgresql/data \
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
23 --network $entityId-workflows-net \
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
24 -e POSTGRES_DB=workflowsdb \
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
25 -e POSTGRES_PASSWORD=$dbPassword \
5909f75b4f13 fix stupid windows cr lf issue
Marc Davis <davis@ssdt-ohio.org>
parents: 376
diff changeset
26 -d $artifactUrl/ssdt-workflows-db:$dbVersion