npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ec-backup

v1.1.2

Published

Backup tool to make it easy

Downloads

6

Readme

EC Backup (easy-backup)

If you need a system easy to use that provides you a periodic (or at specific time) backup. This is your package.

Requirements

Right now this package is tested only on Ubuntu 20.04 LTS and you need to have the following packages in order to work:

  • zip: sudo apt install zip
  • Mongo Database Tools (only in case that your backup is from MongoDB)
    • Tested version: 100.5.2

How to install

Just npm i -g ec-backup or use it with npx ec-backup

How to use

  • First you need to create the config file that ec-backup will read its instructions (see section below for this).
  • You can validate your config file with: ec-backup validate -f <yourconfigfilepath>

One single time

If you want to backup only one time (or to verify that your process works well) just: ec-backup backup -f <yourconfigfilepath>

Also, you can use --dry to do not notify and upload your backup zip, but you can check that backup file is created where you specify in the config:

Cron

To create the process you must specify an ID, some examples:

  • ec-backup cron --id example-id -f <yourconfigfilepath>: create a cron process
  • ec-backup cron --stop --id example-id: try to stop a cron process with id example-id
  • ec-backup cron --list: list all current cron precesses

Config

Configuration file is split in 3 main parts:

  • Backup engine: what kind of data source we will backup
    • mongo: backup your database from MongoDB
    • file: choose files from your system to backup
  • Notificator: how do you want to be notified
    • telegram: uses a channel and a bot to notify all your backups
    • console: just print to console
  • Uploader: where we put your fresh backup
    • gcp: Google Cloud Storage
    • none: drop it where you specified in outputDir field

Skeleton

Use following examples (backup engines, notificator, uploader) to make your own config file, here is the skeleton:

{
   "cron": "* * * * * *", // Cron schedule expression (https://crontab.guru)
   "outputDir": "/tmp", // Temporary folder to store your backup until upload
   "engine": { ... } // Backup engine config,
   "notificator": { ... } // Notificator config,
   "uploader": { ... } // Uploader config
}

Backup engines

mongo

{
  "type": "mongo",
  "databaseHost": "", // Host name of your MongoDB
  "databasePort": 27017, // [Optional] Database port. Defaults to 27017
  "databaseName": "",
  "username": "" // [Optional] In case that your DDBB needs auth
  "password": "" // [Optional]
}

file

{
  "type": "file",
  "path": "" // Path to drop out the zipped backup
}

Notificator

Telegram

{
  "type": "telegram",
  "chatId": "", // ID of the chat where you want to be notified
  "botToken": "" // Token ID (without "bot" prefix in case that have) (https://core.telegram.org/bots)
}

Note: You can obtain the chatId from this URL: https://api.telegram.org/bot/getUpdates. Substitute <putYourToken> with your bot token

Console

{
  "type": "console"
}

Uploader

Google Cloud Storage

{
  "type": "gcp",
  "storageKeyPath": "", // JSON Key file that authenticate your program on GCP
  "backupsFolderPath": "", // [Optional] Name of the folder inside the bucket to put the backup. Defaults to "backups"
  "bucketName": "",
  "projectId": ""
}