Deploying a Joplin App
Introduction
Joplin Server powers sync and collaboration for the open-source Joplin note-taking apps. Deploying Joplin with a Dockerfile on Klutch.sh gives you reproducible builds, managed secrets, and persistent storage for attachments—all from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, and best practices for reliable note sync.
Prerequisites
- A Klutch.sh account (create one)
- A GitHub repository containing your Joplin Server code/config (GitHub is the only supported git source)
- Docker familiarity and Node.js 18+ for local testing
- PostgreSQL credentials
- Storage capacity for file attachments and logs
For platform onboarding, review the Quick Start.
Architecture and ports
- Joplin Server runs HTTP on port
22300by default; set the internal container port to22300. - PostgreSQL should run as a separate Klutch.sh TCP app. Expose it on port
8000and connect internally on5432. - Persistent storage is required for user data, attachments, and logs.
Repository layout
joplin-server/├── packages/server/ # Joplin Server source├── 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└── README.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Install dependencies and run locally before pushing to GitHub:
pnpm installpnpm run buildpnpm start -- --port 22300Optional helper start.sh for portability and Nixpacks fallback:
#!/usr/bin/env bashset -euo pipefailpnpm start -- --port 22300Make it executable with chmod +x start.sh.
Dockerfile for Joplin (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 run build
FROM node:18-alpineWORKDIR /appENV NODE_ENV=production PORT=22300
COPY --from=build /app /appRUN corepack enable && pnpm install --prod --frozen-lockfile
EXPOSE 22300CMD ["pnpm", "start", "--", "--port", "22300"]Notes:
- If you use native modules, add build tools in the build stage (
apk add --no-cache python3 make g++). - Keep attachment storage paths writable and on a volume.
Environment variables (Klutch.sh)
Set these in the Klutch.sh app settings (Secrets tab) before deploying:
NODE_ENV=productionPORT=22300APP_BASE_URL=https://example-app.klutch.shPOSTGRES_PASSWORD=<db-password>POSTGRES_DATABASE=<db-name>POSTGRES_USER=<db-user>POSTGRES_PORT=5432POSTGRES_HOST=<db-host>DB_CLIENT=pgLOG_LEVEL=info
If you deploy without the Dockerfile and need Nixpacks overrides:
NIXPACKS_BUILD_CMD=pnpm install --frozen-lockfile && pnpm run buildNIXPACKS_START_CMD=pnpm start -- --port 22300NIXPACKS_NODE_VERSION=18
These keep Joplin compatible with Nixpacks defaults when a Dockerfile is absent.
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/app/packages/server/logs— for server logs./app/packages/server/files— for attachments/uploads.
Ensure these paths are writable inside the container.
Deploy Joplin 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.
- Connect the GitHub repository; Klutch.sh automatically detects the Dockerfile.
- Choose HTTP traffic for Joplin.
- Set the internal port to
22300. - Add the environment variables above (Postgres settings, base URL, log level, and any
NIXPACKS_*overrides if you temporarily deploy without the Dockerfile). - Attach persistent volumes for
/app/packages/server/logsand/app/packages/server/files, selecting sizes that match your retention needs. - Deploy. Your Joplin Server will be reachable at
https://example-app.klutch.sh; attach a custom domain if desired.
For PostgreSQL on Klutch.sh, create a separate TCP app, expose it on port 8000, and point POSTGRES_HOST to that endpoint (internal port 5432).
Health checks and production tips
- Add a
/pingor/healthendpoint proxy for uptime monitoring. - Enforce HTTPS at the edge; forward HTTP to port 22300 internally.
- Monitor disk usage on attachment and log volumes; resize before they fill.
- Keep lockfiles committed and Node versions pinned for reproducible builds.
- Back up PostgreSQL and attachments regularly; do not rely on container filesystems for durability.
Joplin on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage for attachments, and flexible HTTP/TCP routing. With the Dockerfile at the repo root and ports set to 22300 for the app (8000 externally for TCP databases), you can deliver reliable note syncing without extra YAML or workflow overhead.