Database migration
On host running the APP module:
-
End or wait for all active scans to complete.
-
Stop the application server:
sudo systemctl stop derscanner-app
-
Do a database dump:
sudo docker exec app-db pg_dump -U backend backend > db_dump.sql
-
Memorize or write down the value of the hibernate.connection.password field in /opt/derscanner/app/configs/backend.env.
On Host_2 where you want to deploy the PostgreSQL DBMS:
-
Install PostgreSQL DBMS version 13.0 or higher.
-
Create a user in the database with the name backend and the password from the hibernate.connection.password field.
-
Create an empty database named backend from the user named backend:
- for host:
sudo createdb -p 5432 -h localhost -U backend backend
(may require the user postgres,sudo su - posrgres
) - for Docker:
sudo docker exec <Container_Name> createdb -p 5432 -h localhost -U backend backend
- for host:
-
Create a database dump (db_dump.sql) into an empty database:
- for host:
sudo cat db_dump. sql
sudo psql -p 5432 -h localhost -U backend -d backend
(may require postgres user,sudo su - posrgres
) - for Docker:
sudo cat db_dump.sql | sudo docker exec -i \<CONTAINER_NAME\> psql -p 5432 -h localhost -U backend -d backend
- for host:
-
Make the connection to the server available externally.
On host with the APP module:
-
Open the /opt/derscanner/app/configs/backend.env file for editing.
-
Change hibernate.connection.url=jdbc:postgresql:/app-db:5432/backend?ssl=falsee changing the name of the app-db container connection to the address of the server with the deployed database, for example: hibernate.connection.url=jdbc:postgresql:/####.###.#.####:####/backend?ssl=falsee.
-
Save the changes and start the application service:
sudo systemctl start derscanner-app