Mercurial > public > ssdt-docker
annotate prod/install-inventory-db.sh @ 426:bb2b3172d497
USASR-5154 updated email
author | belknapSSDT <zach.belknap@mcoecn.org> |
---|---|
date | Wed, 27 Sep 2023 11:22:56 -0400 |
parents | cf7166c5c52f |
children |
rev | line source |
---|---|
363
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
1 #!/bin/bash |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
2 # |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
3 # read required env variables |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
4 BASEDIR="$PWD" |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
5 source $BASEDIR/.env/ssdt-inventory-shared.properties |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
6 source $BASEDIR/.env/ssdt-inventory-db.properties |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
7 # |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
8 # docker login |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
9 echo "Attempting to login to $artifactUrl" |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
10 docker login $artifactUrl -u $artifactUser -p $artifactPassword |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
11 # docker pull db image |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
12 echo "Attempting to pull $artifactUrl/inventory-db:$dbVersion" |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
13 docker pull $artifactUrl/inventory-db:$dbVersion |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
14 # |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
15 # Create inventory specific docker network for $entityId |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
16 echo "Attempting to create $entityId-inventory-net docker network" |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
17 docker network create $entityId-inventory-net |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
18 # docker run inventory-db (data mounted as volume) connected to $entityId-inventory-net docker network |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
19 echo "Attempting to execute docker run command" |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
20 docker run --name $entityId-inventory-db --restart=unless-stopped --mount source=$entityId-inventory-db,target=/var/lib/postgresql/data --network $entityId-inventory-net -e POSTGRES_DB=invdb -e POSTGRES_PASSWORD=$dbPassword -d $artifactUrl/inventory-db:$dbVersion |
cf7166c5c52f
INV-196 Move inventory scripts to prod directory
Matt Calmes <calmes@ssdt-ohio.org>
parents:
diff
changeset
|
21 |