Picture of Helen Bailey
Backup solution for Authoring Tool
by Helen Bailey - Wednesday, 29 July 2015, 1:49 PM
 

Hi all,

 

After a catastrophic deletion of my mongoDB data that led to a painful complete rebuild of a course in the authoring tool, I worked with my wonderful other half to create a backup procedure which would save and restore the current courses before I tried anything major or installed any plugins I wasn't sure about. 

It works for me and although it doesn't backup the entire course such as theme changes etc, it works for the pages, properties and components content, plugins and  stored in mongoDB. Now before trying anything new I run a quick backup so I can restore things to how they were if my intended plan goes awry.

I have posted our method below but if you use it please bear in mind it is at your own risk. Put simply it creates a copy of the DB using Mongo's own built in functionality and then overwrites it again to restore, but I hold no responsibility for any loss or failure of software, hardware, data or sanity if you choose to use this! 

OK on to the method :

  • create a folder called mongo. I placed this at C:\Users\Helen\mongo which is at the same level as where my adapt_authoring folder sits.
  • Inside the folder create a text file called backup.bat and paste the following inside it (check and amend the location of your MongoDB folder in the first line) :

-----------------------------------------

"C:\Program Files\MongoDB\Server\3.0\bin\mongodump"
pause

-------------------------------------------

  • create a second file in that folder called restore.bat and paste the following inside it (check and amend the location of CHOICE in the third line and your MongoDB folder in the fourth line) :

----------------------------------------------

@echo off
echo Contents of 'dump' folder will be restored into MongoDB
c:\WINDOWS\SYSTEM32\CHOICE /C Y /M "Are you sure you want to restore OVER the current database? CTRL-C to exit!"
"C:\Program Files\MongoDB\Server\3.0\bin\mongorestore" --drop
pause

-----------------------------------------------

  • Double click backup.bat to run it. Check the output then press enter to close the window.
  • A folder should have appeared in the mongo folder called dump
  • At this point you should rename the dump folder to something new like "working backup v1 july2015"
  • Every time you run backup.bat you will get a new dump folder from that moment in time.
  • At any time you want to restore a backup simply find the backup folder you want to restore such as "working backup v1 july2015", rename it to dump (making sure it's the only folder called dump first!) and then run restore.bat
  • You will be asked to confirm the restore. type Y if you want to continue.
  • If you change your mind, type Ctrl-C, then Y and Enter.
  • The DB will be restored to the status it was in when you took that backup.

 

Well that's it. Please let me know if you have any questions, try it and come across any issues or have a better idea! Hope it helps someone else to not have to rebuild a course :/

 

Helen