How two new sloppy.io features helped fixing a grav bug

How two new sloppy.io features helped fixing a grav bug
19. December 2017 Mike Michel

We’ve just released two new major features for our docker container hosting platform: console access and the opportunity to create snapshots for every container. My initial plan was to demonstrate the snapshot feature by creating a new article in Grav and then reverting to a snapshot version before the article.

Grav, which was just awarded “Best Flat File CMS 2017“, is a very cool CMS with a beautiful admin dashboard. On sloppy.io you can set it up with just a few clicks (Note, that by now the current version is 1.3.10):

 

I opened up the Grav admin panel, only to see that there was a version upgrade available.

Yay, upgrades available. Let’s do this!

After a few seconds, Grav was upgraded without an error. But when I headed over to the “Plugins” section, I got this:

Oops, this was not looking good. The same error message popped up when navigating to “Themes”. After a little bit of searching on the official website, I found an article about an issue with Grav 1.3.9 which also seemed to apply to the beta version I just installed. The suggested fix to upgrade to version 1.3.10 meant a downgrade in my circumstances, since I was running 1.4.0-beta.1 now.

To do this, I had to use the Grav CLI, for which I needed console access, one of the features we happen to just have released! Going back to my sloppy.io dashboard, I headed to my Grav project, clicked the “Manage” icon for my Grav app, and then switched to the “Console” tab. Here we go:

Inside /var/www/grav a bin/gpm direct install https://github.com/getgrav/grav/releases/download/1.3.10/grav-admin-v1.3.10.zip downgraded the version immediately. After this, I needed to change the owner of all directories under /var/www/grav to www-data with chown -R www-data:www-data /var/www/grav. A page reload on my Grav admin panel showed that everything was working again.

Luckily, this went well. But how could I have prevented all this downgrade action? Of course, I would not have clicked the “upgrade to beta xy” button in a production environment without prior extensive testing. This was just a play around page, so there was no problem in breaking it.

But what about apps that just can’t be reverted to the state before you triggered an upgrade? The answer to that is our second new feature: Snapshots! Again, heading to your project, then clicking on the “Manage” icon and switching to the “Volumes” tab, just one click on the “Create Snapshot” button and your persistent data is saved to a snapshot in seconds, allowing you to return to it anytime.

If you now run into any error after an upgrade, go over to the “Volumes” tab again and click on the revert icon to the right. Doing so, you can revert to a state where everything was working fine, which is especially useful for databases.

PS: If any Grav dev is reading this, we would love to offer a one-click installation for Grav like we do for other open source projects, but we only do this for official Docker images. If you need any help with this, contact us.

Don’t have a sloppy.io account yet? Sign up now, it’s free.