Saltar al contenido principal

Self-hosting

Pawnd is packaged as an OCI image and runs with Podman. Because the photos are stored in PostgreSQL rather than on disk, the application container holds no state: the database volume is the only thing to back up.

You will need a server with Podman, a domain name pointing at it, and ports 80 and 443 open.

On a server, with Quadlet

This is the recommended way. deploy/quadlet/ in the repository holds systemd units for PostgreSQL, the application and Caddy, which terminates TLS and fetches the certificate on its own. Everything shares one Podman network, and only Caddy publishes ports.

Run these on the server, as root:

# Secrets and reverse proxy configuration
sudo mkdir -p /etc/pawnd /etc/caddy
sudo cp deploy/quadlet/pawnd.env.example /etc/pawnd/pawnd.env
sudo chmod 600 /etc/pawnd/pawnd.env
sudo $EDITOR /etc/pawnd/pawnd.env
sudo cp deploy/quadlet/Caddyfile /etc/caddy/Caddyfile

# Install the units and start
sudo cp deploy/quadlet/*.network deploy/quadlet/*.volume \
deploy/quadlet/*.container /etc/containers/systemd/
sudo systemctl daemon-reload
sudo systemctl start pawnd-db.service pawnd.service caddy.service

pawnd.env needs POSTGRES_PASSWORD, DATABASE_URL, SECRET_KEY_BASE and PHX_HOST. PHX_HOST is the domain, and its DNS has to point at this server before Caddy can obtain a certificate for it.

The application runs its database migrations on start, and the services come up on boot.

The first administrator

There is no console step. On a fresh install, open https://your-domain/setup, or click "Log in", which redirects there. The form creates the first user as an admin, and it stops working as soon as any user exists.

Trying it out locally

For a throwaway run there is a deploy/compose.yaml with the application and PostgreSQL. Copy deploy/.env.example to deploy/.env, fill it in, and:

podman compose up -d

Updating

The application unit is labelled AutoUpdate=registry, so a new image is picked up with:

sudo podman auto-update

Enable podman-auto-update.timer if you would rather it check periodically.

Backing up

Use the "Descargar backup" button in the admin Users page. It dumps the whole database, images included. See Managing entries.