Backup and Restore
It is recommended to backup your databases before each ASM version upgrade. In case that you encounter any issue during the upgrading you will be able to restore your previous version.
Backup and Restore for ASM 7.0.0 and ASM 7.0.1
The following steps describe how to backup ASM 7.0.0 or ASM 7.0.1.
Backup
- Stop all services except from the databases.
$ docker stop docker_adm_1 docker_service-aggregator_1 docker_asm_1 docker_gateway_1 docker_keycloak_1
- Enter the container.
$ docker exec -it -u postgres docker_db_1 bash
- Dump the databases inside the container.
$ cd /tmp
$ pg_dump asm > asm.sql
$ pg_dump domain_manager > domain_manager.sql
- Exit the container.
$ exit
- Copy the SQL files to the host.
$ docker cp docker_db_1:/tmp/asm.sql .
$ docker cp docker_db_1:/tmp/domain_manager.sql .
Restore
- Stop all services except from the databases.
$ docker stop docker_adm_1 docker_service-aggregator_1 docker_asm_1 docker_gateway_1 docker_keycloak_1
- Copy the SQL files to the new database container.
$ docker cp <path_to_file>/asm.sql docker_db_1:/
$ docker cp <path_to_file>/domain_manager.sql docker_db_1:/
- Enter the container.
$ docker exec -it -u postgres docker_db_1 bash
- Drop the databases, create them again and run the SQL files.
$ psql template1 -c 'drop database asm'
$ psql template1 -c 'drop database domain_manager'
$ psql template1 -c 'create database asm'
$ psql template1 -c 'create database domain_manager'
$ psql asm < asm.sql
$ psql domain_manager < domain_manager.sql
- Exit the container.
$ exit
- Start all the services' containers again.
$ docker start docker_adm_1 docker_service-aggregator_1 docker_asm_1 docker_gateway_1 docker_keycloak_1
Backup and Restore for ASM 7.1.0 +
The following steps describe how to backup ASM 7.1.0 or later version.
Backup
- Stop all services except from the databases.
$ docker stop docker_adm_1 docker_service-aggregator_1 docker_asm_1 docker_gateway_1 docker_keycloak_1
- Enter the container.
$ docker exec -it -u postgres docker_db_1 bash
- Dump the databases inside the container.
$ cd /tmp
$ pg_dump asm > asm.sql
$ pg_dump keycloak > keycloak.sql
$ pg_dump domain_manager > domain_manager.sql
- Exit the container.
$ exit
- Copy the SQL files to the host.
$ docker cp docker_db_1:/tmp/asm.sql .
$ docker cp docker_db_1:/tmp/keycloak.sql .
$ docker cp docker_db_1:/tmp/domain_manager.sql .
Restore
- Stop all services except from the databases.
$ docker stop docker_adm_1 docker_service-aggregator_1 docker_asm_1 docker_gateway_1 docker_keycloak_1
- Copy the SQL files to the new database container.
$ docker cp <path_to_file>/asm.sql docker_db_1:/
$ docker cp <path_to_file>/keycloak.sql docker_db_1:/
$ docker cp <path_to_file>/domain_manager.sql docker_db_1:/
- Enter the container.
$ docker exec -it -u postgres docker_db_1 bash
- Drop the databases, create them again and run the SQL files.
$ psql template1 -c 'drop database asm'
$ psql template1 -c 'drop database keycloak'
$ psql template1 -c 'drop database domain_manager'
$ psql template1 -c 'create database asm'
$ psql template1 -c 'create database keycloak'
$ psql template1 -c 'create database domain_manager'
$ psql asm < asm.sql
$ psql keycloak < keycloak.sql
$ psql domain_manager < domain_manager.sql
- Exit the container.
$ exit
- Start all the services containers again.
$ docker start docker_adm_1 docker_service-aggregator_1 docker_asm_1 docker_gateway_1 docker_keycloak_1