Backup and Restore

Postgres

Backup

Admin Panel

We will support to configure database automatically backup soon.

pg_dump

Postgres provides an official pg-dump command to let you dump your database to an zip file. check it out for more detail.

# dump db to a tar file
docker exec affine_postgres pg_dump --format c --file affine.backup --username affine -v    affine
#                                            ^ into compress file              ^DB_USERNAME ^DB_DATABASE  
# copy file from container
docker cp affine_postgres:/affine.backup ./affine.backup

Restore

Stop your instance

Before restoring the Postgres data, you must stop your instance.

Backup first

You must backup the current database before doing restore otherwise you are in the risk to lose ALL YOUR DATA!

# make sure all service get down before restoring
docker compose down

# clean up old postgres folder, remember to backup it first.
rm -rf ./postgres
# start postgres container
docker compose create
docker compose start postgres

# copy backup file to postgres container
docker cp ./affine.backup affine_postgres:/affine.backup

# restore
docker exec affine_postgres pg_restore --format c --dbname affine --username affine -v ./pg.backup
#                                                          ^ DB_DATABASE     ^DB_USERNAME

# restart
docker compose up -d

Blobs

If the blob storage is configured to use fs as provider, simply backup th whole {STORAGE_LOCATION} directory.

Configuration

Not implemented yet

You can export all your modified configurations in Admin Panel.