Deploying a Tei App
Introduction
Tei is an open-source tool for collaborative data and task management. Deploying Tei with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample checks to confirm your deployment.
Prerequisites
- Klutch.sh account (sign up)
- GitHub repository containing your Tei Dockerfile (GitHub is the only supported git source)
- External PostgreSQL database
- Optional: object storage if you offload attachments
Architecture and ports
- Tei serves HTTP on internal port
8000. Choose HTTP traffic and set the internal port to8000. - Persistent storage is recommended for uploads and cached assets; primary data lives in Postgres.
Repository layout
tei/├── 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
Build and run locally (ensure Postgres is reachable):
docker build -t tei-local .docker run -p 8000:8000 \ -e DATABASE_URL=postgres://user:pass@localhost:5432/tei \ -e JWT_SECRET=$(openssl rand -hex 32) \ tei-localDockerfile for Tei (production-ready)
Place this at the repo root; Klutch.sh auto-detects Dockerfiles.
FROM node:18-alpine AS builderWORKDIR /appCOPY package*.json ./RUN npm ciCOPY . .RUN npm run build
FROM node:18-alpine AS runnerWORKDIR /appENV NODE_ENV=productionENV PORT=8000COPY --from=builder /app ./RUN npm ci --omit=devEXPOSE 8000CMD ["npm", "run", "start"]Notes:
- Pin Node to the version Tei supports; adjust if upstream changes.
- Keep the Dockerfile at the repo root; Docker selection is automatic in Klutch.sh.
Environment variables (Klutch.sh)
Set these before deploying:
PORT=8000DATABASE_URL=postgres://<user>:<password>@<host>:5432/<db>JWT_SECRET=<secure-random-hex>- Optional:
NEXTAUTH_SECRET=<secure-random-hex>if the app uses NextAuth - Optional object storage:
S3_ENDPOINT,S3_BUCKET,S3_ACCESS_KEY,S3_SECRET_KEY
If deploying without the Dockerfile and relying on Nixpacks:
NIXPACKS_NODE_VERSION=18NIXPACKS_START_CMD=npm run start
Attach persistent volumes
If you store uploads or cache locally, add storage in Klutch.sh (path and size only):
/app/storage— uploads/cache.
Ensure the path matches your Tei configuration and is writable.
Deploy Tei 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
8000. - Add the environment variables above (database URL, JWT secret, optional storage keys).
- Attach a volume at
/app/storageif you want local persistence, sized for your attachments/cache. - Deploy. Your app will be reachable at
https://example-app.klutch.sh; complete any in-app setup.
Sample checks
Landing page:
curl -I https://example-app.klutch.shHealth endpoint (replace if the app exposes a specific route):
curl -I https://example-app.klutch.sh/api/healthHealth checks and production tips
- Add an HTTP readiness probe to
/or your health endpoint. - Keep DB credentials, JWT secrets, and any storage keys in Klutch.sh secrets; rotate regularly.
- Pin image/Node versions and test upgrades in staging before production rollout.
- Monitor
/app/storagevolume usage; resize proactively or move to object storage for larger attachments.
Tei on Klutch.sh delivers reproducible Docker builds, managed secrets, and optional storage—without extra YAML or CI steps. Configure ports, env vars, and storage, then launch your collaborative platform.