Self-host NATS with Levelrail

Verified

A lightweight messaging server for pub/sub, request/reply and durable streams, with JetStream persistence enabled.

  • Authornats-ioVerified by Levelrail
  • LicenceApache-2.0
  • Memory128 MiB
  • Archarm64
  • Services1

How to self-host NATS

  1. Pull the images

    One image is pulled on your server.

    Show images
    • nats:2.10-alpine
  2. Create the app

    One service starts in a single Compose app, with 1 named volume mount for your data, on ports 4222, 8222.

  3. Fill in the secrets

    You do not have to fill in anything.

  4. Open it

    Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.

NATS requirements

Memory
About 128 MiB
Architectures
amd64 image published, arm64 tested
Ports
4222, 8222
Domain
Optional, an sslip.io address is used without one
Settings
none to fill in
License
Apache-2.0, permissive license
  • Verified. Verified on arm64 with image tag 2.10-alpine. Our CI ran this exact image version and it answered on its health path. Evidence

Install Levelrail first

On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then NATS. New to Levelrail? Install it on a fresh VPS first.

docker pull ghcr.io/glincker/levelrail:latest

Then levelrail-cli login --device. See Getting started and the NATS docs page.

Deploy NATS your way

Every format below deploys the same pinned images. Pick the one that fits how you work.

Deploy NATS from the CLI

levelrail-cli templates deploy nats --name my-nats

Deploy NATS with the API

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/nats/deploy

NATS configuration

NATS services

ServiceImagePortsVolumes
nats nats:2.10-alpine 4222, 8222 nats_data -> /data

NATS environment variables

The catalog lists no environment variables for this template.

Ports and volumes

Ports
4222, 8222
Volumes
1 named mount: nats_data -> /data

NATS FAQ

How much memory does NATS need?

The catalog lists about 128 MiB of memory for NATS.

Does NATS run on arm64?

For NATS, arm64 is tested; amd64 is image published.

What licence is NATS under?

NATS is licensed under Apache-2.0, which is permissive, with few conditions on reuse.

Does NATS need configuration before it starts?

No. The template fills in its own defaults.

Which ports does NATS use?

NATS listens on ports 4222 and 8222 inside the stack.

Where does NATS keep its data?

In a named volume: nats_data mounted at /data.

Can I deploy NATS on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for NATS, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image nats:2.10-alpine is what you deploy there.

levelrail-cli templates deploy nats --name my-nats