Sign inSign up

psvensson/lagrange

By psvensson

•Updated 16 days ago

Distributed SQL database and compute-near-data runtime

Image
Networking
Databases & storage
0

435

psvensson/lagrange repository overview

⁠Lagrange

Distributed SQL database and compute-near-data runtime: a cluster of equal nodes that stores partitioned, Raft-replicated SQL tables and runs your compute (JS/WASM services) on the node that owns the data it reads.

Experimental / alpha. 0.x releases carry no backward-compatibility guarantee. See the changelog⁠ — including its Known limitations section — before running anything load-bearing.

⁠Tags

TagMeaning
latestMost recent release
0.1.0, …One tag per vX.Y.Z release, built from that git tag

Images are linux/amd64 only and built on distroless Node.js 22⁠ — there is no shell, package manager, or npm inside the container.

⁠Quick start — single node

docker run --rm -p 8080:8080 -p 8081:8081 -p 8082:8082 psvensson/lagrange:latest

A node started without SEED_NODE_ADDRESS becomes the seed of a new cluster. It opens three ports:

PortPurpose
8080REST API (/health liveness, /readyz readiness)
8081Admin websocket (fixed; does not move with the REST port)
8082Node-to-node transport websocket (REST port + 2)

To interact with the node, connect the admin CLI from a checkout of the repository (the image itself has no shell to exec into):

git clone https://codeberg.org/psvensson/lagrange && cd lagrange
npm install
npm run cli    # interactive terminal UI against localhost:8081

⁠Multi-node cluster

One container per node — two nodes cannot share a network namespace because the admin port is fixed at 8081. Joiners point SEED_NODE_ADDRESS at the seed and advertise an address other nodes can reach:

docker network create lagrange-net

docker run -d --name seed --network lagrange-net \
  -e TRANSPORT_WS_HOST=0.0.0.0 \
  -e NODE_ADDRESS=seed:8080 \
  -e NODE_ADVERTISED_WS_ADDRESS=seed:8082 \
  psvensson/lagrange:latest

docker run -d --name node2 --network lagrange-net \
  -e TRANSPORT_WS_HOST=0.0.0.0 \
  -e NODE_ADDRESS=node2:8080 \
  -e NODE_ADVERTISED_WS_ADDRESS=node2:8082 \
  -e SEED_NODE_ADDRESS=http://seed:8080 \
  psvensson/lagrange:latest

Leave NODE_ID unset: join admission requires a UUID identity, which the node mints on first start and restores from its data directory on restart.

⁠Configuration

Set via environment variables (-e):

VariableDefaultMeaning
SEED_NODE_ADDRESSunsetUnset → start as seed; set (http://host:8080) → join that cluster
NODE_ADDRESSlocalhostRegistration address other nodes reach you at (host:8080); the localhost default is rejected at join admission
NODE_ADVERTISED_WS_ADDRESSlocalhostAdvertised transport address (host:8082)
TRANSPORT_WS_HOSTlocalhostTransport bind host; use 0.0.0.0 in containers
REST_API_PORT8080REST port (transport = this + 2; admin stays 8081)
DATA_DIR./dataStorage directory — /app/data inside the container
NODE_IDunsetLeave unset (UUID minted and persisted on first start)
LOG_LEVEL / LOG_PRETTY_PRINTinfo / falseLogging

⁠Persistence

All state — partition storage, Raft logs, and the node's durable identity — lives under DATA_DIR (/app/data). Mount a volume to survive container replacement:

docker run -d -v lagrange-data:/app/data -p 8080:8080 -p 8081:8081 -p 8082:8082 \
  psvensson/lagrange:latest

⁠Kubernetes

The repository ships a Helm chart (1 seed + N joiner StatefulSets, name-first addressing, per-pod PVCs) that deploys this image: charts/lagrange-node⁠.

⁠Memory

The container starts Node with --max-old-space-size=1536. Give the container more than that (the Helm chart defaults to a 2 GiB limit), or override the heap cap by replacing the command:

docker run ... psvensson/lagrange:latest --max-old-space-size=3072 src/index.js

⁠Learn more

Tag summary

Content type

Image

Digest

sha256:b58d44906…

Size

98.4 MB

Last updated

16 days ago

docker pull psvensson/lagrange