OpenShift makes me angry, I’m getting that out there right now. Okay, so I recently had to create a snapshot of an OpenShift application so I could upgrade it from a small gear to a medium one for extra grunt, however nobody told me anything of the process other than the basic commands to create and restore the snapshot. (Shameless plug to tutorial on snapshotting)
What I ended up with was a million errors in the php.log claiming the the MySQL environment variables didn’t exist and a website that wouldn’t connect to the database. Yay. Not helpful.
I tried a lot of things to fix this problem including: (click me to go to the fix)
- Turning it off and on again. (application restart)
- Removing MySQL and phpMyAdmin using RHC tools.
- Re-adding MySQL and phpMyAdmin using RHC tools.
- Shouting unnecessarily at my computer screen.
- Reading all the logs.
None of these worked. So I decided to just start over. This time I created the application as usual (PHP 5.4) let it do it’s startup thing, then added MySQL and phpMyAdmin. THEN I restored my snapshot to the application and everything suddenly started to work as the past 3 hours of infuriating debugging were utterly useless and a waste of precious time I could have been playing Watch_Dogs.
Nobody told me to add all the cartridges first, then restore the snapshot. One would assume that restoring a snapshot would restore cartridges too because a snapshot of the application would be how it was at the exact moment of snapshotting. No. Whatever.
Create the application and add ALL cartridges you had at the time you created the snapshot you want to restore. Then restore your snapshot. Everything should be peachy after that.