Backup and Restore

Backing up your exchange periodically is extremely important. In this section we explain how you can get a back up of your exchange and then restore it.

Backup

There are 2 things you should always periodically backup and store safely.

  • HollaEx Kit folder

  • Exchange Database

HollaEx Kit folder

The HollaEx Kit folder got every necessary configuration for your exchange and certain credentials and secrets used. It includes your exchange name, logo, currencies, trading pairs, and even your secrets such as database password. So please make sure to always keep it safe. It also means that once you kept HollaEx Kit safe, It is very easy to recreate the entire exchange infrastructure.

Exchange Database

HollaEx Kit exchange stores all exchange-related activities at the database. It uses PostgreSQL, so you can use any PostgreSQL-compatible dump tool to backup data. If you are using an external PostgreSQL database with HollaEx, we recommend you to keep an eye on your database provider's backup feature. HollaEx CLI also provides a one-line command to easily dump the entire database. hollaex toolbox --backup will do its job.

After a successful CLI dump of the database, the dump file will be stored in /backups folder in your HollaEx Kit. The /backups folder is created automatically through the CLI if it doesn't exist.

Setting up a cron job for doing backup is a best practice. If you add --skip flag with the command, the CLI would not ask you back for the confirmation.

hollaex toolbox --backup --skip.

Restore

You can easily recover the entire exchange assuming you already followed the backup process.

Simply copy the backup of your HollaEx Kit folder to the desired machine, and reinstall HollaEx CLI by using the `install.sh` installer at the Kit folder.

Now, run hollaex setup command, just like you did initially. This will setup your exchange based on the configuration you have already set.

Since we are not setting up the new exchange, and already configured values for the exchange in the past, Press Y.

It would build the new Docker image based on your Kit. Wait until it is built and push it to your Docker registry if needed.

Follow the CLI process to continue the setup, but make sure you DO NOT OVERRIDE your secrets in this step. These secrets are for your exchange's internal operations. The exchange will MALFUNCTION if you override them. MAKE SURE TO PRESS N FOR THIS STEP.

The rest should be straight forward. CLI will continue to set up the containers, currencies, trading pairs, and everything necessary. The exchange will be shut down once all the necessary processes are done.

Now, start the exchange by using hollaex start command, and check the status. You can use the hollaex status command to briefly verify the status of your exchange.

All good so far but there is one more step left: Restoring your database.

There's no need to worry. That's where database dump coming in. Copy the database dump file from your backup to the server, and follow the command down below

psql -h localhost -p 5432 -d hollaex -U <YOUR_DB_USERNAME> -W -f <DUMP_FILE_PATH>

You'll be able to check your DB username, password at /settings/secret file on your HollaEx Kit. This command would run psql operation to run database dump restore. Make sure to install psql at your environment first.

Since the CLI already initialized the new database while on hollaex setup there could be some duplication errors coming out while on the restore. But it is okay to ignore.

Once it's all done, restart the exchange to make sure the new data is fully applied by using hollaex restart.

Now, make sure to run hollaex status once again to check everything is running well. If there is no issue, you can proceed to run web client by running hollaex web --start, and see how it actually works with the client.

Try to login with the existing account you had and everything should be good.