All Projects โ†’ valerianpereira โ†’ backup-action

valerianpereira / backup-action

Licence: MIT license
๐Ÿ—„๏ธ Github Action to backup MySQL, MongoDB and PostgreSQL databases

Programming Languages

shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to backup-action

ansible-backup
Ansible daily backup role
Stars: โœญ 25 (-7.41%)
Mutual labels:  mysql-backup, postgresql-backup
synpse
Synpse is an all-in-one solution to manage your servers and IoT devices providing declarative app deployment, SSH access and TCP tunnels
Stars: โœญ 17 (-37.04%)
Mutual labels:  ssh
essh
Extended ssh command
Stars: โœญ 42 (+55.56%)
Mutual labels:  ssh
TailLog
ๅฎžๆ—ถๆ—ฅๅฟ—๏ผˆtail log๏ผ‰ๆŸฅ็œ‹็›‘ๆŽงๅฎขๆˆท็ซฏๅทฅๅ…ท
Stars: โœญ 79 (+192.59%)
Mutual labels:  ssh
ssh
A file transfer application
Stars: โœญ 18 (-33.33%)
Mutual labels:  ssh
seahorse
ELKFH - Elastic, Logstash, Kibana, Filebeat and Honeypot (HTTP, HTTPS, SSH, RDP, VNC, Redis, MySQL, MONGO, SMB, LDAP)
Stars: โœญ 31 (+14.81%)
Mutual labels:  ssh
reverse-ssh
Statically-linked ssh server with reverse shell functionality for CTFs and such
Stars: โœญ 548 (+1929.63%)
Mutual labels:  ssh
ssh
golang ssh lib simple for use
Stars: โœญ 15 (-44.44%)
Mutual labels:  ssh
ssh-rs
In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol (้™คๅŠ ๅฏ†ๅบ“ไน‹ๅค– ็บฏrustๅฎž็Žฐ็š„ ssh-2.0 client ๅ่ฎฎ)
Stars: โœญ 18 (-33.33%)
Mutual labels:  ssh
tosh
Imagine your SSH server only listens on an IPv6 address, and where the last 6 digits are changing every 30 seconds as a TOTP code...
Stars: โœญ 406 (+1403.7%)
Mutual labels:  ssh
sshecret
I can keep a SSHecret
Stars: โœญ 56 (+107.41%)
Mutual labels:  ssh
wormhole
A minimalistic Ansible-like tool for configuring remote servers via ssh
Stars: โœญ 22 (-18.52%)
Mutual labels:  ssh
public
util toolkit for go.golang ้€š็”จๅ‡ฝๆ•ฐๅŒ…
Stars: โœญ 135 (+400%)
Mutual labels:  ssh
terraform-google-nomad
๐Ÿ“— Terraform Module for Nomad clusters with Consul on GCP
Stars: โœญ 63 (+133.33%)
Mutual labels:  ssh
dystopia
Low to medium multithreaded Ubuntu Core honeypot coded in Python.
Stars: โœญ 59 (+118.52%)
Mutual labels:  ssh
trezor-ssh-agent
Trezor SSH Agent for Windows (Putty, WinSCP and more) + KeepKey supported!
Stars: โœญ 54 (+100%)
Mutual labels:  ssh
girltalk
A tool for helping stand up headless C2 for droppables.
Stars: โœญ 16 (-40.74%)
Mutual labels:  ssh
fugit
_Really_ lightweight git access control
Stars: โœญ 24 (-11.11%)
Mutual labels:  ssh
tmuxpair
Command line script for setting up a temporary tmux session for pair programming
Stars: โœญ 34 (+25.93%)
Mutual labels:  ssh
FastTunnel
expose a local server to the internet. ้ซ˜ๆ€ง่ƒฝ่ทจๅนณๅฐ็š„ๅ†…็ฝ‘็ฉฟ้€่งฃๅ†ณๆ–นๆกˆ ่ฟœ็จ‹ๅ†…็ฝ‘่ฎก็ฎ—ๆœบ ๅŸŸๅ่ฎฟ้—ฎๅ†…็ฝ‘็ซ™็‚น ๅๅ‘ไปฃ็†ๅ†…็ฝ‘ๆœๅŠก ็ซฏๅฃ่ฝฌๅ‘ httpไปฃ็†
Stars: โœญ 815 (+2918.52%)
Mutual labels:  ssh

