Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

borgjs

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

borgjs

📦 A tiny wrapper for BorgBackup to automate your backup workflow

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

📦 borgjs

A tiny wrapper for BorgBackup to automate your backup workflow

Gitter npm Travis

npm David JavaScript Style Guide

Overview

Please note borgjs needs you to run node >=4 and has been tested using borg v1.0.7

borgjs is a nodejs command line tool for BorgBackup.

After having tried a lot of backup solutions for my data, I've been using Borg for quite a while. It's rock solid and never let me down. It supports compression and authenticated encryption.

Backups should be as boring as possible, that's why I've created this tool in order to automate and constantly monitor the whole process, making it a little bit more user friendly.

Instead of writing complex bash scripts you can now just write a declarative configuration file, run borgjs in a crontab and forget about it.

It will take care of your backup workflow, sending you status reports through different possible channels.

Features

  • backup creation
  • prune old backup according to a set of rules declared in the configuration file.
  • check backups for consistency and integrity.
  • send success/failure reports via email, push notifications on your phone or native OS notifications.
  • lockfile system to prevent concurrent backup process running in the same destination.
  • output borg messages to stdout for easy logging.
  • highly configurable.

Usage CLI

In order to use borgjs, you need to configure borg before. This is an easy step, just follow the installation guide on the borg website.

Initialize an empty borg repository (for more details see the borg quickstart guide)

$ borg init /path/to/repo

Install borgjs globally

$ npm i -g borgjs

Running a backup is as easy as creating a borg repository and run

$ borgjs -c /User/me/borgjs.config.js

or

$ borgjs $(date +%Y-%m-%d-%H%M%S) -c /User/me/borgjs.config.js >> /Users/me/logs/$(date +%Y-%m-%d-%H%M%S).log

in case you want to specify the archive name and log to a file (useful if you run in as a cronjob).

$ borgjs --help

  A tiny wrapper for BorgBackup to automate your backup workflow

  Usage
  $ borgjs <archive><options>

Options
  -c, --config         config file path

Examples
  # run borgjs
  $ borgjs -c=/User/me/borgjs.config.js

  #run borgjs specifying the archive name, and log output to a file
  $ borgjs $(date +%Y-%m-%d-%H%M%S) -c /path/to/your/borgjs.config.js >> $(date +%Y-%m-%d-%H%M%S).log

Usage API

You can also use borgjs programmatically:

const borgjs = require('borgjs')
const config = {
  repository: '/Users/arny/Desktop/test/',
  paths: [
    '/Volumes/External/'
  ]
}
const archiveName = new Date().toString()

borgjs(config, archiveName)
.then(() => console.log('success'))
.catch((err) => console.log('error', err))

Notifications

borgjs supports a wide range of notifications.

This enables you to always keep an eye on your backups.

Notifications will never contain sensitive informations such as encryption keys of files involved in the backup process.

  • OS native notifications

screen shot 2016-10-24 at 17 50 29

  • push notifications (via pushbullet)

img_2890

  • email notifications

screen shot 2016-10-24 at 18 33 35

Configuration

module.exports = {
  // Specify an alternative absolute path for the borg executable
  // defaults to the one in $PATH
  // borgPath: '',

  // Borg repository path
  // can be remote or local
  // see http://borgbackup.readthedocs.io/en/stable/usage.html#borg-init
  // e.g. '/Users/me/Desktop/borg_backup' or 'user@myserver.cc:borg_backup'
  repository: '', // MANDATORY

  // An array of absolute paths to include in the backup
  // paths that do not exist will be excluded (useful when a network share is not mounted)
  paths: [ // MANDATORY
    //  '/Users/me',
    //  '/etc
  ],

  // An array of files/directories to exclude from backup
  // exclude: [
  //  '*/node_modules',
  //  '*.DS_Store'
  // ],

  // A prefix for backup archives
  // archivePrefix: 'backup',

  // Type of compression to use when creating archives.
  // See https://borgbackup.readthedocs.org/en/stable/usage.html#borg-create
  // lz4, zlib, lzma
  compression: '',

  // The encryption passphrase that will be used to set BORG_PASSPHRASE env variable
  // necessary to run automated backups with borg if your repository has been created with encryption
  //  passphrase: '',

  // Check repo consistency
  // See https://borgbackup.readthedocs.org/en/stable/usage.html#borg-check
  check: true,

  // Retention policy for pruning old backups
  // https://borgbackup.readthedocs.org/en/stable/usage.html#borg-prune for details.
  // prune: {
  //    H: 10,
  //    d: 7,
  //    w: 4,
  //    m: 6,
  //    y: 1,
  //    'keep-within': '31d'
  // },

  // Email configuration
  // See https://github.com/nodemailer/nodemailer options
  //  email: {
  //    from: 'me@site.net',
  //    to: 'you@site.net',
  //    smtpHost: 'smtp.mailgun.org',
  //    smtpPort: 587,
  //    user: 'postmaster@lalala.mailgun.org',
  //    pass: 'mypass',
  //    secure: false
  //  },

  // Send an email on success (the 'email' section must be configured)
  // sendSuccessMail: true,

  // Send an email on error (the 'email' section must be configured)
  // sendErrorMail: true,

  // Send native Desktop notifications on success/error
  sendSystemNotification: true

  // Send push notifications on success/error to your devices connected to pushbullet
  // See https://www.pushbullet.com/
  // pushbullet: {
  //  accessToken: 'your pushbullet access token'
  // }
}

Automate

A backup is not a backup if it's not automated.

I personally use cronnix to schedule my backup sessions on my mac.

Recipes

  • Borg can store data on any remote host accessible over SSH. If you prefer to store your offsite backup in some other fancy cloud storage, you can always backup to a local target, then upload it anywhere using rclone

  • I personally use rsync.net for my backup, they also apply dirty cheap pricing model to borg users. Please note I'm not affiliated with them, I'm just an happy paying customer.

Change Log

This project adheres to Semantic Versioning.
Every release, along with the migration instructions, is documented in the CHANGELOG.md file.

License

MIT

Keywords

FAQs

Package last updated on 24 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc