Deploying a Llana App
Introduction
Llana is an open-source application framework (replace with your specific Llana app details). Deploying Llana with a Dockerfile on Klutch.sh delivers reproducible builds, managed secrets, and persistent storage for app data—all configured from klutch.sh/app. This guide walks through installation, repository preparation, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.
Prerequisites
- A Klutch.sh account (create one)
- A GitHub repository containing your Llana code/config (GitHub is the only supported git source)
- Docker familiarity and Node.js 18+ knowledge
- Database credentials if your Llana app persists data (PostgreSQL recommended)
- Storage for uploads, cache, or logs if your app writes to disk
For onboarding, see the Quick Start.
Architecture and ports
- Llana serves HTTP; set the internal container port to
3000(adjust to your app’s port if different). - If you use PostgreSQL or Redis, deploy them as separate Klutch.sh TCP apps exposed on port
8000and connect on native ports (5432/6379). - Persistent storage is recommended for uploads and logs if your app writes locally.
Repository layout
llana/├── 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├── public/ # Static assets (optional)├── uploads/ # App data/uploads (mount as volume)└── 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 buildpnpm start -- --port 3000Optional helper start.sh for portability and Nixpacks fallback:
#!/usr/bin/env bashset -euo pipefailpnpm prisma migrate deploy || trueexec pnpm start -- --port 3000Make it executable with chmod +x start.sh.
Dockerfile for Llana (production-ready)
Place this Dockerfile at the repository 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++) in the build stage if native modules are required. - Keep
uploads/writable and mount it as a volume for any user-generated content.
Environment variables (Klutch.sh)
Set these in the Klutch.sh app settings (Secrets tab) before deploying:
NODE_ENV=productionPORT=3000APP_BASE_URL=https://example-app.klutch.shDATABASE_URL=postgres://<user>:<password>@<host>:<port>/<db>(if using a database)REDIS_URL=redis://<user>:<password>@<host>:<port>(if using Redis)- App-specific secrets (e.g.,
JWT_SECRET, provider API keys)
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
These keep Llana 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/uploads— for user-generated content or persisted assets./app/logs— optional if you store logs locally.
Ensure these paths are writable inside the container.
Deploy Llana 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 Llana.
- Set the internal port to
3000. - Add the environment variables above (database/Redis URLs, app secrets, and any
NIXPACKS_*overrides if you temporarily deploy without the Dockerfile). - Attach persistent volumes for
/app/uploads(and/app/logsif used), choosing sizes that fit your retention needs. - Deploy. Your Llana instance will be reachable at
https://example-app.klutch.sh; attach a custom domain if desired.
Sample API usage
Call a sample endpoint (replace placeholders):
curl -X GET "https://example-app.klutch.sh/api/health" \ -H "Authorization: Bearer <token>"Health checks and production tips
- Add a reverse proxy probe to
/api/healthor a lightweight status route. - Enforce HTTPS at the edge; forward HTTP to port 3000 internally.
- Keep lockfiles committed and Node version pinned; test upgrades before applying.
- Monitor database and cache performance; set connection pools to match your deployment size.
- Rotate secrets regularly and store them only in Klutch.sh secrets.
- Track disk usage on
/app/uploadsand resize volumes before they fill.
Llana on Klutch.sh combines reproducible Docker builds with managed secrets, optional persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root and port 3000 configured, you can deploy a reliable Llana app without extra YAML or workflow overhead.