DatabaseError: Invalid database host

Hello,

I used portainer on my Synology to deploy a stack for ghost.

Issue is as soon as it starts the ghost docker instance immediately stops with the following error(s)

"Please double check your database config."
Error ID:
    500
Error Code: 
    ETIMEDOUT
----------------------------------------
DatabaseError: Invalid database host.
    at DatabaseStateManager.getState (/var/lib/ghost/versions/4.48.8/core/server/data/db/state-manager.js:64:32)
    at DatabaseError.KnexMigrateError (/var/lib/ghost/versions/4.48.8/node_modules/knex-migrator/lib/errors.js:7:26)
    at new DatabaseError (/var/lib/ghost/versions/4.48.8/node_modules/knex-migrator/lib/errors.js:55:26)
    at /var/lib/ghost/versions/4.48.8/node_modules/knex-migrator/lib/database.js:50:23
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async DatabaseStateManager.getState (/var/lib/ghost/versions/4.48.8/core/server/data/db/state-manager.js:40:13)
    at async DatabaseStateManager.makeReady (/var/lib/ghost/versions/4.48.8/core/server/data/db/state-manager.js:73:25)
    at async initDatabase (/var/lib/ghost/versions/4.48.8/core/boot.js:69:5)
    at async bootGhost (/var/lib/ghost/versions/4.48.8/core/boot.js:414:9)
Error: connect ETIMEDOUT
    at Connection._handleTimeoutError (/var/lib/ghost/versions/4.48.8/node_modules/mysql2/lib/connection.js:189:17)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)

The docker compose file I used was this:

version: '3.1'

services:

  ghost:
    image: ghost:4-alpine
    restart: always
    ports:
      - 9577:2368
    environment:
      # see https://ghost.org/docs/config/#configuration-options
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: xxxxx
      database__connection__database: ghost
      # this url value is just an example, and is likely wrong for your environment!
      url: https://....com
      # contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
      #NODE_ENV: development

  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: xxxxx

Any idea what going on?

Thanks,
William

1 Like

Hi,

Exact same setup here and exact same error. Did you by any chance resolved this ?

Both containers on the same network but seems that ghost is not able to contact mysql. I’m trying to solve this for weeks now…

1 Like

I ended up with the same issue as well. Have absolutely no idea why it is not working. I even stopped maria dB which was running on my synology DS1821+. I stopped the webstation too just in case. I actually tried the same yaml file on my windows desktop and it works like a charm. Probably this is one of those synology issues. One of the planets worst developers… Let me know if anyone finds why it is not working.