At Inoryum, we empower clients with stunning, high-performing Ghost blogs. But managing numerous Ghost installations, each tailored to unique client needs or showcasing our Visioun themes presents a challenge.
Our solution? A streamlined Docker-based infrastructure that maximizes efficiency and minimizes overhead. In this case study, we'll walk you through our setup, the scripts we've developed, and the benefits we've gained.
Why Docker for Ghost?
Docker is a game-changer for managing multiple Ghost instances:
- Client Isolation: Each client's Ghost instance (or Visioun theme demo) operates in its isolated container, ensuring resources aren't shared and performance remains consistent across all sites.
- Rapid Deployment: Docker containers are incredibly portable, allowing us to quickly spin up new Ghost installations for clients or create demo environments for Visioun themes.
- Effortless Scaling: As our client base or demo needs grow, Docker makes it simple to scale our resources to maintain optimal performance.
- Consistent Environments: Docker ensures that every Ghost instance, whether for a client or a demo, runs in an identical environment, reducing the risk of unexpected bugs or inconsistencies.
Our Dockerized Ghost Architecture
- MySQL Database Container: A dedicated container running MySQL serves as the centralized data repository for all Ghost instances.
- Ghost Instance Containers: Each client site or Visioun theme demo resides in its container, linked to the shared database.
Docker Compose: The Orchestration Engine
Our infrastructure is managed with Docker Compose. We utilize two Compose files:
Database Compose File:
version: '3.5'
services:
db:
container_name: [container_name]
image: mysql:latest
command: --mysql-native-password=ON
restart: always
environment:
MYSQL_ROOT_PASSWORD: [your_secure_password]
volumes:
- ./data:/var/lib/mysql
networks:
- network-name
networks:
network-name:
driver: bridge
This file sets up our MySQL database container, storing data persistently for all Ghost instances. It also defines a custom network for communication between the database and Ghost containers.
Ghost Instance Compose File:
version: '3.5'
networks:
default:
external:
name: folder_network-name
services:
ghost:
container_name: [container_name]
image: ghost:latest
restart: always
ports:
- 8301:2368
volumes:
- ./content:/var/lib/ghost/content
environment:
url: https://yourdomain.com
database__client: mysql
database__connection__host: [database_container_name]
database__connection__user: [user]
database__connection__password: [your_secure_password]
database__connection__database: [database_name]
mail__transport: SMTP
mail__from: "Example <[email protected]>"
mail__options__host: "smtp.provider-name.net"
mail__options__port: [port]
mail__options__auth__user: "[SMTP_user_name]"
mail__options__auth__pass: "[SMTP_password]"
Each Ghost instance has its file like this, linking to the database and setting up site-specific configurations. Replace placeholders with your actual values.
Custom Scripts: Streamlining Updates
Updating multiple Ghost instances could be a tedious task. To tackle this, we developed a bash script that automates the process:
#!/bin/bash
cd /path/to/your/ghost/projects
containers=$(ls -d */ | grep -v 'database/')
for container in $containers; do
cd "$container"
docker-compose pull
cd ..
done
docker-compose down # Stop all containers
docker-compose up -d # Start all containers
docker image prune -f
This script iterates through each Ghost instance directory, pulls the latest Docker image, and gracefully restarts the containers to apply the updates.
Prioritizing Security
Security is paramount. We employ environment variables to avoid exposing sensitive data like database passwords in our Compose files. We also adhere to Docker security best practices, such as:
- Least privilege principle for container access.
- Regular updates to both Docker and Ghost images.
- Continuous monitoring for vulnerabilities.
Benefits Realized
Our Docker-powered approach has delivered significant advantages:
- Reduced Server Costs: Containerization optimizes resource usage, allowing us to host more Ghost instances on the same hardware.
- Faster Onboarding: New client sites or Visioun theme demos can be deployed rapidly, often within minutes.
- Simplified Maintenance: Updates and troubleshooting are streamlined, thanks to our custom scripts and the isolated nature of containers.
- Enhanced Reliability: Containerization minimizes the risk of configuration conflicts, leading to more stable and reliable Ghost installations.
Conclusion
By embracing Docker, Inoryum has transformed the way we manage Ghost for our clients and showcase Visioun themes. We highly recommend exploring a Docker-based solution if you're looking for a scalable, efficient, and secure way to run multiple Ghost blogs.
We're always eager to discuss how we can help you achieve your Ghost blogging goals.