Awesome Open Source
Awesome Open Source

GoBackup

Simple tool for backup your databases, files to cloud storages.

Build Status GitHub release (latest by date) Docker Image Version (latest server)

GoBackup is a fullstack backup tool design for web servers similar with backup/backup, work with Crontab to backup automatically.

You can write a config file, run gobackup perform command by once to dump database as file, archive config files, and then package them into a single file.

It's allow you store the backup file to local, FTP, SCP, S3 or other cloud storages.

GoBackup backup/backup Crontab

GoBackup FTP...

https://ruby-china.org/topics/34094

https://gobackup.github.io/

Features

  • No dependencies.
  • Multiple Databases source support.
  • Multiple Storage type support.
  • Archive paths or files into a tar.

Current Support status

Databases

  • MySQL
  • PostgreSQL
  • Redis - mode: sync/copy
  • MongoDB

Archive

Use tar command to archive many file or path into a .tar file.

Compressor

Type Extension Parallel Support by
gz, tgz, taz, tar.gz .tar.gz pigz
Z, taZ, tar.Z .tar.Z
bz2, tbz, tbz2, tar.bz2 .tar.bz2 pbzip2
lz, tar.lz .tar.lz
lzma, tlz, tar.lzma .tar.lzma
lzo, tar.lzo .tar.lzo
xz, txz, tar.xz .tar.xz pixz
zst, tzst, tar.zst .tar.zst
tar .tar
default .tar

Encryptor

  • OpenSSL - aes-256-cbc encrypt

Storages

Install (macOS / Linux)

curl -sSL https://git.io/gobackup | sh

after that, you will get /usr/local/bin/gobackup command.

$ gobackup -h
NAME:
   gobackup - Easy full stack backup operations on UNIX-like systems

USAGE:
   gobackup [global options] command [command options] [arguments...]

VERSION:
   1.2.0

COMMANDS:
     perform
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Configuration

GoBackup will seek config files in:

  • ~/.gobackup/gobackup.yml
  • /etc/gobackup/gobackup.yml

Example config: gobackup_test.yml

models:
  gitlab:
    compress_with:
      type: tgz
    store_with:
      type: scp
      path: ~/backup
      host: your-host.com
      private_key: ~/.ssh/id_rsa
      username: ubuntu
      password: password
      timeout: 300
    databases:
      gitlab:
        type: mysql
        host: localhost
        port: 3306
        database: gitlab_production
        username: root
        password:
        additional_options: --single-transaction --quick
      gitlab_redis:
        type: redis
        mode: sync
        rdb_path: /var/db/redis/dump.rdb
        invoke_save: true
        password:
    archive:
      includes:
        - /home/git/.ssh/
        - /etc/mysql/my.conf
        - /etc/nginx/nginx.conf
        - /etc/nginx/conf.d
        - /etc/redis/redis.conf
        - /etc/logrotate.d/
      excludes:
        - /home/ubuntu/.ssh/known_hosts
        - /etc/logrotate.d/syslog
  gitlab_repos:
    store_with:
      type: local
      path: /data/backups/gitlab-repos/
    archive:
      includes:
        - /home/git/repositories

Usage

$ gobackup perform
2022/11/30 13:11:28 [Model: ruby_china] WorkDir: /tmp/gobackup/1669785088876548728/ruby_china
2022/11/30 13:11:28 [Database] => database | postgresql : postgresql
2022/11/30 13:11:28 [PostgreSQL] -> Dumping PostgreSQL...
2022/11/30 13:11:39 [PostgreSQL] dump path: /tmp/gobackup/1669785088876548728/ruby_china/postgresql/postgresql/ruby-china.sql
2022/11/30 13:11:39 [Database] => database | redis : redis
2022/11/30 13:11:39 [Redis] -> Invoke save...
2022/11/30 13:11:39 [Redis] Copying redis dump to /tmp/gobackup/1669785088876548728/ruby_china/redis/redis
2022/11/30 13:11:40 [Archive] => includes 7 rules
2022/11/30 13:11:41 [Compressor] => Compress | tgz
2022/11/30 13:12:09 [Compressor] -> /tmp/gobackup/1669785088876548728/2022.11.30.13.11.41.tar.gz
2022/11/30 13:12:09 [Encryptor] => Encrypt | openssl
2022/11/30 13:12:15 [Encryptor] -> /tmp/gobackup/1669785088876548728/2022.11.30.13.11.41.tar.gz.enc
2022/11/30 13:12:15 [Storage] => Storage | oss
2022/11/30 13:12:15 [OSS] endpoint: oss-cn-hongkong.aliyuncs.com
2022/11/30 13:12:15 [OSS] bucket: ruby-china-backup
2022/11/30 13:12:15 [OSS] -> Uploading backups/2022.11.30.13.11.41.tar.gz.enc...
2022/11/30 13:12:15 [Model] Cleanup temp dir...

Backup schedule

You may want run backup in scheduly, you need Crontab:

$ crontab -l
0 0 * * * /usr/local/bin/gobackup perform >> ~/.gobackup/gobackup.log

0 0 * * * means run at 0:00 AM, every day.

And after a day, you can check up the execute status by ~/.gobackup/gobackup.log.

License

MIT

Alternatives To Gobackup
Select To Compare


Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Go (167,684
Cli (131,712
Databases (92,865
Mysql (32,007
Postgresql (24,396
Redis (24,131
Backup (12,131
Archive (9,927
S3 (6,262
Ftp (3,674
Crontab (2,470
Scp (1,142