Ghost is a powerful app for professional publishers to create, share, and grow a business around their content. It comes with modern tools to build a website, publish content, send newsletters & offer paid subscriptions to members.
This template add the ability to connect your ghost project to Mailgun, in order to use it as a newsletter, on top of a blog.
Docker compose
Here is the docker compose file generated by Crane It.
version: "3.8"
volumes:
ghost-data: {}
ghost-db: {}
services:
ghost: &ghost
container_name: ghost
image: ghost:5
environment:
- database__client=mysql
- database__connection__database=ghost
- database__connection__host=db
- database__connection__password=${MYSQL_PASSWORD}
- database__connection__user=ghost
- mail__from=${MAIL_USER}
- mail__options__auth__pass=${MAIL_PASSWORD}
- mail__options__auth__user=${MAIL_USER}
- mail__options__host=${MAIL_HOST}
- mail__options__port=${MAIL_PORT}
- mail__options__secureConnection=${MAIL_SECURE_CONNECTION}
- mail__transport=${MAIL_TRANSPORT}
- url=https://${CRANE_IT_EB_DOMAIN}
volumes:
- ghost-data:/var/lib/ghost/content
restart: always
links:
- db
expose:
- "2368"
labels:
- "traefik.enable=true"
- "traefik.http.routers.ghost.rule=Host(`$CRANE_IT_EB_DOMAIN`)"
- "traefik.http.routers.ghost.entrypoints=websecure"
- "traefik.http.routers.ghost.tls.certresolver=myresolver"
- "traefik.http.services.ghost.loadbalancer.server.port=2368"
ports: []
db: &db
container_name: db
image: mysql:8.0
environment:
- MYSQL_DATABASE=ghost
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_USER=ghost
volumes:
- ghost-db:/var/lib/mysql
restart: always
ports: []
traefik:
image: "traefik:v2.9.5"
container_name: traefik
command:
- "--log.level=INFO"
- "--api.insecure=false"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=craneit.contact@gmail.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
The docker compose file is quite simple if you ignore traefik and its related labels. Traefik allow us to use HTTPS.
WARNING: Note that is you connect this project to a custom domain, you’ll have the modify the “url” environment variable, to make it match the name of the custom domain. By default, it’s value is https://${CRANE_IT_EB_DOMAIN}
, (the elastic beanstalk domain).
Useful links