December 17, 2017

Configuring a Google Cloud Ghost Deployment to Use Mailgun

Google Compute Engine does not allow outbound connections from instances on ports 25, 465, and 587. They say it is because too many people abused instances for sending spam. Judging by my inbox unread count, I'd say it's about time. ;)


These port blocks apply to instances running containers, such as those used to run this blog on Kubernetes (GKE). After hunting around a bit for a solution to enable Ghost to send mail, I figured out that port 2525 can be used for outbound SMTP connections for Mailgun, which are not blocked by Google.


Here's my resulting config.production.json file, which is being used on this site:

  "url": "",
  "server": {
    "port": 2368,
    "host": ""
  "database": {
    "client": "sqlite3",
    "connection": {
      "filename": "/var/lib/ghost/content/data/ghost.db"
  "logging": {
    "transports": [
  "process": "systemd",
  "paths": {
    "contentPath": "/var/lib/ghost/content"
  "mail": {
    "transport": "SMTP",
    "options": {
        "host": "",
        "port": 2525,
        "service": "Mailgun",
        "auth": {
          "user": "",
          "pass": "xxxxx"
  "admin": {
    "url": ""

Note the explicit use of a host entry and port number in the configuration file, given the need to call a different port.

More information about setting up and configuring Ghost, including configuring password secrets with GCP, will be available in the Installing Ghost on Kubernetes Guide soon!