GitHub Action for backing up DB & Directories at regular intervals.
Uses
Heads up !! Notes
This action backups the things and store it to /github/workspace/backups
folder inside the container. You can attach several actions available at the Marketplace and store this backup to your choice of location.
Pre Requisites
- SSH Key Access to Remote Server. How to setup?
My Workflow / Example Usage
Action Name: Backup-Action
Feel free to contribute.
name: backup db
on:
schedule:
- cron: "0 10 * * 1" # Every Monday at 10 AM UTC
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Backup MySQL DB
uses: valerianpereira/backup-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
key: ${{ secrets.DEPLOY_KEY }}
type: db
db_type: mysql
db_user: ${{ secrets.MYSQL_USER }}
db_pass: ${{ secrets.MYSQL_PASS }}
db_port: 3306
db_name: world
Output:
DB type: mysql
๐โโ๏ธ Running commands over ssh...
======CMD======
mysqldump -q -u *** -P 3306 -p'***' world | gzip -9 > mysql-world.1109201613.sql.gz
======END======
err: mysqldump: [Warning] Using a password on the command line interface can be insecure.
==============================================
โ
Successfully executed commands to all host.
==============================================
๐ Loading the deploy key...
Done!! ๐ป
๐ Sync the mysql backups... ๐
Warning: Permanently added '***' (ECDSA) to the list of known hosts.
receiving incremental file list
mysql-world.1109201613.sql.gz
0 0% 0.00kB/s 0:00:00
623.78K 18% 605.53kB/s 0:00:04
3.45M 100% 2.32MB/s 0:00:01 (xfr#1, to-chk=0/1)
sent 51 bytes received 3.46M bytes 628.39K bytes/sec
total size is 3.45M speedup is 1.00
๐ค Whats the location of backups...
/github/workspace/backups
๐ Show me backups... ๐
total 3M
-rw-r--r-- 1 *** *** 3.3M Sep 11 16:14 mysql-world.1109201613.sql.gz
Submission Category:
Maintainer Must-Haves
Yaml File or Link to Code
valerianpereira / backup-action
Action to backup directories and databases to a Github repository
๐๏ธ backup-action
GitHub Action for backing up DB & Directories.
First of all, Thanks
Heads up !! Notes
This action backups the things and store it to /github/workspace/backups
folder inside the container. You can attach several actions available at the Marketplace and store this backup to your choice of location.
Pre Requisites
- SSH Key Access to Remote Server. How to setup?
Example Usecase
name: backup db
on
schedule
- cron: "0 10 * * 1" # Every Monday at 10 AM UTC
jobs
build
name: Build
runs-on: ubuntu-latest
steps:
- name: Backup MySQL DB
uses: valerianpereira/backup-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
key: ${{ secrets.DEPLOY_KEY }}
type: db
โฆAdditional Resources / Info / Usecases
- Backup & Push to S3
- Backup & Push to Server via Rsync
- Backup & Push to Server via SCP
- Backup & Push to Artifacts
- Backup & Push to Github
Top comments (0)