Code Monkey home page Code Monkey logo

serverbackup's Introduction

ServerBackup

Build Status

Server backup to cloud

It can rotate the bucket which is backup destination of each day.

Prerequisites

Any sync tool

For example,

Setup

$ sudo -i
# mkdir -p /backup/log
# mkdir /backup/tmp
# cd /backup
# git clone --depth 1  https://github.com/tilfin/serverbackup.git
# cd serverbackup
# cp backup.conf.sample backup.conf

Quick Settings for Google Cloud Storage

Install gsutil

# apt-get install python-dev python-crypto
# cd /backup
# wget https://storage.googleapis.com/pub/gsutil.tar.gz
# tar zxf gsutil.tar.gz

Setup gsutil authentication

# /backup/gsutil/gsutil config -o /backup/serverbackup/boto.cfg

The above method is that the token refresh does not work. It is permanently set up in the following way.

  1. Create a service account at your Google cloud console.
  2. Select to furnish a new private key whose type is P12.
  3. Put created .p12 file at /backup/serverbackup/<secret key file.p12>
  4. Write /backup/serverbackup/boto.cfg with the content of the following
[Credentials]
gs_service_client_id = <service account email address>
gs_service_key_file = /backup/serverbackup/<secret key file.p12>
gs_service_key_file_password = <pass phrase for key file>

[Boto]
https_validate_certificates = True

[GSUtil]
content_language = en
default_api_version = 2
default_project_id = <Google Developer Project ID>

backup.conf

Edit following entries.

  • Buckets
  • Sync
Buckets=backup-bucket
Sync=/backup/serverbackup/sync.gsutil

Backup commands

bkcmd.d behaves like rcX.d. Kick each script with prefix 'S' in this directory. ${BKUP_PREFIX} is combined backup directory path and file prefix which is the day number (ex /backup/tmp/3-).

Crontab

Kick backup at 3:00am

0 3 *   *   *     /backup/serverbackup/backup

You can mail a backup result if you set MAILTO in crontab.

serverbackup's People

Contributors

tilfin avatar

Watchers

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