aboutsummaryrefslogtreecommitdiff
path: root/podman
diff options
context:
space:
mode:
Diffstat (limited to 'podman')
-rw-r--r--podman/README.md50
-rw-r--r--podman/env.sample16
-rwxr-xr-xpodman/install-systemd-user-service10
-rw-r--r--podman/podman-compose.yml41
-rw-r--r--podman/umami.service14
5 files changed, 131 insertions, 0 deletions
diff --git a/podman/README.md b/podman/README.md
new file mode 100644
index 0000000..92d030a
--- /dev/null
+++ b/podman/README.md
@@ -0,0 +1,50 @@
+# How to deploy umami on podman
+
+
+## How to use
+
+1. Rename `env.sample` to `.env`
+2. Edit `.env` file. At the minimum set the passwords.
+3. Start umami by running `podman-compose up -d`.
+
+If you need to stop umami, you can do so by running `podman-compose down`.
+
+
+### Install systemd service (optional)
+
+If you want to install a systemd service to run umami, you can use the provided
+systemd service.
+
+Edit `umami.service` and change these two variables:
+
+
+ WorkingDirectory=/opt/apps/umami
+ EnvironmentFile=/opt/apps/umami/.env
+
+`WorkingDirectory` should be changed to the path in which `podman-compose.yml`
+is located.
+
+`EnvironmentFile` should be changed to the path in which your `.env`file is
+located.
+
+You can run the script `install-systemd-user-service` to install the systemd
+service under the current user.
+
+
+ ./install-systemd-user-service
+
+Note: this script will enable the service and also start it. So it will assume
+that umami is not currently running. If you started it previously, bring it
+down using:
+
+ podman-compose down
+
+
+
+## Compatibility
+
+These files should be compatible with podman 4.3+.
+
+I have tested this on Debian GNU/Linux 12 (bookworm) and with the podman that
+is distributed with the official Debian stable mirrors (podman
+v4.3.1+ds1-8+deb12u1, podman-compose v1.0.3-3).
diff --git a/podman/env.sample b/podman/env.sample
new file mode 100644
index 0000000..06435e5
--- /dev/null
+++ b/podman/env.sample
@@ -0,0 +1,16 @@
+# Rename this file to .env and modify the values
+#
+# Connection string for Umami’s database.
+# If you use the bundled DB container, "db" is the hostname.
+DATABASE_URL=postgresql://umami:replace-me-with-a-random-string@db:5432/umami
+
+# Database type (e.g. postgresql)
+DATABASE_TYPE=postgresql
+
+# A secret string used by Umami (replace with a strong random string)
+APP_SECRET=replace-me-with-a-random-string
+
+# Postgres container defaults.
+POSTGRES_DB=umami
+POSTGRES_USER=umami
+POSTGRES_PASSWORD=replace-me-with-a-random-string
diff --git a/podman/install-systemd-user-service b/podman/install-systemd-user-service
new file mode 100755
index 0000000..948a04c
--- /dev/null
+++ b/podman/install-systemd-user-service
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -e
+service_name="umami"
+mkdir -p ~/.config/systemd/user
+cp $service_name.service ~/.config/systemd/user
+
+
+systemctl --user daemon-reload
+systemctl --user enable $service_name.service
+systemctl --user start $service_name.service
diff --git a/podman/podman-compose.yml b/podman/podman-compose.yml
new file mode 100644
index 0000000..fcd4b3a
--- /dev/null
+++ b/podman/podman-compose.yml
@@ -0,0 +1,41 @@
+version: "3.8"
+
+services:
+ umami:
+ container_name: umami
+ image: ghcr.io/umami-software/umami:postgresql-latest
+ ports:
+ - "127.0.0.1:3000:3000"
+ environment:
+ DATABASE_URL: ${DATABASE_URL}
+ DATABASE_TYPE: ${DATABASE_TYPE}
+ APP_SECRET: ${APP_SECRET}
+ depends_on:
+ db:
+ condition: service_healthy
+ init: true
+ restart: always
+ healthcheck:
+ test: ["CMD-SHELL", "curl -f http://localhost:3000/api/heartbeat || exit 1"]
+ interval: 5s
+ timeout: 5s
+ retries: 5
+
+ db:
+ container_name: umami-db
+ image: docker.io/library/postgres:15-alpine
+ environment:
+ POSTGRES_DB: ${POSTGRES_DB}
+ POSTGRES_USER: ${POSTGRES_USER}
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
+ volumes:
+ - umami-db-data:/var/lib/postgresql/data:Z
+ restart: always
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
+ interval: 5s
+ timeout: 5s
+ retries: 5
+
+volumes:
+ umami-db-data:
diff --git a/podman/umami.service b/podman/umami.service
new file mode 100644
index 0000000..4292a8b
--- /dev/null
+++ b/podman/umami.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Umami Container Stack via Podman-Compose
+After=network.target
+
+[Service]
+Type=simple
+WorkingDirectory=/opt/apps/umami
+EnvironmentFile=/opt/apps/umami/.env
+ExecStart=/usr/bin/podman-compose -f podman-compose.yml up -d
+ExecStop=/usr/bin/podman-compose -f podman-compose.yml down
+RemainAfterExit=yes
+
+[Install]
+WantedBy=default.target