This script backuping postgresql database to Amazon S3.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Pavel Zhuravlev ebac71e2aa Удалить 'folder_backup.py' 10 months ago
README.md update README 10 months ago
db_backup.py add new settings and cleanup code 10 months ago

README.md

RaZZlom backup script

This script i wrote to backup my Misskey instance database to Amazon S3.

Getting Started

Install boto3 library:

pip install boto3

After installing boto3 set up credentials (in e.g. ~/.aws/credentials):

[default]
aws_access_key_id = YOUR_KEY
aws_secret_access_key = YOUR_SECRET

Then, set up a default region (in e.g. ~/.aws/config):

[default]
region=us-east-1

Clone git repository:

git clone https://codeberg.org/RaZZlom/razzlom_backup_script.git

Change default settings:

db_name = 'YOUR_DATABASE_NAME'
bucket_name = 'YOUR_BUCKET_NAME'
recipient = 'YOUR_GPG_KEY'
hash_type = 'sha512'  # md5 or sha512
logs_path = './logs/'

Then execute script with cron or systemd.timer every hour.

What script do:

  • Make postgres database dump
  • Encrypt dump with GPG key
  • Create md5 or sha512 checksum file
  • Upload encrypted file and checksum file to s3
  • Delete dump, encrypted file and checksum file from disk

To delete old backups from s3 you need to configure bucket Lifecycle rules.

Contact Me

Fediverse - @razzlom@quietplace.xyz
Mail - razzlom@riseup.net