Self hosting Ghost with Docker and PlanetScale

I’m trying to run a ghost instance on my server using Docker with a DB instance from Planetscale. However, Planetscale only supports secure connections with SSL. Any idea how I can configure this?
This is my current docker-compose configuration

version: '3.1'

    image: ghost:5.33.7-alpine
    restart: always
      - 6060:2368
      - traefik.enable=true
      # see
      database__client: mysql
      database__connection__host: ${DB_HOST}
      database__connection__user: ${DB_USER}
      database__connection__password: ${DB_PASSWORD}
      database__connection__database: ghost

I tried passing database__connection__ssl: true as an environment which obviously didn’t work.
How can I pass SSL information here?

The answer seems to be at the URL that you pasted. Have you searched for SSL on that page?

Yup, and it doesn’t mention anything about docker configuration.

Read the section:

“ Running Ghost with config env variables”

Docker is configured with those.

So it’s explaining how to map docker environment variable syntax to the rest of the content on the page.

@ghost-host I’m curious – were you able to successfully set up Ghost with Planetscale in the end? Last I checked there were some schema incompatibilities but I would love to move to Planetscale.

I was initially able to add this line to my code successfully:

database__connection__ssl: '[{"rejectUnauthorized":true}]'

However, I ran into a migration error shortly after. It turns out that planetscale doesn’t allow foreign keys, which led me to ultimately give up on using it for my MySQL needs.

Fortunately, I stumbled upon an article that might be helpful: Host a Ghost 5 + MySQL 8 Site on Free Tier (2023 update) — The Autodidacts


Ah, still the foreign key error! Thanks for sharing @Alan_Kim :+1:

As of December 2023, PlanetScale now supports foreign key constraints.

There are some incompatibilities left but I made a small patch to Ghost to finally made work!

I created a guide if you want a quick setup Guide here .

I also made an example repository here. Let me know if you have any troubles with replication.