Let’s Setup Umami Web Analytics - A responsible way to track where does the traffic goes on our website.

The Umami Project

Umami allow us to collect, analyze, and understand web data — while maintaining visitor privacy - No cookies needed!

SelfHosting Umami

Pre-Requisite: Get Docker Ready! 👇

Important step and quite recommended for any SelfHosting Project - Get Docker Installed

It will be one command, this one, if you are in Linux:

apt-get update && sudo apt-get upgrade && curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh && docker version

Umami Docker Compose

Deploy Umami with this Docker Compose 👇
---
version: '3'
services:
  umami:
    image: ghcr.io/umami-software/umami:postgresql-latest
    ports:
      - "3090:3000" #UI
    environment:
      DATABASE_URL: postgresql://umami:umami@db:5432/umami
      DATABASE_TYPE: postgresql
      HASH_SALT: replace-me-with-a-random-string
    depends_on:
      - db
    restart: always
  db:
    image: postgres:12-alpine
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: umami
    volumes:
      - /home/youruser/Docker/umami/sql/schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
      - /home/youruser/Docker/umamiumami-db-data:/var/lib/postgresql/data
    restart: unless-stopped   
# volumes:
#   umami-db-data:

Or with named volumes:

Deploying Umami with Docker & Cloudflare Tunnels

---
version: '3'
services:
  umami:
    image: ghcr.io/umami-software/umami:postgresql-latest
    ports:
      - "3090:3000"
    environment:
      DATABASE_URL: postgresql://umami:umami@db:5432/umami
      DATABASE_TYPE: postgresql
      HASH_SALT: replace-me-with-a-random-string
    depends_on:
      - db
    restart: always
    networks: ["nginx_nginx_network","cloudflare_tunnel"] 
  db:
    image: postgres:12-alpine
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: umami
    volumes:
      - /home/youruser/Docker/umami/sql/schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
      - /home/youruser/Docker/umamiumami-db-data:/var/lib/postgresql/data
    restart: unless-stopped
    networks: ["nginx_nginx_network"]     
volumes:
  umami-db-data:
   
networks:
    nginx_nginx_network:
        external: true     

##admin // umami
  • Default Initial Credentials are: admin/umami and you can access Umami at localhost:3090 if you followed step by step.

Successfully using Umami with Docker

Umami with Cloudflare Tunnels

How to use Umami

Once you add in Settings a Website, you will need to add this piece in the section of your web HTML.

<script async src="http://192.168.3.200:3090/script.js" data-website-id="some-randing-identifier-for-umami"></script>

You will see this UI:

Adding a Website to Umami

Umami Web Analytics with HUGO


FAQ

How to BackUp Umami

mkdir -p /home/Docker/umami/sql
mkdir -p /home/Docker/umamiumami-db-data

#origin-destination
sudo cp -r /mnt/portainer_backup/home/oldumami/Docker/umami/sql/* /home/Docker/umami/sql/
sudo cp -r /mnt/portainer_backup/home/oldumami/Docker/umamiumami-db-data/* /home/Docker/umamiumami-db-data/

And then use it with:

volumes:
  - /home/Docker/umami/sql/schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
  - /home/Docker/umamiumami-db-data:/var/lib/postgresql/data

How to Configure Expose Umami

Umami and Cloudflare Tunnel with Docker

Check this guide if you are interested to know how to safely deploy services through Cloudflare Zero Trust Tunnels.

Umami with Nginx Proxy Manager

If you are interested in using Umami with https, deploying NGINX with Docker will be a great option for you.