Umami is a simple, fast, open-source website analytics alternative to Google Analytics. It makes it easy to collect, analyze, and understand your web data — while maintaining visitor privacy and data ownership.

Docker compose

Here is the docker compose file generated by Crane It.

version: "3.8"
volumes:
  umami-db-data: {}
services:
  umami: &umami
    container_name: umami
    image: ghcr.io/umami-software/umami:postgresql-latest
    environment:
      - DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/umami
    
    depends_on:
      postgres:
        condition: service_healthy
    
    healthcheck:
      test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"]
      interval: 5s
      timeout: 5s
      retries: 5
    expose:
      - "3000"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.umami.rule=Host(`$CRANE_IT_EB_DOMAIN`)"
      - "traefik.http.routers.umami.entrypoints=websecure"
      - "traefik.http.routers.umami.tls.certresolver=myresolver"
      - "traefik.http.services.umami.loadbalancer.server.port=3000"
    ports: []

  postgres: &postgres
    container_name: postgres
    image: postgres:15-alpine
    environment:
      - POSTGRES_DB=umami
      - POSTGRES_PASSWORD=$POSTGRES_PASSWORD
      - POSTGRES_USER=$POSTGRES_USER
    volumes:
      - umami-db-data:/var/lib/postgresql/data
    restart: always
    
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 5s
      retries: 5
    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.