/app-dump

Quick in-app database dump and restore for Meteor

Primary LanguageCoffeeScript

Meteor App-Dump

A Simple In-App Backup/Restore solution for Meteor

App-Dump UI Demo

❗ This package should be used a simple tool to aid development. Use mongodump and mongorestore proper for mission critical operations.

⚠️ Restoring a backup will destroy existing data.

👍 Works on meteor.com hosting

Usage

Example: http://app-dump-example.meteor.com/, or check the /example folder

Generates a downloadable tar backup of the current mongo database, which can be uploaded to restore.

Use {{> appDumpUI}} to add download and upload UI to your template.

Secure the download and upload method on the server:

if Meteor.isServer
  appDump.allow = ->
    # do your own auth here -- eg. check if user is an admin...
    if @user?.admin
      return true

Additionally, if you're using iron-router hooks to secure your routes, use the following to add an exception (thanks @Khalid545):

Router.onBeforeAction IR_Filters.mustBeSignedIn,
  except: ['appDumpHTTP']

You can use {{> appDumpUI advanced=true}} to get additional options:

  • JSON/BSON Output Format - you can only restore in BSON format at the moment
  • Drop collections on restore
  • Specific collection backup
  • Specific query backup (in JSON format, eg {"deleted":false})

What's wrong with hitchcott:backup-restore?

It doesn't work with the meteor.com deployment servers because it requires MongoDB to be installed on the host system.

hitchcott:app-dump uses a pure node implementation, so does not require mongodump or mongorestore. It also uses streams for serving the tar, so it's a bit more efficient and secure.

TODO

- [bug] I have experienced an issue with large grid-fs collections being restored while writes are occuring.
- Tests

Author

Chris Hitchcott, 2014, MIT License

Contributors

Benjamin Chalich, 2015 - pull request to add query parameters to adjust functionality.

Thanks to

hex7c0 for creating mongodb-backup and mongodb-restore