Ghost is a powerful and modern content management system (CMS) designed for professional publishing. With Synology and Docker Compose, you can easily deploy Ghost on your NAS for a scalable and efficient blogging platform. This guide walks you through the steps to implement Ghost with the provided docker-compose.yml
file.
Prerequisites
- Synology NAS with Docker installed.
- SSH access to your Synology NAS (optional but recommended).
- Basic knowledge of Docker and Docker Compose.
- A text editor for modifying configuration files.
Step 1: Prepare Your Synology NAS
Before deploying Ghost, create the necessary directories on your Synology NAS for persistent data storage.
- Log in to Synology DSM.
- Open File Station and navigate to the directory where you want to store Docker data (e.g.,
/volume1/docker/
). - Create the following directory:
/volume1/docker/ghost
This directory will store Ghost’s content, including themes, images, and configuration.
Step 2: Install Docker Compose on Synology
- Open the Package Center on Synology DSM.
- Install the Docker package.
- Ensure Docker Compose is available. You can check this via SSH by running:
docker-compose --version
If Docker Compose is not installed, refer to the Synology documentation to set it up.
Step 3: Configure the docker-compose.yml
File
Below is the configuration for deploying Ghost. Save this file as docker-compose.yml
in a directory accessible from your Synology NAS (e.g., /volume1/docker/ghost/
).
services:
ghost:
image: ghost:latest
container_name: Ghost
network_mode: host # Uses the host's network
healthcheck:
test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/2368' || exit 1
interval: 10s
timeout: 5s
retries: 3
start_period: 90s
hostname: ghost
security_opt:
- no-new-privileges:true
user: 1026:100
environment:
TZ: Europe/Madrid
database__client: mysql
database__connection__host: $DB_HOST
database__connection__user: $DB_USER
database__connection__password: $DB_PASS
database__connection__database: $DB_NAME
url: https://kexpiral.com
mail__transport: SMTP
mail__options__service: SMTP
mail__from: $EMAIL
mail__options__host: smtp.gmail.com
mail__options__port: 587
mail__options__auth__user: $USER_EMAIL
mail__options__auth__pass: $PASS_EMAIL
NODE_ENV: production
volumes:
- /volume1/docker/ghost:/var/lib/ghost/content:rw
restart: on-failure:5
Step 4: Deploy the Ghost Container
- SSH into your Synology NAS or use the Synology Docker UI.
- Navigate to the directory where you saved the
docker-compose.yml
file. - Run the following command to start the container:
docker-compose up -d
- Docker Compose will pull the latest Ghost image, create the container, and start the CMS.
Step 5: Configure the Database
Ghost requires a MySQL database for operation. Ensure you have an existing MySQL instance or create one using a separate container. Update the following environment variables in the docker-compose.yml
file accordingly:
$DB_HOST
: Database host (e.g.,127.0.0.1
or the container name if using Docker).$DB_USER
: Database user.$DB_PASS
: Database password.$DB_NAME
: Database name.
After deploying, connect Ghost to your database during the initial setup process.
Step 6: Access Ghost
- Open a web browser and go to
http://<Synology-IP>:2368
. - Follow the on-screen instructions to set up your Ghost site.
- Log in to the Ghost admin panel at
http://<Synology-IP>:2368/ghost
to start managing your content.
Step 7: Email Configuration
To send emails from Ghost, ensure you configure the SMTP settings correctly in the docker-compose.yml
file:
mail__options__host
: SMTP server (e.g.,smtp.gmail.com
).mail__options__port
: SMTP port (e.g.,587
).mail__options__auth__user
: Your SMTP user email.mail__options__auth__pass
: Your SMTP user password.mail__from
: Sender’s email address.
Ghost will use these settings to send transactional emails like password resets and notifications.
Conclusion
By following these steps, you’ve successfully deployed Ghost on your Synology NAS using Docker Compose. This setup leverages Synology’s capabilities and Docker’s flexibility to deliver a robust publishing platform. Customize and scale your Ghost instance to suit your needs, and start creating amazing content on your self-hosted CMS!