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

mongodbbackup

v2.0.0

Published

Cli for Automated MongoDB backup

Downloads

13

Readme

MongoDb Backup

Cli for Automated MongoDB backup. Supports AWS S3 backups, Dropbox backups, Email/HTTP notifications, pre/post hooks and internal crontab.

NPM version Downloads Dependency Status

Installation

Install with npm:

npm install mongodbbackup -g

Configuration

Example configuration file examples/conf.json

Create configuration file using

mbk example <path for conf.json>

Use any command in mongodump with same name (without '--')

archive options

  • gzip this will automagically add --gzip and --archive arguments for compressing backup file
  • tar (default) will use tar -zcvf command to compress backup files
  • zip will use zip -zcvf command to compress backup files but sudo apt-get install zip should be installed

For example: excludeCollection: 'test' will add --excludeCollection test to mongodump command.

email notification Look at nodemailer for email notification support. %s in email body will be replaced with backup result.

Sample backup result:

{
    part: 'mongodb 127.0.0.1',
    steps: {
        '1': '2016-07-19T14:51:23+03:00',
        '2': '2016-07-19T14:51:23+03:00',
        '3': '2016-07-19T14:53:52+03:00',
        '4': '2016-07-19T15:26:50+03:00'
    },
    dump: {
        tmp: '/tmp/tmp-2721hWBSejbRpHQn',
        name: '2016-07-19_14-51.gz',
        output: '/tmp/tmp-2721hWBSejbRpHQn/2016-07-19_14-51.gz'
    },
    to: [{
        Expiration: 'expiry-date="Tue, 18 Oct 2016 00:00:00 GMT", rule-id="Rule for the Entire Bucket"',
        Location: 'https://xxxx.s3.eu-central-1.amazonaws.com/2016-07-19_14-51.gz',
        Bucket: 'backups',
        Key: '2016-07-19_14-51.gz',
        ETag: '"e1bfa5e25186e64b014db6f3af882534-84"'
    }]
}

Running

Need help? use --help argument

mbk backup <path to conf.json>
Crontab
mbk backup <path to conf.json> --cron='* * * * * *'

But I need to close terminal window. How can I run without cancelling backup script? Well use nohup or use default job scheduler (crontab etc.)

nohup mbk backup /home/ubuntu/backup.json --cron='* 5 * * * *' > /home/ubuntu/backuplog.out 2> /home/ubuntu/backuplog.err < /dev/null &
Changing temporary directory

Temporary directory should be exist and must have appropriate write permissions.

mbk backup <path to conf.json> --tmp='/absolute/and/existing/directory'
Debugging
mbk backup <path to conf.json> --debug

Contribution

This is a fairly new tool, so any contribution are welcomed. What should we focus?

  • FTP/SFTP support
  • Testing
  • Amazon EFS
  • ~~Dropbox like support~~
  • ~~Debugging~~
  • ~~Temporary dir option~~

Contributors

We welcome contributions of all kinds from anyone.

My boss wants a license. So where is it?

MIT License