meteor-up icon indicating copy to clipboard operation
meteor-up copied to clipboard

Backup and restore mongodb

Open yanickrochon opened this issue 7 years ago • 20 comments

This is a feature request. It would be nice to run

mup dumpdb path/to/dest/

which would run mongodump on the server, and transfer the generated file into the dest directory.

mup restoredb path/to/dump

which would take the given dump and restore it into the database.

yanickrochon avatar Nov 11 '16 21:11 yanickrochon

+1

gaillota avatar Dec 08 '16 15:12 gaillota

+1

DanielKoehler avatar Feb 21 '17 03:02 DanielKoehler

+1

tonioknuth avatar Feb 22 '17 10:02 tonioknuth

please

s-devaney avatar Mar 23 '17 21:03 s-devaney

+1

mackbrowne avatar Mar 28 '17 17:03 mackbrowne

Yes please!

kodie avatar May 17 '17 16:05 kodie

+1

ziedmahdi avatar May 17 '17 23:05 ziedmahdi

+1 !!

movationdesign avatar May 22 '17 10:05 movationdesign

+1

fgriberi avatar Jul 04 '17 15:07 fgriberi

+1

fernandovfilho avatar Aug 02 '17 18:08 fernandovfilho

+1

gsilvestri avatar Sep 06 '17 22:09 gsilvestri

Backup and restore can be achieved via these steps , still having inbuild option in mup will do no harm. https://github.com/xpressabhi/mup-data-backup/

xpressabhi avatar Oct 31 '17 03:10 xpressabhi

Thank you for those suggesting solutions, however the point isn't that it is currently impossible to restore and backup the database, but that from the two comments, it is clear that the necessary instructions are awkward compared to the way and simplicity with which mup works.

Isn't the point of programming to make our life easier?

yanickrochon avatar Dec 26 '17 17:12 yanickrochon

It can be a plugin using @xpressabhi script

HazemKhaled avatar Jan 02 '18 14:01 HazemKhaled

Hi everybody,

I am trying to write a plugin to enable daily mongo backup on AWS. You can take a look at the code: https://github.com/lbke/vulcan-mongo-backup Though its not very general (tied to AWS and Vulcan.js) it could be a starting point if your database is colocated with your app.

My current solution consists in running mongodump in a cron job initiated by my app, which means installing mongodump within the Docker container and not directly on the server.

But... I can't get it to work. Here is my config, for an Ubuntu server, based on those instructions:

    docker: {
      image: "abernix/meteord:node-8.4.0-base",
      // install mongodump to allow programmatic backups
      buildInstructions:[
        'RUN'
        + ' apt-get install -y apt-transport-https libwebsockets-dev libssl-dev openssl libcurl3' // allow to download the key / need for mongo install to work
        + ' && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4' 
        + ' && echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list'
        + ' && apt-get update'
        + ' && apt-get install -y mongodb-org mongodb-org-tools'
      ]
    },

It fails at finding libssl, which seems necessary for the install to work. But the idea is there.

Hope it can help soemhow and someone manages to add a db backup feature to Meteor Up.

eric-burel avatar Nov 02 '18 13:11 eric-burel

@eric-burel why not try installing libssl on the server?

x5engine avatar Aug 07 '19 15:08 x5engine

Hi, you have to install mongodump within the Docker container if you want to setup the cron directly in your app. This way you can use Node and Meteor to manage your crons. Of course you can always setup the cron job directly on your server, but then you have a more complicated setup (write it in shell script or create another container for the job etc.).

eric-burel avatar Aug 16 '19 08:08 eric-burel

Hi all, my approach to the problem is to have a cron job running on my personal computer, that tries to pull the db every hour, but won't do it if a dump for today already exists. I've written a small blog post about it to explain the process. The code is specific to ubuntu and digital ocean but the approach is not. I agree that an automated function would be great.

https://renanlecaro.github.io/automating-backups-of-digital-ocean-meteor-up-install-to-your-ubuntu-workstation.html

renanlecaro avatar Aug 04 '20 06:08 renanlecaro

@zodern I saw you adding this to the 1.6 milestone. Do you intend to work on this? Would this imply to support management of cronjobs from MUP config?

jankapunkt avatar Mar 05 '21 09:03 jankapunkt