gobackup

command module
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 13 Imported by: 0

README

GoBackup

CLI tool for backup your databases, files to FTP / SCP / S3 / GCS and other cloud storages.

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

GoBackup is a fullstack backup tool design for application servers, to backup your databases, files to cloud storages (Local disk, FTP, SCP, S3, GCS, Aliyun OSS ...).

Inspired by backup/backup and replace it for without Ruby dependency.

asciicast

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 的一站式备份工具,为中小型服务器/个人服务器而设计,配合内置的计划任务,实现定时备份的目的。

使用 GoBackup 你可以通过一个简单的配置文件,一次(执行一个命令)将服务器上重要的(数据库、配置文件)东西导出、打包压缩,并备份到指定目的地(如:本地路径、FTP、云存储...)。

https://gobackup.github.io

Features

  • No dependencies.
  • Multiple Databases source support.
  • Multiple Storage type support.
  • Archive paths or files into a tar.
  • Split large backup file into multiple parts.
  • Run as daemon to backup in schedully.

Databases

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

Storages

Notifier

since: 1.5.0

Send notification when backup has success or failed.

  • Mail (SMTP)
  • Webhook
  • Discord
  • Slack
  • Feishu
  • DingTalk
  • GitHub (Comment on Issue)
  • Telegram
  • AWS SES
  • Postmark
  • SendGrid

Installation

curl -sSL https://gobackup.github.io/install | sh

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

Install via Homebrew

brew install gobackup
$ gobackup -h
NAME:
   gobackup - Backup your databases, files to FTP / SCP / S3 / GCS and other cloud storages.

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

VERSION:
   1.3.0

COMMANDS:
   perform
   start    Start as daemon
   run      Run GoBackup
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print the version (default: false)

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
    storages:
      scp1:
        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:
    storages:
      local:
        type: local
        path: /data/backups/gitlab-repos/
    archive:
      includes:
        - /home/git/repositories

Usage

Perform backup

$ gobackup perform

Backup schedule

GoBackup built in a daemon mode, you can use gobackup start to start it.

You can configure the schedule for each models, it will run backup task at the time you set.

For example

Configure your schedule in gobackup.yml

models:
  my_backup:
    schedule:
      # At 04:05 on Sunday.
      cron: "5 4 * * sun"
    storages:
      local:
        type: local
        path: /path/to/backups
    databases:
      mysql:
        type: mysql
        host: localhost
        port: 3306
        database: my_database
        username: root
        password: password
  other_backup:
    # At 04:05 on every day.
    schedule:
      every: "1day",
      at: "04:05"
    storages:
      local:
        type: local
        path: /path/to/backups
    databases:
      mysql:
        type: mysql
        host: localhost
        port: 3306
        database: my_database
        username: root
        password: password

Start daemon

gobackup start

NOTE: If you wants start without daemon, use gobackup run instead.

Signal handling

GoBackup will handle the following signals:

  • HUP - Hot reload configuration.
  • QUIT - Graceful shutdown.
$ ps aux | grep gobackup
jason            20443   0.0  0.1 409232800   8912   ??  Ss    7:47PM   0:00.02 gobackup run

# Reload configuration
$ kill -HUP 20443
# Exit daemon
$ kill -QUIT 20443

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL