Install

Voodu ​

The Single VM layout as voodu manifests: one ndb with a data volume and a socket dir, and one app per language that mounts the socket dir.

Templates

These manifests were not run. The block and field names follow a plain, generic style. Check them against the manifests you already deploy and adjust the syntax.

The files are in deploy/examples/single-vm/voodu.

ndb ​

hcl
# TEMPLATE. This manifest was not run. The block and field names are a plain,
# generic style; adjust them to the voodu version and to your other manifests
# (for example infra/voodu/apps/*.voodu in your own repo).
#
# Apply:  vd apply -f ndb.voodu -y

app "ndb" {
  image    = "ghcr.io/thadeu/ndb:latest"
  replicas = 1                      # one replica owns the data dir (flock)
  user     = "65532:65532"

  # No args: data dir /var/lib/ndb, socket /run/ndb/ndb.sock (mode 0660),
  # config /etc/ndb/ndb.yml when it is mounted.

  stop_timeout = "35s"              # the daemon waits up to 30 s on SIGTERM

  volume "data" {
    type = "local"                  # local persistent disk, never NFS/EFS
    path = "/var/lib/ndb"
  }

  volume "socket" {
    type      = "hostPath"          # shared with the app pods
    host_path = "/run/ndb"
    path      = "/run/ndb"
  }
}
  • replicas = 1: one daemon owns the data dir (flock). Never scale it to 2.
  • The data volume is a local persistent disk, never NFS or EFS.
  • The socket volume is a host path that every app mounts.
  • stop_timeout above 30 s, so that running requests finish.

An app ​

hcl
# TEMPLATE. This manifest was not run. See the note in ndb.voodu.
#
# One app that uses ndb through the shared socket. Add one block like this
# for each app (Go, Ruby, Node, Bun). Apply it after ndb.voodu.

app "visits-go" {
  image    = "registry.example.com/visits-go:latest"
  replicas = 1
  user     = "1000:65532"           # gid 65532 = the group of the socket (mode 0660 by default)

  env = {
    NDB_URL = "unix:///run/ndb/ndb.sock"
  }

  volume "socket" {
    type      = "hostPath"
    host_path = "/run/ndb"
    path      = "/run/ndb"
  }

  depends_on = ["ndb"]
}
  • user = "1000:65532": group 65532 is the group of the socket, so the app can open it (the socket is 0660 by default).
  • NDB_URL is the only setting the SDKs need.
  • Add one block like this for each app.

Apply ​

bash
vd apply -f ndb.voodu -y
vd apply -f app.voodu -y

Apply ndb first. The apps retry until the daemon answers, so the order is only for a clean start.