Deploying a Peppermint App
Introduction
Peppermint is an open-source customer messaging platform built on Node.js for multi-channel conversations. Deploying Peppermint with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for uploads and logs—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 Peppermint Dockerfile (GitHub is the only supported git source)
- PostgreSQL database (deploy as a Klutch.sh TCP app on port
8000; connect on5432) - Optional: Redis for queues/caching (deploy as TCP on port
8000; connect on6379) - Domain and TLS for secure access
For onboarding, see the Quick Start.
Architecture and ports
- Peppermint serves HTTP on internal port
3000; choose HTTP traffic. - Persistent storage is required for uploads and optional logs.
Repository layout
peppermint/├── Dockerfile # Must be at repo root for auto-detection├── package.json├── pnpm-lock.yaml # or yarn.lock / package-lock.json├── .env.example # Template only; no secrets└── src/ # Application sourceKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Validate locally before pushing to GitHub:
pnpm installpnpm buildpnpm start -- --port 3000Optional helper start.sh:
#!/usr/bin/env bashset -euo pipefailexec pnpm start -- --port "${PORT:-3000}"Make it executable with chmod +x start.sh.
Dockerfile for Peppermint (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):
FROM node:18-alpine AS buildWORKDIR /app
COPY package.json pnpm-lock.yaml* yarn.lock* package-lock.json* ./RUN corepack enableRUN pnpm install --frozen-lockfile
COPY . .RUN pnpm build
FROM node:18-alpineWORKDIR /appENV NODE_ENV=production PORT=3000
COPY --from=build /app /appRUN corepack enable && pnpm install --prod --frozen-lockfile
EXPOSE 3000CMD ["pnpm", "start", "--", "--port", "3000"]Notes:
- Add build tools (
apk add --no-cache python3 make g++) if native modules are required. - Keep upload/log directories writable and mount them as volumes.
Environment variables (Klutch.sh)
Set these in Klutch.sh before deploying:
NODE_ENV=productionPORT=3000APP_URL=https://example-app.klutch.shDATABASE_URL=postgres://<user>:<password>@<host>:5432/<db>- Optional Redis:
REDIS_URL=redis://:<password>@<host>:6379/0 - Storage paths:
UPLOAD_DIR=/app/uploads,LOG_DIR=/app/logs - Any provider/API keys your Peppermint setup requires (e.g., email/SMS gateways)
If you deploy without the Dockerfile and need Nixpacks overrides:
NIXPACKS_BUILD_CMD=pnpm install --frozen-lockfile && pnpm buildNIXPACKS_START_CMD=pnpm start -- --port 3000NIXPACKS_NODE_VERSION=18
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/app/uploads— user-uploaded files and attachments./app/logs— optional logs if stored on disk.
Ensure these paths are writable inside the container.
Deploy Peppermint 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
3000. - Add the environment variables above, including database/Redis URLs, app URL, and storage paths.
- Attach persistent volumes for
/app/uploads(and/app/logsif used) sized for your content and retention needs. - Deploy. Your Peppermint instance will be reachable at
https://example-app.klutch.sh; attach a custom domain if desired.
Sample API usage
Create a conversation (example endpoint; adjust to your API):
curl -X POST "https://example-app.klutch.sh/api/conversations" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <token>" \ -d '{"subject":"Hello from Peppermint on Klutch.sh","customer_id":"123"}'Health checks and production tips
- Add an HTTP probe to
/healthor/for readiness. - Enforce HTTPS at the edge; forward internally to port
3000. - Keep DB/Redis credentials and provider keys in Klutch.sh secrets; rotate them regularly.
- Monitor storage usage on
/app/uploads; resize before it fills. - Pin image versions and test upgrades in staging; back up DB and uploads before updates.
Peppermint 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 3000 configured, and Postgres/Redis connected, you can deliver reliable customer messaging without extra YAML or workflow overhead.