Coder Social home page Coder Social logo

zhanggaoxuan / copybird Goto Github PK

View Code? Open in Web Editor NEW

This project forked from copybird/copybird

0.0 1.0 0.0 2.74 MB

Cloud-native universal backup tool for databases and files

Home Page: https://copybird.org

License: Apache License 2.0

Go 98.20% Dockerfile 0.88% Shell 0.92%

copybird's Introduction

Copybird

Copybird

Developed by Mad Devs Project Status: WIP โ€“ Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. GitHub release

Coverage Status Go Report Card License

About

Copybird is open-source cloud-native universal backup tool for databases and files.

It allows you to:

  1. Create database backup
  2. Compress backup stream
  3. Encrypt backup stream
  4. Send it to various destinations fast and secure
  5. Get notification about backup status in messagers and notification services
  6. Enjoy simple backup as a service with k8s backup controller

Backup process not using local storage for temp files.

learn more at copybird.org. Note that this repository is in Work in Progress status. Feel free to contribure. Read more about contributing below.

Databases

Currently Copybird supports the following databases:

  • MySQL
  • Postgres
  • MongoDB
  • Etcd (v2 and v3 API)

Compression

Copybird compresses with the following tools:

  • gzip
  • lz4

Encryption

Copybird uses AES-GCM for Efficient Authenticated Encryption

Output

Copybird can deliver encrypted compressed backup to the following destinations:

  • store the file locally
  • save it on GCP
  • save it on S3
  • send over HTTP
  • send over SCP

Notification services

Copybird currently supports the following notification services:

  • Slack
  • Telegram
  • AWS SES
  • AWS SQS
  • get notificatoin on email
  • Kafka
  • Nats
  • Create issue in PagerDuty
  • Pushbullet
  • RabbitMQ
  • Twilio
  • Webcallback

If you would like to add additional service, please submit an issue with feature request or add it yourself and send a Pull Request.

How to Run the tool

There are different ways you can use this tool:

Run locally

First get the source code on your machine

go get -u github.com/copybird/copybird

Then run it with go run main.go to see helpers for various optional parameters Example creating MySQL dump:

go run -v main.go backup -i 'mysql::dsn=root:root@tcp(localhost:3306)/test' -o local::file=dump.sql

Run with Docker

Run docker run copybird/copybird to see the available optional parameters

Use Backup Custom Controller/Operator for k8s

First create custom resource definition in your cluster:

kubectl apply -f operator/crd/crd.yaml

To run the controller:

go run main.go operator

And then in a separate shell, create custom resource:

kubectl create -f operator/example/backup-example.yaml

As output you get the following logs when creating, updating or deleting custom resource:

INFO[0000] Successfully constructed k8s client          
INFO[0000] Starting Foo controller                      
INFO[0000] Waiting for informer caches to sync          
INFO[0001] Starting workers                             
INFO[0001] Started workers               

You can modify example file as you wish to get proper configuration for your jobs

Tests

To run tests against MySQL module proceed with the following commands:

docker run --name test_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=test -d percona:latest
docker exec -i test_mysql mysql -uroot -proot test < samples/mysql.sql
cd modules/backup/input/mysql/
go test -v -cover

To clean up after you finish with tests:

docker kill test_mysql
docker rm test_mysql

To run tests against MySQLDump module, first make sure that you have mysqldump binary available in $PATH and then proceed with the following commands:

docker run --name test_mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=test -d percona:latest
docker exec -i test_mysql mysql -hlocalhost -uroot -proot test < samples/mysql.sql
cd modules/backup/input/mysqldump/
go test -v -cover

To clean up after you finish with tests:

docker kill test_mysql
docker rm test_mysql

To run tests against Postgres module proceed with the following commands:

docker run --name test_postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=test -d postgres:latest
docker exec -i test_postgres psql -U postgres test < samples/postgres.sql
cd modules/backup/input/postgresql/
go test -v -cover

To clean up after you finish with tests:

docker kill test_postgres
docker rm test_postgres

Contributing

Pull requests are more than welcomed. For major changes, please open an issue first to discuss what you would like to change.

Before submission of pull request make sure you pulled recent updates, included tests for your code that covers at least the core functionality and you submitted a desciptive issue that will be fixed with your pull request. Do not forget to mention the issue in the pull request.

Project started by Artem Andreenko, Andrew Minkin, and Mad Devs.

Built with Mad Devs support for the community

P.S. Love distributed and mesh? Meshbird.

copybird's People

Contributors

miolini avatar gen1us2k avatar 0veriords avatar anatoliyfedorenko avatar big-bo99 avatar nakylai avatar stanislavdev3 avatar tzununbekov avatar kbereza avatar kylycht avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.