Skip to content

Instantly share code, notes, and snippets.

@arsalanses
Last active May 7, 2024 04:07
Show Gist options
  • Select an option

  • Save arsalanses/f275fe5b2eccf27368b60b4b03569b5a to your computer and use it in GitHub Desktop.

Select an option

Save arsalanses/f275fe5b2eccf27368b60b4b03569b5a to your computer and use it in GitHub Desktop.
goaccess + nginx container to serve report
services:
nginx:
image: nginx:alpine
volumes:
- /opt/goaccess/report.html:/usr/share/nginx/html/index.html:ro
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.docker.network=web"
- "traefik.http.routers.report.entrypoints=https"
- "traefik.http.routers.report.rule=Host(`report.example.com`)"
- "traefik.http.services.report.loadbalancer.server.port=80"
- "traefik.http.routers.report.tls=true"
- "traefik.http.routers.report.tls.certresolver=lets-encrypt"
- "traefik.http.routers.report.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=admin:password"
networks:
web:
external: true
cat /var/log/traefik/access.log | docker run --rm -i -e LANG=$LANG allinurl/goaccess -a -o html --log-format COMBINED - > /opt/goaccess/report.html
# wc -l /var/log/traefik/access.log
echo "" > /var/log/traefik/access.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment