Backup script and docs finetuning (#655)
* Remove restore directory after restore * Backup bitcoin folder, excluding blocks and chainstate * Deprecate and warn about the old backup process * Update log messages * Add backup documentation
This commit is contained in:
@@ -35,7 +35,7 @@ cd $btcpay_dir
|
||||
dbcontainer=$(docker ps -a -q -f "name=postgres_1")
|
||||
if [ -z "$dbcontainer" ]; then
|
||||
printf "\n"
|
||||
echo "ℹ️ Database container is not up and running. Starting BTCPay Server …"
|
||||
echo "ℹ️ Database container is not up and running. Starting BTCPay Server …"
|
||||
docker volume create generated_postgres_datadir
|
||||
docker-compose -f $BTCPAY_DOCKER_COMPOSE up -d postgres
|
||||
|
||||
@@ -48,7 +48,7 @@ if [ -z "$dbcontainer" ]; then
|
||||
fi
|
||||
|
||||
printf "\n"
|
||||
echo "ℹ️ Dumping database …"
|
||||
echo "ℹ️ Dumping database …"
|
||||
{
|
||||
docker exec $dbcontainer pg_dumpall -c -U postgres | gzip > $dbdump_path
|
||||
echo "✅ Database dump done."
|
||||
@@ -57,18 +57,22 @@ echo "ℹ️ Dumping database …"
|
||||
exit 1
|
||||
}
|
||||
|
||||
printf "\nℹ️ Stopping BTCPay Server …\n\n"
|
||||
printf "\nℹ️ Stopping BTCPay Server …\n\n"
|
||||
btcpay_down
|
||||
|
||||
printf "\n"
|
||||
cd $docker_dir
|
||||
echo "ℹ️ Archiving files in $(pwd)…"
|
||||
echo "ℹ️ Archiving files in $(pwd)…"
|
||||
|
||||
{
|
||||
tar \
|
||||
--exclude="volumes/backup_datadir" \
|
||||
--exclude="volumes/generated_bitcoin_datadir" \
|
||||
--exclude="volumes/generated_litecoin_datadir" \
|
||||
--exclude="volumes/generated_bitcoin_datadir/blocks" \
|
||||
--exclude="volumes/generated_bitcoin_datadir/chainstate" \
|
||||
--exclude="volumes/generated_bitcoin_datadir/debug.log" \
|
||||
--exclude="volumes/generated_litecoin_datadir/blocks" \
|
||||
--exclude="volumes/generated_litecoin_datadir/chainstate" \
|
||||
--exclude="volumes/generated_litecoin_datadir/debug.log" \
|
||||
--exclude="volumes/generated_postgres_datadir" \
|
||||
--exclude="volumes/generated_clightning_bitcoin_datadir/_data/lightning-rpc" \
|
||||
--exclude="**/logs/*" \
|
||||
@@ -92,18 +96,18 @@ echo "ℹ️ Archiving files in $(pwd)…"
|
||||
}
|
||||
fi
|
||||
} || {
|
||||
echo "🚨 Archiving failed. Please check the error message above."
|
||||
printf "\nℹ️ Restarting BTCPay Server …\n\n"
|
||||
echo "🚨 Archiving failed. Please check the error message above."
|
||||
printf "\nℹ️ Restarting BTCPay Server …\n\n"
|
||||
cd $btcpay_dir
|
||||
btcpay_up
|
||||
exit 1
|
||||
}
|
||||
|
||||
printf "\nℹ️ Restarting BTCPay Server …\n\n"
|
||||
printf "\nℹ️ Restarting BTCPay Server …\n\n"
|
||||
cd $btcpay_dir
|
||||
btcpay_up
|
||||
|
||||
printf "\nℹ️ Cleaning up …\n\n"
|
||||
printf "\nℹ️ Cleaning up …\n\n"
|
||||
rm $dbdump_path
|
||||
|
||||
printf "✅ Backup done => $backup_path\n\n"
|
||||
|
||||
Reference in New Issue
Block a user