Coffee-themed blog post with Ghost blogging platform emblem on laptop screen.

Deploying Ghost Blogging platform

Blog Setup Dec 8, 2023

Ghost, a modern and minimalist blogging platform, combined with the versatility of Docker, offers an efficient way to launch your blog. In this guide, we'll walk through deploying Ghost using the provided Docker Compose configuration. This setup ensures seamless integration with a MySQL database, providing a robust foundation for your blogging endeavors.

Prerequisites:

Before we dive into deployment, ensure you have the following in place:

  1. Docker installed on your host machine.
  2. Reverse proxy

Docker Compose Configuration:

Below is the Docker Compose configuration tailored for deploying Ghost with MySQL. Adjust the environment variables to suit your preferences and ensure secure deployment.

version: '3'

services:
  ghost:
    image: ghost:latest
    restart: always
    ports:
      - "2368:2368"
    depends_on:
      - db
    environment:
      url: https://www.brewingbytesandbeans.com
      mail__transport: SMTP
      mail__options__host: $EMAIL_USER
      mail__options__port: 587
      mail__options__auth__user: $EMAIL_USER
      mail__options__auth__pass: $EMAIL_PASS
      NODE_ENV: production
      mail__from: [email protected]
      database__client: mysql
      database__connection__host: db
      database__connection__user: ghost
      database__connection__password: $MYSQL_USERPW 
      database__connection__database: ghostdb
    volumes:
      - /ghost/content:/var/lib/ghost/content

  db:
    image: mysql:8.0
    ports:
      - 3306:3306
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: $RANDOM_MYSQL_PW
      MYSQL_USER: ghost
      MYSQL_PASSWORD: $MYSQL_USERPW 
      MYSQL_DATABASE: ghostdb
    volumes:
      - /ghost/mysql:/var/lib/mysql

Deployment Steps in Portainer:

  1. Access Portainer:
    Open your web browser and navigate to your Portainer instance.
  2. Create a New Stack:
    • In the Portainer dashboard, go to "Stacks" in the left-hand menu.
    • Click on "Add Stack."
  3. Paste Configuration:
    • Give your stack a name.
    • Paste the above stack configuration into the "Compose YAML" field.
    • Fill in the variables with your information
  4. Deploy Stack:
    • Click on "Deploy the stack."
  5. Access Ghost in Portainer:
    • Once the stack is deployed, go to "Containers" in the left-hand menu.
    • Find the Ghost container and click on its name.
    • Under "Container details," you'll find the link to your Ghost blog.
  6. Configure Ghost:
    • X.X.X.X:2368 will bring you to the main page of your new blog.
    • X.X.X.X:2368/ghost is your admin page!

Conclusion:

Congratulations! You've successfully deployed Ghost as a stack in Portainer, leveraging the simplicity and visual interface of Portainer to manage your containers. Explore Ghost's features, customize your blog, and enjoy the benefits of this streamlined deployment. Happy blogging!

A close-up image of a steaming cup of coffee surrounded by aromatic coffee beans.

Indulge your coffee cravings and stay on top of our latest brews! Sign up for our coffee-themed blog alerts, and savor the excitement of new content right as it's brewed to perfection. Don't miss a sip—be the first to relish the rich flavor of our enticing releases!

Tags