Skip to content

appleboy/database-backup-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

database-backup-actions

backup mongo database backup mysql database backup postgres database

GitHub Action for periodically backup a your database (MySQL, Postgres or MongoDB) to Local Disk or S3 (AWS S3 or Minio).

Usage

Postgres

    - name: backup postgres
      uses: ./
      with:
        database_driver: postgres
        database_username: db
        database_password: db
        database_name: db
        database_host: postgres:5432

        storage_driver: s3
        access_key_id: 1234567890
        secret_access_key: 1234567890
        storage_endpoint: minio:9000
        storage_bucket: test
        storage_region: ap-northeast-1
        storage_path: backup

MySQL

    - name: backup mysql
      uses: ./
      with:
        database_driver: mysql
        database_username: db
        database_password: db
        database_name: db
        database_host: mysql:3306

        storage_driver: s3
        access_key_id: 1234567890
        secret_access_key: 1234567890
        storage_endpoint: minio:9000
        storage_bucket: test
        storage_region: ap-northeast-1
        storage_path: backup

MongoDB

    - name: backup mongo
      uses: ./
      with:
        database_driver: mongo
        database_username: db
        database_password: db
        database_name: db
        database_host: mongo:27017
        database_opts: "--authenticationDatabase admin"

        storage_driver: s3
        access_key_id: 1234567890
        secret_access_key: 1234567890
        storage_endpoint: minio:9000
        storage_bucket: test
        storage_region: ap-northeast-1
        storage_path: backup

Input variables

See action.yml for more detailed information.

Database Section

  • database_driver - support postgres, mysql or mongo. default is postgres
  • database_username - database username
  • database_password - database password
  • database_name - database name
  • database_host - database host
  • database_opts - see the pg_dump, mysqldump or mongodump command

Storage Section

  • storage_driver - support s3 or disk. default is s3
  • access_key_id - minio or aws s3 access key id
  • secret_access_key - minio or aws s3 secret access key
  • storage_endpoint - s3 endpoint. default is s3.amazonaws.com
  • storage_bucket - s3 bucket name
  • storage_region - s3 region. default is ap-northeast-1
  • storage_path - backup folder path in bucket. default is backup and all dump file will save in bucket/backup directory
  • storage_ssl - default is false
  • storage_insecure_skip_verify - default is false

Schedule Section

  • time_schedule - you may use one of several pre-defined schedules in place of a cron expression.
  • time_location - by default, all interpretation and scheduling is done in the machine's local time zone. you can specify a different time zone on construction.

About

GitHub Actions for periodically backup your database (MySQL, Postgres, or MongoDB) to S3 or local disk.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published