EDIT: As is tradition, I managed to get the development server up
and running literal seconds after posting this. I am going to leave it
up in case anyone has any advice for better practices!
-----ORIGINAL-----
TL;DR at the bottom.
Hello,
I am head of tech at a small education business. While our LMS server is up and running, there are some mechanical changes that could be done to improve it (such as upgrading Moodle and spinning off the database). However, I am very nervous to attempt any of this without being able to quickly and quietly restore to a previous state when something inevitably goes awry.
I have all three suggested backups running by various programs and cron tasks (as well as a less-frequent AWS snapshot of the whole server) on a scheduled basis, meaning that, theoretically, I have everything I need to restore quickly. Using these, I have been trying to spin up a separate, dummy server in AWS that is an exact copy of the live LMS; I want to be able to test the more dangerous changes on a development server before operating on the live one. And here is where the dilemma lies.
Most of the moodle documentation on backup/restore focuses around dropping the backups onto the (formerly-)live moodle server. This does not quite work when a new server is in place with a different IP and what not. My question, then, is: What steps or best practices should I follow to exactly recreate my live LMS on a separate, testing server?
My current steps are (probably time to note this is a Debian instance):- Spin up dummy server (some EC2 instance, in my case).
- Upload all three backups (code, data, and database) to the dummy server.
- Unpack each tarball/gzip.
- Copy the moodle code to webroot and recursively change ownership (apache) and permissions (755 or 644).
- Copy the moodledata to the dataroot and change ownership and permissions as above.
- Update config.php with the server's IP address and double-check dataroot location.
- Call mysql_secure_install to set root and root password.
- Unpack the database backup into the dummy's database.
- Add a moodle user with proper permissions to the database (as per initial set up). Match its username and password with that in config.php. Give it full management rights of the unpacked database.
- Within phpmyadmin, perform a search and replace of the absolute url of the live LMS and replace it with the dummy's public IPv4 (or domain, if one is attached).
- Access site?