GithubHelp home page GithubHelp logo

lexoyo / backup-bot Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 137 KB

Backup Bot is an open-source software designed to automate daily backups of specified directories from multiple servers over SSH.

License: GNU Affero General Public License v3.0

Dockerfile 4.86% JavaScript 85.14% Shell 10.00%
backup libre ssh vps

backup-bot's Introduction

backup-bot

Backup Bot is an open-source software designed to automate daily backups of specified directories from multiple servers over SSH.

Features

  • Connect to multiple servers via SSH
  • Create ZIP backups of specified folders
  • Upload backups to S3-compatible storage
  • Send email reports with backup status and errors
  • Execute a command before backing up a server
  • Support folders with blob in their names, e.g. /path/to/folder/my_*_data
  • npm package @internet2000/backup-bot
  • Docker image internet2000/backup-bot
  • In config add a list of files with a "delay", check that the file is in the archive and it is recent enough

Prerequisites

  • Node.js (version 14 or later)
  • SSH access to the servers
  • rsync installed on the servers
  • S3-compatible storage (e.g., AWS S3, MinIO)
  • Email SMTP server for sending reports

Installation

Using npx

npx @internet2000/backup-bot

Using npm

npm install -g @internet2000/backup-bot

Using Docker

  1. Build the Docker image:

    docker build -t backup-bot .
  2. Run the Docker container:

    docker run -v $(pwd)/config.yaml:/app/config.yaml backup-bot

Configuration

Config file

Create a config.yaml file in the root directory with the following structure:

servers:
  - host: server1.example.com
    user: username
    backupCommand: "echo \"This command will run before backup\""
    folders:
      - /path/to/folder/ # Folders need a trailing slash
      - /path/to/file.txt # Support files
      - /path/to/all_*_folders/ # Support "*" in the file name or last folder only
  - host: server2.example.com
    user: username
    folders:
      - /path/to/folder3
s3:
  endpoint: s3.example.com
  bucket: your-bucket-name
  access_key: your-access-key
  secret_key: your-secret-key
email:
  smtp_server: smtp.example.com
  smtp_port: 587
  username: [email protected]
  password: your-email-password
  to: [email protected]

Env vars

Here are the available environment variables.

S3-compatible storage:

  • S3_ENDPOINT: S3-compatible storage endpoint
  • S3_BUCKET: S3 bucket name
  • S3_ACCESS_KEY_ID: S3 access key
  • S3_SECRET_ACCESS_KEY: S3 secret key
  • S3_REGION: S3 region

Email:

  • SMTP_SERVER: SMTP server
  • SMTP_PORT: SMTP port
  • SMTP_USERNAME: SMTP username
  • SMTP_PASSWORD: SMTP password
  • MAIL_FROM: Email sender
  • MAIL_TO: Email recipient
  • MAIL_DRY_RUN: Dry run mode (true if exists)

Report:

  • REPORT_SUBJECT_SUCCESS: Email subject for successful backups
  • REPORT_SUBJECT_ERROR: Email subject for failed backups
  • REPORT_INCLUDE_FILE_TREE: Include file tree in the email report, true if set to 'true', false by default

Used by the Docker image:

  • CONFIG_YAML: Content of the config.yaml file, see the Config file section
  • SSH_PRIVATE_KEY: SSH private key
  • CRONJOB: Cron job schedule, e.g 0 1 * * * /app/run.sh

Usage

Using npx

npx @internet2000/backup-bot

Using npm

backup-bot

Using Docker

docker run -v $(pwd)/config.yaml:/app/config.yaml @internet2000/backup-bot

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

  1. Fork the repository
  2. Commit your changes (git commit -m 'Add some AmazingFeature')
  3. Push (git push origin main)
  4. Open a pull request

backup-bot's People

Contributors

lexoyo avatar

Stargazers

Emmanuel Salomon avatar

Watchers

 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.