From b17068efec1928b8672222cc8e002a27c9042864 Mon Sep 17 00:00:00 2001 From: michivonah Date: Sat, 20 Dec 2025 12:52:52 +0100 Subject: [PATCH] add umami (docker + podman) --- umami/docker-compose-traefik.yml | 40 +++++++++++++++++++++++++++ umami/example.env | 4 +++ umami/podman.sh | 46 ++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 umami/docker-compose-traefik.yml create mode 100644 umami/example.env create mode 100644 umami/podman.sh diff --git a/umami/docker-compose-traefik.yml b/umami/docker-compose-traefik.yml new file mode 100644 index 0000000..5a218a0 --- /dev/null +++ b/umami/docker-compose-traefik.yml @@ -0,0 +1,40 @@ +services: + umami: + image: ghcr.io/umami-software/umami:latest + #ports: + # - "3000:3000" + environment: + DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB} + DATABASE_TYPE: postgresql + APP_SECRET: ${APP_SECRET} + depends_on: + - db + restart: unless-stopped + labels: + - "traefik.enable=true" + - "traefik.http.routers.umami.entrypoints=web, websecure" + - "traefik.http.routers.umami.rule=Host(`analytics.example.com`)" + - "traefik.http.routers.umami.tls=true" + - "traefik.http.routers.umami.tls.certresolver=production" + - "traefik.docker.network=traefik_default" + networks: + - traefik + - umami + + db: + image: postgres:15-alpine + environment: + POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + volumes: + - ./db:/var/lib/postgresql/data + restart: unless-stopped + networks: + - umami + +networks: + umami: + traefik: + name: traefik_default + external: true \ No newline at end of file diff --git a/umami/example.env b/umami/example.env new file mode 100644 index 0000000..a1988c1 --- /dev/null +++ b/umami/example.env @@ -0,0 +1,4 @@ +APP_SECRET=random-secret +POSTGRES_DB=umami +POSTGRES_USER=umami +POSTGRES_PASSWORD=random-password \ No newline at end of file diff --git a/umami/podman.sh b/umami/podman.sh new file mode 100644 index 0000000..b88e321 --- /dev/null +++ b/umami/podman.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Umami (Podman script) +# Michi von Ah +# Link: https://github.com/michivonah/docker/tree/main/umami +# Script depends on existing caddy proxy with network caddy + +# Make script executable: chmod +x podman.sh + +# Environment variables +set -a +source .env +set +a + +# Pod setup +podman network create umami --ignore +podman pod create --name umami --replace + +# Create directories & files +mkdir -p db + +# Containers +podman run --name umami-app \ + --replace \ + --pod umami \ + -d \ + --restart always \ + --net umami \ + --net caddy \ + -e DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@umami-db:5432/${POSTGRES_DB} \ + -e DATABASE_TYPE=postgresql \ + -e APP_SECRET=${APP_SECRET} \ + -u ${UID:-1000}:${GID:-1000} \ + ghcr.io/umami-software/umami:latest + +podman run --name umami-db \ + --replace \ + --pod umami \ + -d \ + --restart always \ + --net umami \ + -e POSTGRES_DB=${POSTGRES_DB} \ + -e POSTGRES_USER=${POSTGRES_USER} \ + -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} \ + -v ./db:/var/lib/postgresql/data:z,U \ + -u ${UID:-1000}:${GID:-1000} \ + docker.io/postgres:15-alpine