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

db-s3-backup

v0.0.3

Published

A tool to help backup your mongodb and redis databases to s3.

Downloads

4

Readme

MongoDB and Redis Backup to S3

This is a package that makes backing up your mongo and redis databases to S3 simple. The binary file is a node cronjob that runs at user specified time and backs up the database specified in the config file.

Based on node-mongodb-s3-backup

Installation

npm install -g db-s3-backup

Configuration

To configure the backup, you need to pass the binary a JSON configuration file. There is a sample configuration file supplied in the package (config.sample.json). The file should have the following format:

{
  "mongodb": {
    "host": "localhost",
    "port": 27017,
    "username": false,
    "password": false,
    "db": "database_to_backup"
  },
  "s3": {
    "mongo": {
      "key": "your_s3_key",
      "secret": "your_s3_secret",
      "bucket": "s3_bucket_to_upload_to",
      "destination": "/mongo",
      "encrypt": true,
    },
    "redis": {
      "key": "your_s3_key",
      "secret": "your_s3_secret",
      "bucket": "s3_bucket_to_upload_to",
      "destination": "/redis",
      "encrypt": true,
    }
  },
  "cron": {
    "time": "11:59",
  },
  "webhook": {
    "url": "webhook_request_url",
    "channel": "channel_name",
    "username": "username",
    "emoji": "emoji"
  },
  "redis": {
    "path": "absolute_path_to_redisdump",
    "name": "archive_name_over_s3"
  }
}

Crontabs

You may optionally substitute the cron "time" field with an explicit "crontab" of the standard format 0 0 * * *.

  "cron": {
    "crontab": "0 0 * * *"
  }

Note: The version of cron that we run supports a sixth digit (which is in seconds) if you need it.

Timezones

The optional "timezone" allows you to specify timezone-relative time regardless of local timezone on the host machine.

  "cron": {
    "time": "00:00",
    "timezone": "America/New_York"
  }

You must first npm install time to use "timezone" specification.

Running

To start a long-running process with scheduled cron job:

db-s3-backup <path to config file>

To execute a backup immediately and exit:

db-s3-backup -n <path to config file>

Alternatively (using config.json in root folder) npm start

License

MIT