Deploying a Pleroma App
Introduction
Pleroma is an open-source, lightweight federated social networking server built on Elixir/Phoenix. Deploying Pleroma with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for uploads and configs—all configured from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.
Prerequisites
- A Klutch.sh account (sign up)
- A GitHub repository containing your Pleroma Dockerfile (GitHub is the only supported git source)
- PostgreSQL database (deploy as a Klutch.sh TCP app on port
8000and connect on5432) - Domain and TLS for secure access
For onboarding, see the Quick Start.
Architecture and ports
- Pleroma serves HTTP on internal port
4000; choose HTTP traffic. - Persistent storage is required for uploads, static assets, and configuration.
Repository layout
pleroma/├── Dockerfile # Must be at repo root for auto-detection└── README.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Validate locally before pushing to GitHub:
docker build -t pleroma-local .docker run -p 4000:4000 \ -e DATABASE_URL=postgres://user:pass@localhost:5432/pleroma \ -e SECRET_KEY_BASE=changeme \ -e SIGNING_SALT=changeme \ pleroma-localDockerfile for Pleroma (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):
FROM ghcr.io/pleroma/pleroma:latest
ENV PORT=4000
EXPOSE 4000CMD ["pleroma", "start"]Notes:
- Pin the image tag (e.g.,
ghcr.io/pleroma/pleroma:v2.x) for stability; update intentionally. - The image reads environment variables for DB and secrets; supply them via Klutch.sh.
Environment variables (Klutch.sh)
Set these in Klutch.sh before deploying:
PORT=4000DATABASE_URL=postgres://<user>:<password>@<db-host>:5432/<db>SECRET_KEY_BASE=<secure-random>SIGNING_SALT=<secure-random>INSTANCE_NAME=Pleroma on Klutch.sh(optional)DOMAIN=example-app.klutch.sh- Optional:
STATIC_DIR=/opt/pleroma/static,UPLOAD_DIR=/var/lib/pleroma/uploads
If you deploy without the Dockerfile and need Nixpacks overrides:
NIXPACKS_ELIXIR_VERSION=1.15NIXPACKS_ERLANG_VERSION=26NIXPACKS_START_CMD=pleroma start
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/var/lib/pleroma/uploads— media uploads./var/lib/pleroma/static— custom static assets./etc/pleroma— configuration files (if you externalize config)./var/log/pleroma— optional logs if written to disk.
Ensure these paths are writable inside the container.
Deploy Pleroma on Klutch.sh (Dockerfile workflow)
- Push your repository—with the Dockerfile at the root—to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Select HTTP traffic and set the internal port to
4000. - Add the environment variables above, including DB URL, secrets, and domain.
- Attach persistent volumes for
/var/lib/pleroma/uploads,/var/lib/pleroma/static, and optionally/etc/pleroma//var/log/pleromasized for your storage needs. - Deploy. Your Pleroma instance will be reachable at
https://example-app.klutch.sh; attach a custom domain if desired.
Sample API usage
Get instance info:
curl -X GET "https://example-app.klutch.sh/api/v1/instance"Post a status (replace token):
curl -X POST "https://example-app.klutch.sh/api/v1/statuses" \ -H "Authorization: Bearer <access_token>" \ -H "Content-Type: application/json" \ -d '{"status":"Hello from Pleroma on Klutch.sh!"}'Health checks and production tips
- Add an HTTP probe to
/api/v1/instanceor/for readiness. - Enforce HTTPS at the edge; forward internally to port
4000. - Keep DB credentials,
SECRET_KEY_BASE, andSIGNING_SALTin Klutch.sh secrets; rotate regularly. - Monitor storage usage on uploads/static; resize before they fill.
- Pin image versions and test upgrades in staging; back up DB and volumes before updates.
Pleroma on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, port 4000 configured, and Postgres connected, you can deliver a federated social experience without extra YAML or workflow overhead.