๐Ÿ—„๏ธ backup-action

GitHub Action for backing up DB & Directories.

First of all, Thanks ๐Ÿ™ to @appleboy for drone-ssh & ssh-action to make this happen.

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

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
        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

More Examples with Additional Attachments:

Tips

  • You can refer to ci.yml for more understanding.
  • To backup all DB's of mysql pass db_name: --all-databases.

Input variables

See action.yml for more detailed information.

  • host - ssh host
  • port - ssh port, default is 22
  • username - ssh username
  • password - ssh password
  • passphrase - the passphrase is usually to encrypt the private key
  • sync - synchronous execution if multiple hosts, default is false
  • timeout - timeout for ssh to remote host, default is 30s
  • command_timeout - timeout for ssh command, default is 10m
  • key - content of ssh private key. ex raw content of ~/.ssh/id_rsa (private key)
  • key_path - path of ssh private key
  • fingerprint - fingerprint SHA256 of the host public key, default is to skip verification
  • script - execute commands
  • script_stop - stop script after first failure
  • envs - pass environment variable to shell script
  • debug - enable debug mode
  • use_insecure_cipher - include more ciphers with use_insecure_cipher (see #56)
  • cipher - the allowed cipher algorithms. If unspecified then a sensible

Backup Config:

  • type: type of backup to be triggered (directory or db) required
  • db_type: type of database eg: mongo / postgres / mysql
  • db_user: database username required
  • db_pass: database password (optional)
  • db_name: database name required
  • db_host: database host default: localhost
  • db_port: database port
  • auth_db: authenticationDatabase Required for Mongo DB v4.4.0 default: admin
  • args: additional arguments with backup command if you want to pass optional
  • dirpath: directory path to be backuped required when type is set to directory

SSH Proxy Setting:

  • proxy_host - proxy host
  • proxy_port - proxy port, default is 22
  • proxy_username - proxy username
  • proxy_password - proxy password
  • proxy_passphrase - the passphrase is usually to encrypt the private key
  • proxy_timeout - timeout for ssh to proxy host, default is 30s
  • proxy_key - content of ssh proxy private key.
  • proxy_key_path - path of ssh proxy private key
  • proxy_fingerprint - fingerprint SHA256 of the proxy host public key, default is to skip verification
  • proxy_use_insecure_cipher - include more ciphers with use_insecure_cipher (see #56)
  • proxy_cipher - the allowed cipher algorithms. If unspecified then a sensible

Setting up SSH Key

Login to Remote Server

Make sure to follow the below steps while creating SSH Keys and using them. Login with username specified in Github Secrets. Generate a RSA Key-Pair:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Add newly generated key into Authorized keys. Read more about authorized keys here.

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

Copy Private Key content and paste in Github Secrets.

clip < ~/.ssh/id_rsa

See the detail information about SSH login without password

Disclaimer

  • Check your keys.
  • Check your custom scripts properly.
  • Pass all credentials from Github Secrets.
  • Pass DB Credentials with Read-only access to database.
  • Use it at your own risk! ๐Ÿ™

Roadmap

  • Add Backup & Restore Commands Explanations to Readme
  • Features to generate Backup Reports and Store it in txt file.

Contributions

If you've ever wanted to contribute to open source, and a great cause, now is your chance!

Suggestions, Feedbacks, Improvements & Fixes are most welcome. ๐Ÿ™

Follow Us

That's all Folks. Enjoy.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].