Sign inSign up

ambroisemaupate/restic-database

By ambroisemaupate

•Updated 5 months ago

Extends restic/restic with an entrypoint that dumps a database before executing restic command.

Image
0

5.8K

ambroisemaupate/restic-database repository overview

This image extends official restic/restic with a special entrypoint that will dump your database into ${MYSQL_DUMP_FILENAME|PG_DUMP_FILENAME} file before executing restic command. Then you can use backup command to back up the dump file with your own options.

See Github repository⁠ for this image.

⁠Configuration for MySQL
services:
    backup_mysql:
        # Keep the same hostname for all Restic services
        hostname: restic-backup
        image: ambroisemaupate/restic-database
        environment:
            AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
            AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
            S3_STORAGE_CLASS: ${S3_STORAGE_CLASS}
            RESTIC_REPOSITORY: ${RESTIC_REPOSITORY}
            RESTIC_PASSWORD: ${RESTIC_PASSWORD}
            # Database credentials
            MYSQL_HOST: ${MYSQL_HOST}
            MYSQL_DATABASE: ${MYSQL_DATABASE}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
            MYSQL_USER: ${MYSQL_USER}
            # Database dump filename
            MYSQL_DUMP_FILENAME: ${MYSQL_DUMP_FILENAME}
        volumes:
            - restic_cache:/root/.cache/restic
        depends_on:
            - ${MYSQL_HOST}
        command: 'backup -o s3.storage-class=${S3_STORAGE_CLASS} --tag db ${MYSQL_DUMP_FILENAME}'

volumes:
    restic_cache:
⁠Configuration for PostgreSQL
services:
    backup_pgsql:
        # Keep the same hostname for all Restic services
        hostname: restic-backup
        image: ambroisemaupate/restic-database
        environment:
            AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
            AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
            S3_STORAGE_CLASS: ${S3_STORAGE_CLASS}
            RESTIC_REPOSITORY: ${RESTIC_REPOSITORY}
            RESTIC_PASSWORD: ${RESTIC_PASSWORD}
            # Postgres credentials
            PG_HOST: ${PG_HOST}
            PG_DATABASE: ${PG_DATABASE}
            PG_PASSWORD: ${PG_PASSWORD}
            PG_USER: ${PG_USER}
            PG_DUMP_FILENAME: ${PG_DUMP_FILENAME}
        volumes:
            - restic_cache:/root/.cache/restic
        depends_on:
            - ${PG_HOST}
        command: 'backup -o s3.storage-class=${S3_STORAGE_CLASS} --tag db ${PG_DUMP_FILENAME}'

volumes:
    restic_cache:

Tag summary

Content type

Image

Digest

sha256:8712fb8ed…

Size

29 MB

Last updated

11 months ago

docker pull ambroisemaupate/restic-database