Skip to content

Install Selega

Selega is self-hosted with Docker. The provided docker-compose.yml brings up two containers — Selega and its own PostgreSQL — plus a volume for the data. You do not need to install or provision a database separately.

  • Docker with the Compose plugin (docker compose).
  • A host port for the web UI (default 8088).
  • For production: a reverse proxy with HTTPS/TLS (Caddy, nginx, or your panel’s built-in TLS).

The container image is built from node:22-slim and bakes in Tesseract OCR (with the Spanish language pack) and poppler-utils for scanned PDFs. It runs as a non-root user.

Terminal window
git clone https://github.com/diegoparras/selega.git && cd selega
cp .env.example .env # edit POSTGRES_PASSWORD (use something strong)
docker compose up -d --build
docker compose logs selega # the generated admin password is printed here (once)
# → http://localhost:8088

That is all: two containers (selega + selega-db) and one volume for the data.

Selega is published to GHCR on every push as ghcr.io/diegoparras/selega:latest, and the docker-compose.yml also declares build: .. You can therefore either build from the repo or pull the published image:

Terminal window
git clone https://github.com/diegoparras/selega.git && cd selega
cp .env.example .env
docker compose up -d --build

Copy .env.example to .env and set real values. Never commit .env to git.

VariableDefaultPurpose
POSTGRES_PASSWORD— (required)Database password. Use something strong.
SELEGA_ADMIN_EMAILadmin@selega.localUser of the first superadmin.
SELEGA_ADMIN_PASS(empty)Leave empty → a password is generated and printed once in the logs.
SELEGA_SECURE_COOKIE0Set to 1 behind HTTPS/TLS (session cookie sent over HTTPS only).
SELEGA_PORT8088Host port (the app listens on 8080 inside the container).
OPENROUTER_KEY(empty)Optional cloud AI key. Prefer loading it from Admin (stored write-only).
POSTGRES_USER / POSTGRES_DBselegaDatabase user / name.
  1. Run docker compose logs selega (or read your panel’s logs) and copy the generated admin password. It is printed once.
  2. Sign in with SELEGA_ADMIN_EMAIL and that password. You are now superadmin.
  3. Open the kebab menu (⋮) → System: choose which jurisdictions this installation serves and configure the engines.
  4. Open the kebab menu (⋮) → Administration: create users (agent / supervisor / auditor / admin) and edit the rules.

All of Dokploy, Easypanel, Coolify and Portainer support Docker Compose. The recommended path is to connect this GitHub repo so the panel builds the image for you; if your panel only accepts a pasted compose, use the image-only block above.

The only mandatory variable is POSTGRES_PASSWORD. Leave SELEGA_ADMIN_PASS empty so Selega generates the admin password and prints it once in the container logs. When the panel provides TLS (Dokploy, Easypanel and Coolify do automatically), set SELEGA_SECURE_COOKIE=1.

Terminal window
git pull && docker compose up -d --build # build from the repo
# or, with the published image:
docker compose pull && docker compose up -d
  • TLS: put Selega behind a reverse proxy with HTTPS and set SELEGA_SECURE_COOKIE=1.
  • Strong secrets in .env; never commit .env. Empty SELEGA_ADMIN_PASS → auto-generated.
  • Close the Postgres port — do not expose the db service to the host in production.
  • Back up the selega-pg volume — it is the record of legalizations.

The container runs as a non-root user, with CSP and security headers, scrypt password hashing, HMAC sessions, login lockout and parameterized queries. It is audited with semgrep, OWASP ZAP, Trivy and gitleaks.