Backing up and restoring your BBRF data

Philippe Delteil
2 min readJul 9, 2021

Ok, now you have your domains, your urls and IPs from your programs. Filling that information takes some effort and time.

Don’t be like me, I lost all my data because of a stupid mistake. I was trying to remove a program manually, ended up removing everything.

I had no backups, mostly because they are not easy to configure. It's not like doing a mysqldump, it's a bit more complicated.

First, I needed to find a way to do the backup that would make it easy to add to a cron entry or to run it as a script. After some tries and errors, I found this repo, after few months using it, I can say it works pretty well.

You will need to install npm, that took me a while. Many errors that I had to fix. Probably you'd have more luck.

Here's the script I used to backup my valuable information (optimized for cron use):

SHELL=/bin/bash
export NODE_TLS_REJECT_UNAUTHORIZED='0'
export COUCH_URL=https://USERNAME:PASSWORD@DOMAIN:PORT
export COUCH_DATABASE=bbrf
DATE=$(date +"%y-%m-%d")
file="couchbackup$DATE.txt"
/usr/local/bin/couchbackup > $file
/bin/gzip $file

And this is my cron entry:

0 8 * * 1 ~/backup-couchDB.sh 2> errors.txt

The process takes over one hour, in my case the compressed file is around 150 MB, the DB size is around 1,7 GB.

Restoring it!

Restoring the backed up data is a bit simpler, we just need to run couchrestore:

export NODE_TLS_REJECT_UNAUTHORIZED='0'
export COUCH_DATABASE=bbrf
cat couchbackup.txt | couchrestore --url https://admin:adminpassword@localhost:6984
Output of the restoring process!

I hope this helped you in some way! Give me some claps in order to survive.

--

--

No responses yet