Australia/Melbourne
Posts

Self Hosted Comment Solution

April 24, 2025
Commento screenshot
Commento is a fast, bloat-free commenting system written in Go, that you can host on your own server. It embeds directly into your pages, loads fast, and is fully customizable.
Commento is a fully open-source software that you can host yourself. You can run Commento on your own server and have complete control over your data. Commento is also available as a managed hosting service, with a generous free tier. I chose Commento because it is simple to use and self-hosted. It’s also easy to integrate with my static site generator, Hugo. Additionally, it’s open-source and free — meaning I can host it myself and retain full control of my data.
config.toml
Toml
[params.commento]
  site_id = "<your-site-id>"
comments.html
Html
{{ if .Site.Params.commento.site_id }}
  <div id="commento"></div>
  <script defer src="https://cdn.commento.io/js/commento.js"></script>
{{ end }}
docker-compose.yml
Yaml
version: '3'

services:
  server:
    image: registry.gitlab.com/commento/commento
    environment:
      COMMENTO_ORIGIN: https://commento.hamish-fleming.com
      COMMENTO_PORT: 8080
      COMMENTO_POSTGRES: postgres://postgres:postgres@db:5432/commento?sslmode=disable
    labels:
      - traefik.enable=true
      - traefik.docker.network=traf-external
      - traefik.http.routers.commento.entrypoints=web
      - traefik.http.routers.commento.rule=Host(`commento.hamish-fleming.com`)
      - traefik.http.routers.commento.middlewares=middlewares-https-redirect@file
      - traefik.http.routers.commento-secure.entrypoints=websecure
      - traefik.http.routers.commento-secure.rule=Host(`commento.hamish-fleming.com`)
      - traefik.http.services.commento-secure.loadbalancer.server.port=8080
      - traefik.http.routers.commento-secure.tls.certresolver=myresolver
      - traefik.http.routers.commento-secure.tls=true
    depends_on:
      - db
    networks:
      - frontend
      - db_network
  db:
    image: postgres:13.4
    environment:
      POSTGRES_DB: commento
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    networks:
      - db_network
    volumes:
      - postgres_data_volume:/var/lib/postgresql/data

networks:
  db_network:
  frontend:
    external:
      name: traf-external

volumes:
  postgres_data_volume:
On this page