In the following we describe the recommended process for backing up and restoring all data from your Konnect™ access server.
To create a backup of your existing Konnect™ server deployment, first log in to your server with a remote shell.
ssh root@YOUR_KONNECT_HOST
Next, navigate to the installation directory. If you are using our cloud images or quickstart scripts, the default installation location is /opt/konnect
.
cd /opt/konnect
If your Konnect™ server is currently running, we need to stop the application stack, before backing up all data. The following commands show you the current status of the application stack, stop the stack and start the database component by itself.
docker compose ps
docker compose stop
docker compose up -d db
To access the database instance and create a backup, you will need your database password. This password was either set by you in your docker-compose.yml file when you installed Konnect™ server for the first time, or auto-generated by the cloud images or quickstart script. To get your database password, run:
grep "DB_PASSWORD" docker-compose.yml
Take a note of the password, then run the following command to create a database backup.
docker compose run db bash -c "export PGPASSWORD=YOUR_PASSWORD && pg_dump -h db -U postgres konnect_production" > konnect.backup
We can validate the backup file by running less konnect.backup
to look at the file contents. They should contain a line Postgresql database dump
at the start of the file.
Copy the konnect.backup
file to your local machine, for example you can use the scp
command to do so:
scp root@YOUR_KONNECT_HOST:/opt/konnect/konnect.backup .
To restore your backup on the new server, first follow the installation guide to setup your new Konnect™ server, or use our cloud images or quickstart scripts. Then, copy the konnect.backup
file that you created in the previous section to your new instance. Using the scp
command:
scp ./konnect.backup root@NEW_KONNECT_HOST:/opt/konnect/konnect.backup
Next, open a remote terminal session to your new Konnect™ server and initialize the application stack for the first time.
cd /opt/konnect
docker compose up
Wait for the green setup token
message that indicates that the first boot and initialization of the application stack is complete. You can now press CTRL+C
to stop the application stack and continue with the restore process. As before, we first ensure the application stack is stopped, then start the database component by itself.
docker compose ps
docker compose stop
docker compose up -d db
Also take a note of your new database password, if you used a cloud image, or our quickstart scripts it will be different from your old Konnect™ server as it was autogenerated during installation.
grep "DB_PASSWORD" docker-compose.yml
Before we can restore the data from your old instance, we need to re-create the database schema.
docker compose run db bash -c "PGPASSWORD=YOUR_PASSWORD psql -h db -U postgres -c 'DROP DATABASE konnect_production'"
docker compose run db bash -c "PGPASSWORD=YOUR_PASSWORD psql -h db -U postgres -c 'CREATE DATABASE konnect_production'"
Then we can copy the data backup into the fresh schema.
docker compose run db bash -c "PGPASSWORD=YOUR_PASSWORD psql -h db -U postgres konnect_production" < konnect.backup
Now it's time to restart the application stack.
docker compose restart
Access your new Konnect™ server with your web-browser and sign in with an administrator account that existed on your previous instance.
Then, navigate to Settings
> Server
and ensure the Hostname
value is correct - in case you are using IPs instead of DNS names, the IP address of your new deployment may be different from your previous deployment. Click on Save Settings
.
Your VPN status on the Dashboard likely says "Offline". Updating the Server Settings in the previous step triggered a complete re-generation of all configuration files and keys required by the network service. Those will get picked up after restarting the application stack.
docker compose restart
Log back into your new instance and the VPN status should now indicate "Active". Your restore is complete!