Backup and transfers
There are 4 places where data unique to your bot is stored:
config.yml
contains your basic settingsadmin_panel/media
contains all the assets you have uploaded through the admin panel- All data is stored in a PostgreSQL database
- Automatic backups of the database are available in
pgbackups
Manual backups/transfers
This is if you want to proceed to a complete backup of everything, or transfer your bot to a different machine.
First, make sure your bot is fully turned off. Do docker compose down
if you're running Docker.
- The
config.yml
can simply be copied. Be careful not to share it as it contains your bot token! - Same for
admin_panel/media
, you can create a zip archive with all its contents - You can also transfer
pgbackups
if you wish to preserve backups too.
Then you must make a dump of the database.
Creating a database dump
This will generate a file data-dump.sql
which you need to preserve, containing all the data.
Importing a database dump
This will print a lot of lines such as INSERT
or ALTER TABLE
. Check the logs to ensure no errors were produced.
Warning
This only works if the database is completely empty!
If you messed up and wish to reset the database to redo the import, follow this.
Restoring a backup
If you accidentally deleted something important, or your database became corrupted, you can restore a backup. They are located in the pgbackups
folder.
First, you must wipe the database. Then, locate the backup file you want to use (we will assume it's named ballsdex-latest.sql.gz
and follow the instructions according to your OS.
macOS/Linux
Windows
Open the ballsdex-latest.sql.gz
using 7zip and extract the resulting .sql
file. Move it to your bot's folder, then:
Wiping the database
If you need to reset the PostgreSQL database (importing data, restoring a backup), do this:
Danger
This is irreversible, be extra sure that your backups are there!