Skip to content

Deploying a Saltcorn App

Introduction

Saltcorn is an open-source low-code platform for building database-backed applications. Deploying Saltcorn with a Dockerfile on Klutch.sh delivers 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 verify your deployment.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Saltcorn Dockerfile (GitHub is the only supported git source)
  • External PostgreSQL database
  • Domain and TLS for secure access

For onboarding, see the Quick Start.


Architecture and ports

  • Saltcorn serves HTTP on internal port 3000. Choose HTTP traffic in Klutch.sh and set the internal port to 3000.
  • Persistent storage is recommended for file uploads; primary data lives in Postgres.

Repository layout

saltcorn/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Build and run locally (ensure Postgres is reachable):

Terminal window
docker build -t saltcorn-local .
docker run -p 3000:3000 \
-e SALTCORN_DB_URI=postgres://user:pass@localhost:5432/saltcorn \
-e SALTCORN_PORT=3000 \
saltcorn-local

Dockerfile for Saltcorn (production-ready)

Place this at the repo root; Klutch.sh auto-detects Dockerfiles.

FROM saltcorn/saltcorn:latest
ENV SALTCORN_PORT=3000
EXPOSE 3000
CMD ["saltcorn", "serve"]

Notes:

  • Pin to a specific tag (e.g., saltcorn/saltcorn:1.9.0) for stability.
  • saltcorn serve runs the web server on the configured port.

Environment variables (Klutch.sh)

Set these before deploying:

  • PORT=3000
  • SALTCORN_PORT=3000
  • SALTCORN_DB_URI=postgres://<user>:<password>@<host>:5432/<db>
  • Optional: SALTCORN_SECRET=<secure-random> for session/signing if supported by your version

If deploying without the Dockerfile and relying on Nixpacks:

  • NIXPACKS_NODE_VERSION=18
  • NIXPACKS_START_CMD=saltcorn serve

Attach persistent volumes

If you store uploads or cache locally, add storage in Klutch.sh (path and size only):

  • /var/saltcorn — uploads, backups, and app files.

Ensure the path is writable inside the container.


Deploy Saltcorn 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.
  3. Select HTTP traffic and set the internal port to 3000.
  4. Add the environment variables above (Postgres URI, port, and optional secret).
  5. Attach a volume at /var/saltcorn if you need local persistence, sized for your uploads/backups.
  6. Deploy. Your app will be reachable at https://example-app.klutch.sh; complete setup in the UI.

Sample checks

Landing page:

Terminal window
curl -I https://example-app.klutch.sh

If you expose a health endpoint (replace if different):

Terminal window
curl -I https://example-app.klutch.sh/health

Health checks and production tips

  • Add an HTTP readiness probe to / or your health endpoint.
  • Keep DB credentials (and optional secret) in Klutch.sh secrets; rotate regularly.
  • Pin image versions and test upgrades in staging before production rollout.
  • Back up Postgres and /var/saltcorn (if used) regularly.

Saltcorn 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 low-code apps.