Skip to content

Instantly share code, notes, and snippets.

@austonpramodh
Created March 21, 2021 19:55
Show Gist options
  • Select an option

  • Save austonpramodh/e91e92d44d1d716670195aaeafb2be60 to your computer and use it in GitHub Desktop.

Select an option

Save austonpramodh/e91e92d44d1d716670195aaeafb2be60 to your computer and use it in GitHub Desktop.
Docker-compose file for MYSQL with AutoBackup to S3
# Use root/example as user/password credentials
version: "3.1"
services:
db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: MYSQL_ROOT_PASSWORD
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: MYSQL_DATABASE
MYSQL_USER: MYSQL_PASSWORD
MYSQL_PASSWORD: MYSQL_ROOT_PASSWORD
volumes:
- db_data:/var/lib/mysql
ports:
- 3306:3306
cap_add:
- SYS_NICE
adminer:
image: adminer
restart: always
ports:
- 8080:8080
backup_mysql:
image: appleboy/docker-backup-database:mysql-8
logging:
options:
max-size: "100k"
max-file: "3"
environment:
FILE_PREFIX: MY_S3_FILE_PREFIX
STORAGE_DRIVER: s3
STORAGE_ENDPOINT: MY_S3_ENDPOINT
STORAGE_BUCKET: MY_S3_BUCKET
STORAGE_REGION: MY_S3_REGION
STORAGE_PATH: MY_S3_PATH
STORAGE_SSL: "false"
STORAGE_INSECURE_SKIP_VERIFY: "false"
ACCESS_KEY_ID: MY_S3_ACCESS_KEY_ID
SECRET_ACCESS_KEY: MY_S3_SECRET_ACCESS_KEY
DATABASE_DRIVER: mysql
DATABASE_HOST: db:3306
DATABASE_USERNAME: root
DATABASE_PASSWORD: MYSQL_ROOT_PASSWORD
DATABASE_NAME: ""
DATABASE_OPTS: "--all-databases"
TIME_SCHEDULE: "0 0 * * *"
TIME_LOCATION: Asia/Kolkata
depends_on:
- db
volumes:
db_data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment