WeBWorK Main Forum

Backup up before upgrading server?

Backup up before upgrading server?

by Alasdair McAndrew -
Number of replies: 1
Hello,

Over the past few years my server has become very messy, and more and more difficult to manage. So I'm going to rip it down to bare metal, so to speak, install a brand spanking new system (Ubuntu 18.04). and rebuild it with a view to better maintenance (Docker, other tools as needed). So before I do this: how do I best backup my WeBWorK site? I don't want to lose all that student info from the past few years.

Thanks very much,
Alasdair
In reply to Alasdair McAndrew

Re: Backup up before upgrading server?

by Danny Glin -
I put together a page on backing up WeBWorK a while back:

That information is more geared toward regular backups, but the principles are the same.

Short version: if you back up the courses directory and the database, you should be able to drop them in to a fresh install of WeBWorK and pick up where you left off. It's sometimes a little complicated if you are restoring to a different version of WeBWorK.

Slightly longer version:
Theoretically all course-specific files should be stored in /opt/webwork/courses. Some course-specific temp files are created within subdirectories of /opt/webwork/webwork2, but these shouldn't be necessary for things to work as they did before.

Here are the basic steps I would take to migrate between servers:
  • Do a mysqldump of the webwork database, and save it to a file.
  • Make a tar archive of /opt/webwork/courses
  • Build the new server and install WeBWorK from scratch (if the goal is to clean up, this will prevent you from carrying over any extra WeBWorK code and files)
  • Restore the database from your mysql dump file
  • Unpack the tar archive back into /opt/webwork/courses
You can instead archive the whole /opt/webwork directory, which will include your course files, the WeBWorK code and the problem libraries. This will guarantee that you are restoring the same version of WeBWorK that you were running before.

One big warning: though I have done this a couple of times (using the latter approach of archiving the whole /opt/webwork directory), I won't make any guarantees. I would highly recommend building a virtual machine and restoring to that to make sure that it works before wiping the live server and starting from scratch.