Database in production system
It's strongly recommended to deploy the database outside of container and run separately for the production environment as running in a container severely degrades the performance of the database if you have big amount of tests.
Allure TestOps uses 2 databases - uaa for user management and report to store all the tests related data.
DBE version requirements
Postgres DBE version should be no less than ver. 12.
Lowest version of Postgres DBE supported is the 11th, we’ll discontinue its support by the end of 2021.
Allure TestOps will be bricked if you will try to upgrade to a version 3.181.5 and further ones using Postgres ver. 9.
Making the backup of databases in containers (the source databases)
- Stopping services
To perform the back-up procedure stop gateway, report, uaa services.
docker-compose stop gateway report uaa
- Getting the names of the containers with the databases
docker-compose ps -a | grep db
allure-testops_report-db_1 docker-entrypoint.sh postgres Up 5432/tcp
allure-testops_uaa-db_1 docker-entrypoint.sh postgres Up 5432/tcp
the output of the commands on your side might be different so consider updating the following commands accordingly to your output.
- Creating backup copy of the databases
You can use either of the options below:
- Creating SQL dump
docker exec -t allure-testops_report-db_1 pg_dump -U report report > report.sql
docker exec -t allure-testops_uaa-db_1 pg_dump -U uaa uaa > uaa.sql
Once the backup copies are created we can import the backup data to standalone DB.
Restoring the backup to standalone database
The import procedure has three phases:
- Creation of the database.
- Restoration the data from backup copy.
- Updating the settings of Allure TestOps
Prerequisites
We assume here that you have installed Postgres DBE in your infrastructure. The installation procedure is out of scope.
Creating the databases
- You need to be authorized as DB admin
psql postgres
- Creating uaa database
You may consider changing the at least password for the uaa user.
CREATE DATABASE uaa TEMPLATE template0 ENCODING 'utf8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
CREATE USER uaa with encrypted password '[email protected]$w0rd';
GRANT ALL PRIVILEGES ON database uaa to uaa;
- Creating report database
You may consider changing the at least password for the report user.
CREATE DATABASE report TEMPLATE template0 ENCODING 'utf8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
CREATE USER report with encrypted password '[email protected]$w0rd';
GRANT ALL PRIVILEGES ON database report to report;
Restoring the data from backup copy
Now, you need your backup files. Depending on the dump type you've selected you need either the files report.sql + uaa.sql or report.dump + uaa.dump.
Restoration from SQL dump
psql -U report report < report.sql
psql -U uaa uaa < uaa.sql
Updating Allure TestOps settings files
The following actions are to be done in .env file.
You need to provide correct addresses for the strings between < and >
Settings for the uaa database in .env file
UAA_POSTGRES_URL=jdbc:postgresql://<host.docker.internal>:5432/uaa?assumeMinServerVersion=12&ApplicationName=allure_uaa_service
UAA_POSTGRES_USERNAME=uaa
[email protected]$w0rd
Settings for the report database in .env file
REPORT_POSTGRES_URL=jdbc:postgresql://<host.docker.internal>:5432/report?assumeMinServerVersion=12&ApplicationName=allure_report_service
REPORT_POSTGRES_USERNAME=report
[email protected]$w0rd
Checks and update of docker-compose.yaml
Start your Allure TestOps instance and check that everything is working as expected
docker-compose up -d
If everything is working as expected, then stop Allure TestOps and update docker-compose.yaml as follows:
docker-compose down
Remove following settings from docker-compose.yaml
uaa-db:
image: postgres:12
volumes:
- uaa-db-volume:/var/lib/postgresql/data
networks:
- allure
environment:
POSTGRES_DB: uaa
POSTGRES_USER: ${UAA_POSTGRES_USERNAME}
POSTGRES_PASSWORD: ${UAA_POSTGRES_PASSWORD}
...
report-db:
image: postgres:12
volumes:
- report-db-volume:/var/lib/postgresql/data
networks:
- allure
environment:
POSTGRES_DB: report
POSTGRES_USER: ${REPORT_POSTGRES_USERNAME}
POSTGRES_PASSWORD: ${REPORT_POSTGRES_PASSWORD}
In volumes section remove the following:
volumes: # do not change
uaa-db-volume: # This line is to be removed
report-db-volume: # This line is to be removed
report-mq-volume: # do not change
report-storage-volume: # do not change
Now, you can start Allure TestOps
docker-compose up -d
External DB for Kubernetes installation type
To use externally installed DB you need to do the following:
- Deploy Postgres DB ver. 12.
- Update
values.yml
file for Kubernetes installation as follows:
Settings for uaa microservice
You need to update settings for uaa service as follows:
uaa:
env:
open:
SPRING_DATASOURCE_URL: jdbc:postgresql://<host>:<port>/uaa
secret:
SPRING_DATASOURCE_USERNAME: "uaa"
SPRING_DATASOURCE_PASSWORD: "[email protected]$w0rd"
Settings for report microservice
You need to update settings for uaa service as follows:
report:
env:
open:
SPRING_DATASOURCE_URL: jdbc:postgresql://<host>:<port>/report
secret:
SPRING_DATASOURCE_USERNAME: "report"
SPRING_DATASOURCE_PASSWORD: "[email protected]$w0rd"