← Back to Guides
Profile image for Adam Charvat

By Adam Charvat

Published 24th January 2022

Deploying Ghost CMS

Ghost is an open-source publishing platform built with Node.js designed to make blogging simple. Ghost also provides a flexible frontend ready to use for your blog.

ghostui.png

In this guide, you will learn how to deploy Ghost using the official Docker image and MySQL on Northflank.

  1. Create a new MySQL database in a new project on Northflank. For increased security, we recommend keeping SSL enabled and External Access disabled. You can start with the smallest compute plan with 4 GB of storage and one replica.

  2. Create a new deployment service deploying from an external image. Set the image path to ghost:latest. Port 2368 will be automatically detected and exposed. Once created, copy the service URL or optionally link a custom domain.

  3. Create a new secret group which will store the environment variables. We will manually add key value secrets and link the MySQL database we created earlier.

    1. Manual Secrets

      KeyValue
      urlThe unique service code.run deployment URL or a linked custom domain (prefixed with https://)
      database__clientmysql

      ghost-secret-group.png

    2. Inherited connection details from the database

      Variable nameAlias
      hostdatabase__connection__host
      tlsEnableddatabase__connection__ssl
      usernamedatabase__connection__user
      passworddatabase__connection__password
      databasedatabase__connection__database

      ghost-inherited.png

      • Inheriting environment variables ensures that the database connection details are automatically injected in the environment, avoiding the need to manually copy and paste them.

  4. Go back to your service and rollout a restart. A new container will initiate the database and set everything up. Once finished, you can open the service URL followed by /ghost to create your first administrator.

  5. Optionally, navigate to Volumes and add new volume to persist your media uploads across container restarts. Choose the name, storage and set container mount path to /var/lib/ghost/content. Saving the volume will rollout a restart and your Ghost deployment will be ready when the container boots up.

    • Volume storage cannot be scaled down once created. Start with the lowest one you need for your media uploads.

Using Northflank to deploy Ghost with MySQL

Northflank allows you to deploy your code and databases within minutes. Sign up for a Northflank account and create a free project to get started.

  • Multiple read and write replicas
  • Observe & monitor with real-time metrics & logs
  • Low latency and high performance
  • Backup, restore and fork databases
  • Private and optional public load balancing as well as Northflank local proxy

Share this article with your network