Deploying a Postiz App
Introduction
Postiz is an open-source social media scheduler with queues, calendars, and multi-account publishing. Deploying Postiz with a Dockerfile on Klutch.sh delivers reproducible builds, managed secrets, and optional persistent storage—all configured from klutch.sh/app. This guide covers installation, repo prep, a production-ready Dockerfile, environment configuration, storage, Nixpacks overrides, and sample API calls.
Prerequisites
- A Klutch.sh account (sign up)
- A GitHub repository containing your Postiz Dockerfile (GitHub is the only supported git source)
- External PostgreSQL database and optional Redis cache
- OAuth credentials for social networks you plan to connect
For onboarding, see the Quick Start.
Architecture and ports
- Postiz serves HTTP on internal port
3000. Choose HTTP traffic in Klutch.sh and set the internal port to3000. - Persistent storage is optional (e.g., image uploads/cache). Primary data lives in Postgres (and Redis if enabled).
Repository layout
postiz/├── 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
Test locally before pushing to GitHub:
docker build -t postiz-local .docker run -p 3000:3000 \ -e DATABASE_URL=postgres://user:pass@localhost:5432/postiz \ -e NEXTAUTH_SECRET=$(openssl rand -hex 32) \ -e NEXTAUTH_URL=http://localhost:3000 \ -e REDIS_URL=redis://localhost:6379 \ postiz-localEnsure Postgres (and Redis if used) are reachable.
Dockerfile for Postiz (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it.
FROM node:18-alpine AS builderWORKDIR /appCOPY package*.json ./RUN npm ciCOPY . .RUN npm run build
FROM node:18-alpine AS runnerWORKDIR /appENV PORT=3000ENV NODE_ENV=productionCOPY --from=builder /app/.next ./.nextCOPY --from=builder /app/public ./publicCOPY --from=builder /app/package*.json ./RUN npm ci --omit=devEXPOSE 3000CMD ["npm", "run", "start"]Notes:
- Pin Node to the version Postiz supports (adjust if upstream changes).
- Keep the Dockerfile at the repo root; users cannot select Docker manually in the dashboard.
Environment variables (Klutch.sh)
Set these before deploying:
PORT=3000DATABASE_URL=postgres://<user>:<password>@<host>:5432/<db>NEXTAUTH_URL=https://example-app.klutch.shNEXTAUTH_SECRET=<secure-random-hex>REDIS_URL=redis://<host>:6379(optional)- OAuth keys for providers you enable (e.g.,
TWITTER_CLIENT_ID,TWITTER_CLIENT_SECRET,GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET, etc.)
If deploying without the Dockerfile and relying on Nixpacks:
NIXPACKS_NODE_VERSION=18NIXPACKS_START_CMD=npm run start
Attach persistent volumes
If you store local assets, add storage in Klutch.sh with mount path and size (no names needed):
/app/storage— optional uploads/cache.
Ensure the path matches your Postiz configuration.
Deploy Postiz on Klutch.sh (Dockerfile workflow)
- Push your repo—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
3000. - Add the environment variables above (database, NextAuth, OAuth keys, and optional Redis).
- Attach a volume at
/app/storageif you want local asset persistence, sized for your needs. - Deploy. Your app will be reachable at
https://example-app.klutch.sh; add a custom domain if desired.
Sample API usage
Check health:
curl -I https://example-app.klutch.sh/api/healthCreate a test request (example placeholder endpoint):
curl -X POST https://example-app.klutch.sh/api/webhooks/test \ -H "Content-Type: application/json" \ -d '{"source":"klutch-guide","status":"ok"}'Health checks and production tips
- Add an HTTP readiness probe to
/api/health(or the equivalent status endpoint). - Keep
NEXTAUTH_SECRETand OAuth credentials in Klutch.sh secrets; rotate them periodically. - Use external Postgres (and Redis) for durability; back up databases regularly.
- Pin Docker base versions and test upgrades in staging before production.
- Monitor storage usage on
/app/storageif enabled; resize volumes proactively.
Postiz on Klutch.sh gives you reproducible Docker builds, managed secrets, and optional persistent storage—without extra YAML or CI steps. Configure ports, env vars, and storage, then ship your social scheduling workspace.