Kaunta on Raspberry Pi

Kaunta is a fast, privacy‑first web analytics platform built in Go, engineered as a seamless drop‑in replacement for Umami. Designed with simplicity and efficiency at its core, it delivers powerful insights while maintaining a minimal footprint — combining speed, security, and ease of use without compromising data protection.

Features

🚀 Docker Installation Steps

  1. Update your system
    sudo apt update && sudo apt upgrade -y
  2. Install Docker
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
  3. Install Docker Compose
    sudo apt install docker-compose-plugin
  4. Add your user to the Docker group
    sudo usermod -aG docker $USER
  5. Enable Docker at boot
    sudo systemctl enable docker
  6. Reboot
    sudo reboot
  7. Test Docker
    docker run hello-world

📁 Setup Kaunta

 mkdir ~/docker/kaunta

🧾 Docker Compose File

In ~/docker/kaunta create docker-compose.yml

services:
  db:
    image: postgres:18-alpine
    container_name: kaunta-db
    hostname: kaunta-db
    security_opt:
      - no-new-privileges:false
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "kaunta", "-U", "jrmckins"]
      timeout: 45s
      interval: 10s
      retries: 10
    environment:
      POSTGRES_DB: kaunta
      POSTGRES_USER: jrmckins
      POSTGRES_PASSWORD: Mcjim011
    volumes:
     - ./kauntadb:/var/lib/postgresql/data
    restart: on-failure:5

  kaunta:
    image: kaunta:pi
    container_name: kaunta
    healthcheck:
      test: ["CMD-SHELL", "nc -z 127.0.0.1 3106 || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
    environment:
      PORT: 3106
    volumes:
      - data:/data
    ports:
      - "3106:3106"
    depends_on:
      db:
        condition: service_healthy
    restart: on-failure:5
volumes:
  kauntadb:
  data: 

Build Kaunta

Since Kaunta doesn't officially support Pi, we have to build it.

From within ~/docker/kaunta run this to download a copy of kaunta:

git clone https://github.com/kaunta/kaunta.git

Now, from within ~/docker/kaunta/kaunta run this to build a local copy of kaunta:

docker build -t kaunta:pi .

▶️ Start Kaunta

From within ~/docker/kaunta run:

docker compose up -d

📜 View Logs

View logs for kaunta

docker logs kaunta

View logs for kaunta-db

docker logs kaunta-db

Setup the database

Browse to <YOUR_PI>:3106/setup

Fill in:

Host with kaunta-db
Database Name with kaunta
Username with YOUR USERNAME
Password with YOUR PASSWORD

Click on Test Database Connection

Now create the administrator acount by filling in Username, Password, and Confirm Password

Click Complete Setup

Verify your user account

You can check that your user account was created by running:

docker exec -it kaunta kaunta user list

Add a website

Run this to add the website that you want to gather analytics from

docker exec -it kaunta kaunta website create your_website.com

This will return your Website ID, also called Tracking Code ID

You can also run this to get your WEBSITE ID

docker exec -it kaunta kaunta website list

You can also add a website using the GUI by browsing to YOUR_PI:3106/dashboard/websites and clicking on Add Website.

You will need the WEBSITE ID to use in your tracker snippet.

Add the tracker snippet to HTML

This is the snippet that you'll need to add after <head> in all your html files for your website.

<!-- Kaunta tracking script -->
<script async defer
  data-website-id="WEBSITE ID"
  src="https://kaunta.your_website.com/k.js">
</script>

The easiest way to do this is to cd to the main directory for your website and run this

cd /home/your_id/your_website
find . -name "*.html" -exec sed -i '' '/<head>/a\
<!-- Kaunta tracking script -->\
<script async defer\
  data-website-id="WEBSITE ID"\
  src="https://kaunta.your_website.com/k.js">\
</script>' {} +

This finds all your html files in /home/your_id/your_website and inserts the snippet after the <head> tag in each one.

🌐 Access Web Interface

Open your browser and go to YOUR_PI:3106/dashboard

It may default to Kaunta Dashboard. Click on the down arrow next to Kaunta Dashboard and select your website.

If you find my content useful, please consider supporting this page:

☕ Buy Me a Coffee