codes, bugs & demons

TL;DR Just use MariaDB. Guide. 📖

Since i started working on this website i constantly faced the same error from time to time, it happens if you decide to run your Ghost platfrom with MySQL instead of SQLite on Docker with Swarm mode enabled. The problem is, after some time of inactivity something happens in the connection betweeen Ghost and the database, and then, boom!

The infamous error.

After reading a lot of Github issues (here, here, here and here) i noticed that almost every user was reporting problems with the Docker overlay network encryption.

At first i tried to disable the encryption as many suggested and sadly it turned out to be basically useless, then i read about some solutions which involved pinging your database continuosly and i didn't like the approach.

Someone pointed the finger to Knex.js (aka the query builder used by Ghost), when i reached their website i noticed that they also supported MariaDB and surprisingly it worked out of the box with Ghost and Docker Swarm and timeouts were gone too, after a week of headaches i finally found a solution and it was so easy that i'm acually surprised it worked, just switch to MariaDB and you will solve your problems.

To be clear, MariaDB is intended as a drop-in replacement for MySQL, i'm not sure if this approach is supported by the Ghost team but the main goal of MariaDB was to replace MySQL completely, considered that i think that no real problem will face in the future.

NOTE I updated the previous article that explains how to host this platform with SSL and Cloud Storage, check the article to know more.