How I lost all my Ghost blog content and how I recovered it with Google cache

How I lost all my Ghost blog content and how I recovered it with Google cache

Important: This should works to recover your posts content data.

Recently I reviewed the new features on new Ghost version and I decided to jump out to the new features like the native commenting and the new search feature.

On my environment I'm using a docker deployment and I'm using docker compose for the orchestration. I thought that the upgrade was a change like "change MySQL from 5.7 to 8.0", but it was not.

In that moment I had a configuration that I describe below

services:
  db:
      image: mysql:5.7
  ghost:
      image: ghost:5.2.3-alpine

And I was going to upgrade to

services:
  db:
      image: mysql:8.0
  ghost:
      image: ghost:5.12.0-alpine

I tested an upgrade on my local environment I everything runs very well, but I didn't realized that I didn't make a test with a DB with data saved, everything was running well and all the services raised up without any issue, after that I prepared my production deployment and I did it. The process didn't work, my Database crashed without a recover option and I couldn't do a downgrade.

After I read a lot of this problem I tried to revert all the process but my MySQL 5.7 database can't start again, I observed that there were a fatal compilation errors and the service entered in a restart bucle.

I panicked and without any ideas I decided to reinstall all from scratch and I forgot to make a backup for my old DB, and it was all, all my data was gone.

I tried to recover the data using this https://dev.mysql.com/doc/refman/5.7/en/innodb-table-import.html

But on my case it did not work, why?, because I replaced my docker volume with another one, It can be useful for anyone that already have the ".ibd" files and the MySQL server can't start.

After some hours I beginning to think about the google cache, I remembered that I saw some websites with that feature but I didn't remember how can I access it or how I could search it.

After a few turns on the google search engine I found the solution, I searched for my site on the search box, then:

  1. Click the three dots link
  2. Click the cached button

And you can access all the cached data that google save about your site, I just copied the data to the new blog posts and I recovered all the data that I lost from my DB. Fortunately I didn't have another important data on my DB.

In conclusion:

I committed 3 big mistakes:

  • Don't configuring a scheduled database backup.
  • Don't making a database backup before the upgrade.
  • Don't preserving the docker volume before the downgrade.