Skip to content

Instantly share code, notes, and snippets.

@jayanath
Created May 20, 2021 11:50
Show Gist options
  • Save jayanath/43125dd558122c50e1bb4afcc27fa09c to your computer and use it in GitHub Desktop.
Save jayanath/43125dd558122c50e1bb4afcc27fa09c to your computer and use it in GitHub Desktop.
docker-compose for Ghost
version: "3"
networks:
external_network:
internal_network:
internal: true
services:
traefik:
image: traefik
restart: always
command:
- "--log.level=ERROR"
- "--api.dashboard=true"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
- "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.letsencrypt.acme.email={MY-EMAIL-GOES-HERE}"
- "--certificatesresolvers.letsencrypt.acme.storage=acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /data/traefik/acme.json:/acme.json
labels:
- traefik.enable=true
# HTTPS Redirect
- traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
- traefik.http.routers.http-catchall.entrypoints=web
- traefik.http.routers.http-catchall.middlewares=redirect-to-https@docker
- traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
networks:
- external_network
ghost:
image: ghost:4
restart: always
env_file:
- /data/traefik/ghost.env
volumes:
- /data/blogdir:/var/lib/ghost/content
labels:
- traefik.enable=true
- traefik.http.routers.ghost.rule=Host(`mydomain.com`)
- traefik.http.routers.ghost.entrypoints=websecure
- traefik.http.routers.ghost.tls.certresolver=letsencrypt
- traefik.http.services.ghost.loadbalancer.server.port=2368
networks:
- external_network
commento:
image: registry.gitlab.com/commento/commento
restart: always
env_file:
- /data/traefik/commento.env
depends_on:
- db
labels:
- traefik.enable=true
- traefik.http.routers.commento.rule=Host(`commento.mydomain.com`)
- traefik.http.routers.commento.entrypoints=websecure
- traefik.http.routers.commento.tls.certresolver=letsencrypt
networks:
- external_network
- internal_network
db:
image: postgres
restart: always
environment:
POSTGRES_DB: commento
POSTGRES_USER: MY-USER
POSTGRES_PASSWORD: MY-PASSWORD
networks:
- internal_network
volumes:
- /data/commento/data:/var/lib/postgresql/data
labels:
- traefik.enable=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment