How to restore a backup
Restore Process
ChainLaunch provides a robust backup restoration mechanism that allows you to recover your blockchain network from previously created backups. This document outlines the steps to restore a backup using the chainlaunch backup restore command.
Prerequisites
Before restoring a backup, ensure you have:
- Access to the backup storage (S3-compatible storage)
- The necessary credentials (AWS access key, secret key)
- The Restic password used during backup creation
- Sufficient disk space at the destination location
Restore Command
The basic syntax for the restore command is:
export S3_ENDPOINT="http://localhost:9000"
export BUCKET_NAME="<YOUR_BUCKET_NAME>"
export BUCKET_PATH="<PATH_TO_BACKUP>"
export AWS_ACCESS_KEY="<YOUR_AWS_ACCESS_KEY>"
export AWS_SECRET_KEY="<YOUR_AWS_SECRET_KEY>"
export RESTIC_PASSWORD="<YOUR_RESTIC_PASSWORD>"
export OUTPUT_PATH="~/chainlaunch-restore"
chainlaunch backup restore \
--s3-endpoint="$S3_ENDPOINT" \
--bucket-name="$BUCKET_NAME" \
--bucket-path="$BUCKET_PATH" \
--aws-access-key="$AWS_ACCESS_KEY" \
--aws-secret-key="$AWS_SECRET_KEY" \
--restic-password="$RESTIC_PASSWORD" \
--output="$OUTPUT_PATH"
Then, after restoring the backup, you need to move from the OUTPUT_PATH to the correct location.
mv $OUTPUT_PATH/chainlaunch-restore/* ~/.chainlaunch
Then, you can start the server with the following command:
# Get the first database file name
DB_FILE=$(ls -1 ~/.chainlaunch/dbs | head -1)
# Start the server with the specific database file
chainlaunch serve --port=8100 --db=~/.chainlaunch/dbs/$DB_FILE
And you should be able to see the restored network in the UI, by accessing the chainlaunch server URL: http://localhost:8100/.