How To Easily Set Up Umami With Docker (Step-by-Step)

No Comments
Published: 21.08.2022

Do you want to set up Umami for your Website or Web Application with Docker? In this step-by-step guide, we will first look at what Umami is and then how to set it up!

What is Umami?

Umami is a simple and lightweight, open-source analytics software used as an alternative to Google Analytics. One reason why you should consider it over Google Analytics is that it does not track users across websites and is GDPR compliant, as stated on their website here. With that, you also do not need to display annoying cookie notices!

Server icon

VPS Hosting Course

Learn everything you need to know about servers and hosting your own applications!

In the following setup, I will show you how to self-host and set up umami with docker!

Docker setup for Umami

Setting up Umami with Docker is pretty simple. You need to create the following two containers:

Umami itself offers a pretty good docker-compose template (here), that I modified a little bit for my needs:

services:
    umami:
        container_name: umami
        image: ghcr.io/umami-software/umami:postgresql-latest
        ports:
            - "3000:3000"

        # use expose if you use my nginx setup (link in conclusion)
        # expose:
        #     - "3000"
        environment:
            DATABASE_URL: postgresql://umami:umami123@umami-db:5432/umami
            DATABASE_TYPE: postgresql
            HASH_SALT: <random-string>
        depends_on:
            - umami-db
        restart: always

    umami-db:
        container_name: umami-db
        image: postgres:12-alpine
        environment:
            POSTGRES_DB: umami
            POSTGRES_USER: umami
            POSTGRES_PASSWORD: umami123
        volumes:
            - ./umami/data:/var/lib/postgresql/data
        restart: always

After building all containers by running docker-compose up -d or docker compose up -d you can access umami under your machine’s IP with the port 3000. For example http://localhost:3000.

Need help or want to share feedback? Join my discord community!

Set up a Website for Tracking in Umami

In this section, we will add a new Website for tracking to our newly created Umami instance. For that we first need to log in with the data set in the umami container and then follow these steps:

  1. Click on “+ Add a website”
  2. Give it a name and add your domain
  3. Copy the snippet and add it to the HTML head of your website!
    Set Up Umami with Docker: Get the tracking code

Conclusion

Setting up Umami with Docker for your website is super simple and has a lot of benefits. In case you want to set it up with HTTPS check out my guide on an automated SSL and Reverse-Proxy setup here.

KOFI Logo

If this guide is helpful to you and you like what I do, please support me with a coffee!

How do you like Umami?

I hope this guide helped you in setting up Umami on your own and if you liked my content consider subscribing to my monthly newsletter.

Discussion (0)

Add Comment

Your email address will not be published. Required fields are marked *