Back-up and restore
The instructions are valid only for Allure TestOps version 5.
Why do you need this?
There are several reasons when you need to use back-up and restore.
- You need to migrate your DB from the container to the stand-alone version (which is a must for production with big amount of tests).
- You care about your data and do not want to lose the data.
We strongly recommend using standalone database deployment, i.e. the database server needs to run on a dedicated VM or bare metal server (not in a container/pod), otherwise most likely you are going to face the performance issues.
How to make the backup of the database for docker-compose deployment
Before you start the backup process or restore process, please stop all the containers which do not have -db_
in their names.
Allure TestOps databases backup
docker exec -t [CONTAINER_WITH_DB] pg_dump -c -U [POSTGRESQL_USER] > testops-backup.sql
where
CONTAINER_WITH_DB is the name of a container running the database.
POSTGRESQL_USER is the Postgres DB user name, you will find it in
.env
file
Restore a database
If you are started the containers using docker-compose, you need to stop the containers without the database as described in the prerequisites section.
Drop the existing (presumably empty) database.
docker exec -it [POSTGRESQL_CONTAINER] psql -U [POSTGRESQL_USER] -d postgres -c "DROP DATABASE testops"
Create empty database.
docker exec -it [POSTGRESQL_CONTAINER] psql -U [POSTGRESQL_USER] -d postgres -c "CREATE DATABASE testops"
Restore from previously made backup.
cat testops-backup.sql | docker exec -i [POSTGRESQL_CONTAINER] psql -U [POSTGRESQL_USER] -d testops
How to make the backup of the database for Kubernetes deployment
Allure TestOps databases backup
Stop all Allure TestOPs pods except the DB ones.
Create the DB dump as follows:
kubectl exec [pod-name] -- bash -c "pg_dump -U [postgres-user] testops" > testops-backup.sql
where
- pod-name is the name of the Postgres pod.
- postgres-user is the database user that is able to access the database.
Allure TestOps databases restoration
cat testops-backup.sql | kubectl exec -i [pod-name] -- psql -U [postgres-user] -d testops