
Umami is an open-source, privacy-focused web analytics platform designed as a self-hosted alternative to Google Analytics. It avoids cookies and personally identifiable information (PII), removes the need for cookie banners, and captures real-time metrics including visitor devices, geographic data, referrers, and custom events through a lightweight tracking script.
This article explains how to deploy Umami on a Linux server using Docker Compose with PostgreSQL as the database, Redis for session caching, and Traefik for automatic HTTPS through Let's Encrypt. It covers directory setup, environment configuration, accessing the dashboard, and integrating the tracking script into a sample website.
Before you begin, you need to:
umami.example.com).Umami requires a project directory with persistent storage for the PostgreSQL database, Redis cache, and Let's Encrypt certificates. Environment variables control the domain, database credentials, application secret, and tracking customizations.
Create the project directory.
pgdata/: Persists PostgreSQL database files.redis/: Stores Redis data for caching and session management.letsencrypt/: Stores Traefik ACME certificates for HTTPS renewal.Navigate to the project directory.
Generate a strong random secret for the application.
Save the output for use in the environment file.
Create the environment file.
Add the following configuration. Replace umami.example.com with your domain name, admin@example.com with your email address, GENERATED_SECRET with the generated random string, and STRONG_DATABASE_PASSWORD with a secure database password.
Save and close the file.
The TRACKER_SCRIPT_NAME and COLLECT_API_ENDPOINT variables add an alternate path for the tracking script and collection endpoint, alongside the defaults, to help bypass ad blockers that specifically target /script.js. The default paths remain active. The DISABLE_TELEMETRY=1 setting prevents Umami from sending anonymous usage statistics.
The deployment stack runs four services: Traefik as the reverse proxy with automatic TLS, PostgreSQL for analytics data persistence, Redis for session caching, and the Umami web application. This configuration is based on the official Umami Docker Compose example, adapted to use Traefik and persistent storage.
Create the Docker Compose manifest.
Add the following configuration.
Save and close the file.
In the above manifest:
3.1.0 and registers with Traefik for HTTPS routing on the configured domain.Start the services.
Verify that all containers are running.
The output displays four containers. postgres and redis show a healthy status; traefik and umami show as running, since those two have no configured health check.
View the service logs to confirm Umami connected to the database.
The output displays Umami completing database migrations and reporting the application as ready.
For more information on managing a Docker Compose stack, see the How to Use Docker Compose article.
After deployment, access the Umami dashboard using your configured domain, log in with the default administrator credentials, and rotate the password to secure the instance.
Replace umami.example.com with your configured domain and open https://umami.example.com/login in a web browser.
Log in using the default administrator credentials. The username is admin and the password is umami.
Change the default credentials immediately after the first login to secure your analytics instance.
At the bottom of the left sidebar, click admin and select Settings.
Navigate to the Profile tab and click Change password.
Enter the current password (umami), enter your new secure password, and click Save.
Umami tracks visitors through a lightweight JavaScript snippet embedded in your target website. The following steps add a website, retrieve the tracking code, embed it in a sample page, and verify that metrics appear in the dashboard.
Umami tracks each site separately, so a website entry must exist before its tracking code can be generated.
In the Umami dashboard, click Websites in the left navigation pane.
Click Add website.
Enter a name such as My Test Site and a domain such as test.example.com.
Click Save.
Each website gets a unique tracking snippet tied to its website ID.
Find the new website in the list and click Edit.
Navigate to the Tracking code tab.
Copy the generated <script> tag.
Because TRACKER_SCRIPT_NAME=custom-stats was set in the environment file, the generated tag uses /custom-stats as an additional path alongside the default /script.js. Using the custom path helps bypass ad blockers that specifically target the default filename.
The script must load on every page you want Umami to track.
Open the main HTML document or the global layout component of your sample web application.
Paste the tracking code into the <head> section. Replace YOUR_WEBSITE_ID with the ID from your Umami dashboard and umami.example.com with your domain.
Save the file and open the sample web application in a browser.
Refresh the page a few times to simulate visitor traffic.
Confirming that traffic appears in the dashboard validates that the tracking script is reaching the server.
Return to the Umami dashboard and select your website.
Review the main dashboard to verify captured page views, referrers, device types, and visitor data.
Click the Realtime tab to monitor active visitors navigating the sample site.
You have deployed Umami on a Linux server using Docker Compose with PostgreSQL for analytics storage, Redis for session caching, and Traefik for automatic HTTPS through Let's Encrypt. The deployment provides a privacy-first, self-hosted web analytics platform accessible over a custom domain with persistent storage and ad-blocker-resistant tracking. For more information on advanced configurations and integrations, refer to the official Umami documentation.
0 Comments
Be the first to comment and share your perspective with the community.