Migrate RevDeBug Server
Moving RevDeBug instances to a new VM
In the instructions, variable names are provided. Replace them with the ones used by you.
Backup PostgreSQL
Setting Up Environment Variables for PostgreSQL Login
If you are using the default variables to log in to RevDeBug PostgreSQL, you can use the following commands:
Change to the 'revdebug-server-docker-compose' directory:
Export the environment variables for PostgreSQL credentials using the following commands:
These commands will set up the necessary environment variables for PostgreSQL. Make sure you are in the correct directory containing the 'docker-compose.yml' file and the '.env' file before executing the commands.
Performing a PostgreSQL database backup
Create a folder for database backups and navigate to it:
Execute the command to create a backup of the PostgresSQL for the databases revdebug_db and keycloak:
Backup OpenSearch
Go to the directory named revdebug-server-docker-compose
Add path.repo configuration to docker-compose.yml
In the docker-compose.yml
file, add the following configuration to the environment
section of the opensearch
container:
Recreate the OpenSearch container to apply the changes
Enter the OpenSearch container
Run the following command to access the terminal within the OpenSearch
container:
Create a snapshot repository using a request
Issue a PUT request to create a repository for snapshots with the following command:
Verify if the repository has been created
You can check if the repository has been successfully created by using the following command:
List all snapshots taken so far
To list all the snapshots taken up to this point, run the following command:
Take a snapshot of the current OpenSearch database state
Create a snapshot of the current state of the OpenSearch database using the following command:
Note: Replace snapshot-name in previous step with a name of your choice for the snapshot (or use the default).
Verify if the snapshot was successful
Check if the snapshot was executed successfully using the following command:
Exit the container.
Copy the snapshot folder from the OpenSearch container
Shut down the RevDeBug server
To shut down the RevDeBug server, you can use the following command:
This command will stop and remove the containers, networks, and volumes associated with the RevDeBug server specified in the docker-compose.yml file. The -p option allows you to specify a project name, and in this case, it's set to revdebug.
Create a backup of RevDeBug server data, configuration, and databases
Navigate to the parent directory and create a new folder named backup
:
Create a backup of the server data
Exclude the directories apm_database and revdebug_database and compress the contents of /var/revdebug/ into a tarball named backup.tar.gz:
Create a backup of the server configuration
Compress the contents of the revdebug-server-docker-compose directory into a tarball named configuration.tar.gz:
Create a backup of the databases
Compress the contents of the db directory into a tarball named db.tar.gz:
After executing these commands, you should have three tarball files (backup.tar.gz, configuration.tar.gz, and db.tar.gz) containing the backups of the RevDeBug server data, configuration, and databases, respectively.
Please ensure that you have the necessary permissions to execute these commands and access the directories you want to back up.
Transfer backup files to the new server
Login to the new virtual machine.
If you already have a fresh instance of RevDeBug Server running, follow these steps to remove it data
Stop the RevDeBug server:
Remove all RevDeBug data:
Remove the RevDeBug server configuration files (optional, but steps below restore those from the old server):
Transfer backup files from the old server to the new server
Assuming you have access to both servers, use scp
to securely copy the BACKUP_FOLDER
from the old server to the BACKUP
folder on the new server. Replace YOUR_OLD_SERVER_ADDRESS
, HOME
, and USER
with appropriate values:
Unpack the backup files
Unpack the configuration backup (optional if you have a fresh RevDeBug Server configured already)
Create a new directory named revdebug-server-docker-compose and extract the contents of the configuration.tar.gz backup file inside it:
Unpack the server data backup
Create a new directory at /var/revdebug and extract the contents of the backup.tar.gz backup file into it:
Unpack the database backup
Extract the contents of the db.tar.gz backup file into the ./db directory:
Please ensure you replace YOUR_OLD_SERVER_ADDRESS, HOME, and USER in step 5 with the appropriate values specific to your old server. Similarly, in step 6, ensure that you use the correct paths for unpacking the backups on your new server.
Always be cautious when performing operations that may modify or overwrite data on your server. Make sure to have backups and verify the paths before executing the commands.
Set the given variables in the .env configuration file
Go to ./revdebug-server-docker-compose
Open the .env
file using a text editor and set the REVDEBUG_SERVER_NAME
variable to your new server address. For example:
Save the changes to the .env file.
Add path.repo configuration (optional if configuration is also moved from the old server)
In the docker-compose.yml
file, add the following configuration to the environment
section of the opensearch
container:
Start the containers with the databases
To start the containers for the databases (PostgreSQL and OpenSearch) in the background, use the following command:
This command will start the PostgreSQL and OpenSearch containers as specified in the docker-compose.yml file with the project name revdebug.
Please make sure you have the required permissions to execute Docker commands.
Restore PostgreSQL database
Setting Up Environment Variables for PostgreSQL Login
If you are using the default variables to log in to RevDeBug PostgreSQL, you can use the following commands:
Change to the 'revdebug-server-docker-compose' directory:
Export the environment variables for PostgreSQL login using the following commands:
These commands will set up the necessary environment variables for logging into PostgreSQL. Make sure you are in the correct directory containing the 'docker-compose.yml' file and the '.env' file before executing the commands.
Navigate to the uncompressed 'db' folder
Change to the directory where the database backup files are located:
Restore the Keycloak database using the following command:
Restore the revdebug_db database using the following command:
Please make sure to replace /home/USER/db/pg-backup-keycloak.sql and /home/USER/db/pg-backup.sql with the correct paths to your PostgreSQL backup files.
These commands will restore the databases 'keycloak' and 'revdebug_db' in the PostgreSQL container named 'revdebug-postgres-1'.
Restore OpenSearch database
Copy the snapshot folder to the OpenSearch container
Copy the snapshots
folder to the OpenSearch
container using the following command:
Enter the OpenSearch container as root
Access the OpenSearch container as the root user with the following command:
Set the user 'opensearch' as the owner of the 'snapshots' folder
Change the owner of the snapshots folder to the 'opensearch' user using the following command inside the container:
Execute the request to create the snapshot repository
Issue the request to create the snapshot repository with the following command:
Verify if the repository has been created
Check if the repository has been successfully created using the following command:
You can check the current structure of the database using the following command:
(Optional) Delete data from OpenSearch
If needed, you can delete all data from OpenSearch using the following command:
Perform the restore using the request
Issue the request to perform the restore with the following command:
Note: Replace snapshot-name in the previous step with a name assigned when doing the snapshot during backup or leave it as is if you have used the default.
Verify the database structure after the restore
You can check the structure of the database after the restore using the following command:
Start all RevDeBug Server containers
Navigate to the 'revdebug-server-docker-compose' directory
Change to the 'revdebug-server-docker-compose' directory using the following command:
Start all containers in the project
To start all the containers defined in the docker-compose.yml file, run the following command:
The -p option specifies the project name, and in this case, it's set to revdebug. The -d option runs the containers in the background (detached mode).
After running this command migrated RevDeBug Server should get running.
Last updated