Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Cron backup to S3 if the MD5sum is different from the last backup. Note: replaced by https://github.com/getfundwave/s3-db-backup-cron which also does backups for MongoDB.

License

Notifications You must be signed in to change notification settings

getfundwave/s3-mysql-backup-cron

Repository files navigation

How to run:

  1. Build the image

docker build -t backups . --build-arg HOUR_OF_DAY=23

  1. Run the image
docker run -idt backups --env MYSQL_USERNAME=<> --env MYSQL_PASSWORD=<> --env SERVER=<> --env DB_NAME=<> --env BUCKET=<abc.bucket.com> --env AWS_ACCESS_KEY_ID=<> --env AWS_SECRET_ACCESS_KEY=<>
  1. Connect to the network of your DB container (Only when DB is in another container)

docker network connect <network_name> <backup_container>

  1. Verify backups manually

docker exec -it <backup_container> bash

Inside the container: sh script.sh

How to run (docker-compose):

Add the below section to your docker compose:

  backups:
    build:
      context: ./backups
      args:
        HOUR_OF_DAY: 23
    depends_on:
      - <"db">
    networks:
      - <db>
    environment:
      - BUCKET_NAME=<abc.bucket.com>
      - MYSQL_USERNAME=
      - MYSQL_PASSWORD=
      - SERVER=
      - DB_NAME=
      # Specify AWS credentials or skip if using AWS IAM roles 
      - AWS_ACCESS_KEY_ID=
      - AWS_SECRET_ACCESS_KEY=   
    restart: always

Using Dockerhub? Replace build: with image: fundwave/s3-mysql-backup-cron:latest, but you won't be able to change HOUR_OF_DAY as it's a build arg.

About

Cron backup to S3 if the MD5sum is different from the last backup. Note: replaced by https://github.com/getfundwave/s3-db-backup-cron which also does backups for MongoDB.

Resources

License

Stars

Watchers

Forks

Packages

No packages published