Skip to content

Deploying a Jitsu App

Introduction

Jitsu is an open-source data ingestion and event collection platform that routes events to warehouses and real-time destinations. Deploying Jitsu with a Dockerfile on Klutch.sh gives you reproducible builds, managed secrets, and persistent storage for configuration—all managed from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, and best practices for reliable event delivery.


Prerequisites

  • A Klutch.sh account (create one)
  • A GitHub repository containing your Jitsu config/custom code (GitHub is the only supported git source)
  • Docker familiarity and Node.js/Go basics (Jitsu uses both)
  • Database credentials if you use Postgres for state, and credentials for downstream destinations

Review platform basics in the Quick Start.


Architecture and ports

  • Jitsu serves HTTP; set the internal container port to 8001 (the default Jitsu server port).
  • For databases (e.g., Postgres) or caches, run them as separate Klutch.sh TCP apps, exposed on port 8000 and connected on native ports (5432 for Postgres).
  • Persistent storage is recommended for configuration files, custom destinations, and local cache.

Repository layout

jitsu/
├── config/ # Jitsu config files
├── destinations/ # Custom destination code/configs
├── Dockerfile # Must be at repo root for auto-detection
├── package.json
├── pnpm-lock.yaml # or yarn.lock / package-lock.json
├── go.mod # If building custom Go destinations
└── .env.example # Template only; no secrets

Keep 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:

Terminal window
pnpm install
pnpm build
pnpm start -- --port 8001

If you build Go-based destinations, add:

Terminal window
go build ./...

Optional helper start.sh for portability and Nixpacks fallback:

#!/usr/bin/env bash
set -euo pipefail
pnpm start -- --port 8001

Make it executable with chmod +x start.sh.


Dockerfile for Jitsu (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 build
WORKDIR /app
COPY package.json pnpm-lock.yaml* yarn.lock* package-lock.json* ./
RUN corepack enable
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM node:18-alpine
WORKDIR /app
ENV NODE_ENV=production PORT=8001
COPY --from=build /app /app
RUN corepack enable && pnpm install --prod --frozen-lockfile
EXPOSE 8001
CMD ["pnpm", "start", "--", "--port", "8001"]

Notes:

  • If you compile Go components, add a Go build stage and copy the binaries into the final image.
  • Keep config/ and destinations/ on volumes if you edit them at runtime.

Environment variables (Klutch.sh)

Set these in the Klutch.sh app settings (Secrets tab) before deploying:

  • NODE_ENV=production
  • PORT=8001
  • APP_BASE_URL=https://example-app.klutch.sh
  • REDIS_URL=redis://<user>:<password>@<host>:<port> (if using Redis)
  • POSTGRES_URL=postgres://<user>:<password>@<host>:<port>/<db> (if using Postgres)
  • Destination-specific secrets (e.g., SEGMENT_WRITE_KEY, S3_ACCESS_KEY, etc.)

If you deploy without the Dockerfile and need Nixpacks overrides:

  • NIXPACKS_BUILD_CMD=pnpm install --frozen-lockfile && pnpm build
  • NIXPACKS_START_CMD=pnpm start -- --port 8001
  • NIXPACKS_NODE_VERSION=18

These keep Jitsu 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/config — for configuration files you edit at runtime.
  • /app/destinations — for custom destination code/configs.

Ensure these paths are writable inside the container.


Deploy Jitsu on Klutch.sh (Dockerfile workflow)

  1. Push your repository (with the Dockerfile at the root) to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  1. Connect the GitHub repository; Klutch.sh automatically detects the Dockerfile.
  2. Choose HTTP traffic for Jitsu.
  3. Set the internal port to 8001.
  4. Add the environment variables above (database/cache URLs, destination secrets, and any NIXPACKS_* overrides if you temporarily deploy without the Dockerfile).
  5. Attach persistent volumes for /app/config and /app/destinations if you modify them at runtime, selecting sizes that fit your needs.
  6. Deploy. Your Jitsu endpoint will be reachable at https://example-app.klutch.sh; attach a custom domain if desired.

Health checks and production tips

  • Add a /health endpoint or reuse Jitsu’s status route for monitoring.
  • Enforce HTTPS at the edge; forward HTTP to port 8001 internally.
  • Keep lockfiles committed and Node versions pinned for reproducible builds.
  • Rotate destination credentials regularly and keep them only in Klutch.sh secrets.
  • Monitor disk usage on mounted paths and resize volumes before they fill.

Jitsu on Klutch.sh combines reproducible Docker builds with managed secrets, persistent configuration storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root and ports set to 8001 for the app (8000 externally for TCP databases or caches), you can deliver reliable event collection without extra YAML or workflow overhead.