KLYRN
KLYRN Web
All documentation
  1. Home
  2. Docs
  3. Node.js

Node.js

A Node application is a site type: deployed from Git, health-checked before it takes traffic, and run in its own sandboxed systemd unit.

Creating an application

klyrn site create app.example.com --type node \
  --runtime 22 \
  --git https://github.com/you/app --branch main \
  --start "npm start" --build "npm run build"

--start and --build are detected from the repository when you leave them out. --runtime takes a major version or a full version, and the latest LTS is used if you do not say. Runtimes are fetched on demand and verified against nodejs.org's published SHA-256 list.

klyrn node    # installed and available runtimes

Deploying

klyrn app deploy app.example.com --git https://github.com/you/app --branch main
klyrn app rollback app.example.com
klyrn app show app.example.com

A deploy is one job:

  1. CloneAs the account user, over HTTPS. Root never runs Git against a customer's repository.
  2. Install and buildnpm ci, then the build command.
  3. Health-checkThe new release is started and probed before it takes any traffic.
  4. Switchnginx is pointed at the new release. The previous one stays on disk.

Because the previous release stays on disk, klyrn app rollback is instant.

Environment and settings

klyrn app env app.example.com                       # show
klyrn app env app.example.com DATABASE_URL=postgres://…  STRIPE_KEY=sk_live_…
klyrn app env app.example.com --unset STRIPE_KEY

klyrn app set app.example.com --start "node server.js"
klyrn app set app.example.com --build -            # clear the build command
klyrn app set app.example.com --health /healthz
klyrn app set app.example.com --memory 512

Environment variables are encrypted at rest. They go into the per-site backup manifest, which is itself encrypted.

How it runs

klyrn app start app.example.com
klyrn app stop app.example.com
klyrn app restart app.example.com
klyrn app logs app.example.com --lines 200

Each application is one sandboxed systemd unit with a memory ceiling, on a private loopback port behind nginx and TLS. The health engine's apps check runs every 30 seconds and has exactly one repair: restart units that are in the failed state. It does not restart a slow unit, and it stops after three attempts in thirty minutes.

Rolling KLYRN back with klyrn install --rollback removes the per-application units it created.

Discord WhatsApp