Added support for deployment using podman

This commit is contained in:
thomasdn 2025-04-17 18:36:56 +02:00
parent 38ab685143
commit 05f0e7ba76
5 changed files with 131 additions and 0 deletions

50
podman/README.md Normal file
View file

@ -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 `umamicrm.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).

16
podman/env.sample Normal file
View file

@ -0,0 +1,16 @@
# Rename this file to .env and modify the values
#
# Connection string for Umamis 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

View file

@ -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

41
podman/podman-compose.yml Normal file
View file

@ -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:

14
podman/umami.service Normal file
View file

@ -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