Bläddra i källkod

Adding upgrade instructions for Postgres

Andrej 1 vecka sedan
förälder
incheckning
a29b1ac3f4
2 ändrade filer med 30 tillägg och 1 borttagningar
  1. 29 0
      README.md
  2. 1 1
      bin/buildPGOnly.sh

+ 29 - 0
README.md

@@ -39,6 +39,35 @@ Check if database runs:
    labkeyDocker/bin/stopLabkey.sh
    ```
 
+#### Upgrade database
+
+   ```bash
+   $ bin/stopLabkey.sh
+   $ bin/startPGonly.sh
+   $ docker network inspect labkey_network
+#find IP of config-labkey-db-1
+   $ pg_dumpall -h IP -p 5432 -U postgres > /data/labkey/postgresql/X/dumpX.sql
+#type password several times
+   $ bin/stopLabkey.sh
+   $ mkdir /data/labkey/postgresql/Y/main
+#edit bin/env.sh so that $POSTGRESSDIR points to newly created dir
+#and DB_DOCKERFILE=$LBDOCKER/config/db/DockerfileY
+#change config/db/DockerfileY so it uses postgresql:Y
+   $ bin/buildPGonly.sh
+#by default, new image is named config-labkey-db:latest, and old image is now tag-less
+#consider retagging old image via docker tag OLDIMAGEID config-labkey-db:X
+   $ bin/startPGonly.sh
+#creates a new empty database at the new location
+#stop newly running server to corrects settings for import (we should clear password requirement)
+   $ bin/stopLabkey.sh
+   $ vi /data/labkey/postgresql/Y/main/pg_hba.conf
+#comment out host all all all scram-sha-256 and replace it with host all all all trust
+   $ bin/startPGAonly.sh
+   $ docker network inspect labkey_network
+#find IP of DB (probably the same as before)
+   $ psql -U postgres -h IP -p 5432 -f /data/labkey/postgresql/X/dumpX.sql
+```
+
 ### Files and external modules for LabKey
 
 The files and externalModules locations are set in `bin/env.sh`, see `bin/env.sh.sample`:

+ 1 - 1
bin/buildPGOnly.sh

@@ -3,5 +3,5 @@
 . $(dirname $0)/env.sh
 #docker network create -d bridge $NETWORK
 #$DOCKERCOMPOSE -f $COMPOSE up -d --build labkey-db;
-docker build --build-arg USER_ID --build-arg GROUP_ID -f ${DB_DOCKERFILE} .
+docker build --build-arg USER_ID --build-arg GROUP_ID -f ${DB_DOCKERFILE} -t config-labkey-db .