Note: These instructions apply to versions before 1.18.10 - please refer to the Post 1.18.10 Maintenance Instructions for newer versions of Test Modeller.

Backup

Backup Postgres


Backup the Postgres docker database

Create a backup dump file

Use the following command to create an SQL dump file, while the TestModeller environment is up and running

docker exec -t testmodeller_db pg_dumpall -c -U admin > postgres_dump_`date +%d%m-%Y""%H%M_%S`.sql

Backup the folder that contains the Postgres docker database

In a standard installation the Test Modeller database lives in the /data folders (however, this is configurable in the .env file). You can choose to backup these folders instead of backing up the database itself. To restore, simply replace the existing /data folders with the backed up copies.

Backup the Postgres database if it lives outside docker

Open a new command window and enter the following command. Replace the parameters with your appropriate details:

pg_dump -h -p -U -W backup_[date].sql

Backup Neo4j


Backup the Neo4j docker database

Open a new command window and enter the following command. Replace the parameters with your appropriate details:

docker exec -t testmodeller_graph bin/neo4j stop
docker exec -t testmodeller_graph bin/neo4j-admin dump –database=graph.db –to=- > neo4j_dump_date +%d%m-%Y""%H%M_%S.dump

Restore

Restore Postgres


Restore the Postgres docker database

Restore from a backup dump file

  • Bring down the TestModeller environment if it is running

docker-compose -f docker-compose-fullstack.yml down

  • Rename the data folder where the postgres DB lives - by default it is /data/postgres

mv /data/postgres /data/postgres_bak

  • Create an empty folder where the old one was

mkdir /data/postgres

  • Start only the DB docker-compose service

docker-compose -f docker-compose-fullstack.yml run --rm --name testmodeller_db -d postgres_db

  • Restore from the backup dump

cat backup_file.sql | docker exec -i testmodeller_db psql -U admin --dbname postgres

  • Stop the DB docker-compose service

docker-compose -f docker-compose-fullstack.yml stop postgres_db

  • Bring the TestModeller environment up

./run.sh

Restore the Postgres database if it lives outside docker

Open a new command window and enter the following command. Replacing the parameters with your appropriate details.

psql -h localhost -d -U -f -W

Restore Neo4j


Neo4j Restore

Open a new command window and enter the following command. Replace the parameters with your appropriate details:

bin/neo4j stop
bin/neo4j-admin load –from=/backups/graph.db/2016-10-02.dump –database=graph.db –force

Change Database Password

Change Postgres Password

Change Postgres password in the corresponding docker container

sudo docker exec -it testmodeller_db psql -U admin postgres 
alter user postgres with password 'new password'; 
\q
CODE

Change docker-compose file and restart services (docker-compose down, docker-compose up)

Change environment variable POSTGRES_PASSWORD in postgres_db service

Change environment variable DATA_PASS in api service

Change Neo4j Password

Navigate to Neo4J machine – http://localhost:7474 and enter below command to change password

:server change-password
CODE

Change docker-compose file and restart services (docker-compose down, docker-compose up)

Change environment variable NEO4J_AUTH in neo4j_db service

Change environment variable GRAPH_PASSWORD in api service