Ghost setup

Ghost setup

Some Notes on Fixing Ghost After Setup.

I use CapRover to host this blog and my other projects. I chose Ghost for this blog, and sourced the image from Caprover one-click-apps repo which uses Docker image from Bitnami.

After install almost all worked good, but there were two issues:

  1. Sometimes i received 500 error upon accessing the index page. I suspected that the problem might be related to database connection timeouts.
  2. I couldn't view logs in Docker stdout when accessing them via docker logs or DockLogKeeper.

After some online research, I found the following solution:

  1. Move to the volume, attached to your self-hosted Ghost instance (/var/lib/docker/volumes/captain--blog-data/).
  2. Cd _data
  3. Edit config.production.json, adding
"pool": {
    "min":0
}

to the database section of config

4. Add "stdout" option to the logging->transport section:

"logging": {
    "transports": [
      "file",
      "stdout"
    ]
  }

5. Restart your Ghost container.

Your config.production.json should now look like this:

{
  "database": {
    "client": "mysql",
    "connection": {
      "host": "srv-captain--blog-db",
      "port": 3306,
      "database": "ghost",
      "user": "ghost",
      "password": "your_password",
      "ssl": false
    },
    "pool": {
        "min":0
    }
  },
  "url": "https://example.com",
  "server": {
    "port": 2368,
    "host": "0.0.0.0"
  },
  "mail": {
    "transport": "SMTP",
    "from": "from@example.com",
    "options": {
      "host": "smtp.gmail.com",
      "port": 587,
      "secureConnection": false,
      "auth": {
        "user": "from@example.com",
        "pass": ""
      }
    }
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "local",
  "paths": {
    "contentPath": "/opt/bitnami/ghost/content"
  }
}

Ideally, these settings should work as environment variables in Bitnami containers, or perhaps be configurable via the admin panel in future versions. For now, though, we have to manually edit the config file.