Setting up MKDocs (Docker)
Known issues
| Issue Description | Fix If Known | Link Relevant Information | Fixed? ✅❌ |
|---|---|---|---|
| Site doesn't reload on config change | Use the "--livereload" flag. | mkdocs-material #8478 | ❌ |
| Site is being scanned by bots. This causes unwanted logs and traffic | TBC | n/a | ❌ |
General Information
Site Usage
This site will act as the Hedgenet Home page as well as a Blog both Internal and External.
Deployment
For this deployment we will be using the image squidfunk/mkdocs-material:latest, it will be deployed on Docker via Portainer using docker-compose.
The files for this site will be kept on a NFS share on the host that points to a NAS. As a result of this the container will need a GUID & PUID for user that accesses the files on the NAS.
The application will be behind a Traefik reverse proxy, this helps to keep the static site more secure.
docker-compose.yml File
services:
mkdocs:
image: squidfunk/mkdocs-material:latest
container_name: mkdocs
command: serve -a 0.0.0.0:{internal port} --livereload
working_dir: /docs
user: "{GUID}:{PUID}"
volumes:
- {Local file directory}:/docs
networks:
- proxy
restart: unless-stopped
labels:
- "traefik.enable=true"
# Public docs (no auth, but still TLS)
- "traefik.http.routers.mkdocs-public.rule=Host(`{domain)"
- "traefik.http.routers.mkdocs-public.entrypoints=websecure"
- "traefik.http.routers.mkdocs-public.tls.certresolver=le"
- "traefik.http.routers.mkdocs-public.priority=10"
- "traefik.http.routers.mkdocs-public.service=mkdocs-svc"
# Private subpath, e.g. /internal
- "traefik.http.routers.mkdocs-private.rule=Host(`{domain}`) && PathPrefix(`/internal`)"
- "traefik.http.routers.mkdocs-private.entrypoints=websecure"
- "traefik.http.routers.mkdocs-private.tls.certresolver=le"
- "traefik.http.routers.mkdocs-private.priority=20"
- "traefik.http.routers.mkdocs-private.service=mkdocs-svc"
- "traefik.http.routers.mkdocs-private.middlewares=authentik@file"
# Shared backend service
- "traefik.http.services.mkdocs-svc.loadbalancer.server.port={internal port}"
networks:
proxy:
external: true
YAML breakdown
Base Image
| Docker | |
|---|---|
Line 1
This is the name if the container.
Line 2
This is the link to the image that is being used. As this has no further information we can see that its coming from dockerhub, the default container image location for docker. Images can be found at DockerHub
