Skip to content

feat(compose): add logosdeliverynode docker-compose stack - #4057

Open
NagyZoltanPeter wants to merge 3 commits into
masterfrom
chore-logosdeliverynode-compose
Open

feat(compose): add logosdeliverynode docker-compose stack#4057
NagyZoltanPeter wants to merge 3 commits into
masterfrom
chore-logosdeliverynode-compose

Conversation

@NagyZoltanPeter

Copy link
Copy Markdown
Contributor

What

Adds apps/logos_delivery_node/compose/ — a docker-compose project that runs the logosdeliverynode image as a service node with a Postgres store and a Prometheus + Grafana monitoring stack. Ported from logos-messaging/logos-delivery-compose and adapted for logosdeliverynode instead of wakunode2.

Services

Service Purpose
logos-messaging-node logosdeliverynode (built from the repo Dockerfile, MAKE_TARGET=logosdeliverynode, -d:postgres; overridable via LOGOS_IMAGE)
postgres + postgres-exporter message store + metrics
prometheus + grafana monitoring (Grafana provisioned with the node dashboard)
certbot optional Let's Encrypt certs for WebSocket-Secure

Configuration

  • PRESET (default logos.dev) and ENTRY_LAYER (default kernel) are env-configurable via .env; empty PRESET disables the preset.
  • --entry-layer is always emitted (the binary's own default is channels, not kernel).
  • REST + admin enabled; Postgres store enabled with size-based retention (STORAGE_SIZE).

Notable decisions / fixes

  • .dockerignore: exclude /nimbledeps and /build. A populated host nimbledeps/ leaked into the build context and had its package submodules stripped by **/vendor/*, breaking the in-container make build-deps. Excluding it lets the container resolve deps fresh (context dropped ~4.6 GB → ~370 kB) and also speeds up the existing wakunode2 docker builds.
  • Postgres readiness: node depends_on is gated on postgres: condition: service_healthy to avoid a startup crash-loop on connection-refused.
  • WSS: enabled only when DOMAIN is explicitly set (dropped the reference's reverse-DNS auto-guess, which could deadlock the node waiting for a cert that certbot never issues).
  • Mix: --mix=true is passed explicitly — the logos.dev/logos.test presets set the mix flag but do not mount the mix protocol on their own (also affects wakunode2 --preset=logos.dev; worth a separate issue).
  • Branding: Grafana logos replaced with the official Logos mark; dashboard file named logos-delivery-monitoring.json.
  • Omitted for now (per scope): RLN settings/files, setup_wizard, RLN keystore tooling.

Verification

  • docker compose build produces a working image; binary boots and joins the network.
  • Brought the full stack up on both logos.dev/kernel and logos.test/messaging:
    • node reaches nodeHealth: READY, connects to bootstrap peers, discv5 up, Postgres store migrates.
    • Postgres messages table accumulates live traffic.
    • /admin/v1/peers + libp2p_peers reconcile; Grafana scrape targets up.
    • Messaging REST round-trip (entry-layer=messaging): POST /messaging/v1/messagesrequestId; GET /messaging/v1/events/send/{id} shows propagated+sent; GET /messaging/v1/events/received returns the message — all correlated with send_service.nim log lines by matching requestId/msgHash.

🤖 Generated with Claude Code

Add apps/logos_delivery_node/compose/, a docker-compose project that runs the
logosdeliverynode image (built from the repo Dockerfile) as a service node with
a Postgres store and a Prometheus + Grafana monitoring stack. Ported from
logos-messaging/logos-delivery-compose and adapted for logosdeliverynode:

- Network selection via --preset (default logos.dev) and --entry-layer (default
  kernel), both configurable through PRESET / ENTRY_LAYER env vars.
- Postgres-backed store; node startup gated on the postgres healthcheck to avoid
  a crash-loop on connection-refused.
- WebSocket-Secure via certbot, enabled only when DOMAIN is explicitly set (no
  reverse-DNS auto-guess, which could deadlock the node waiting for a cert).
- --mix=true passed explicitly (the preset alone sets the flag but does not mount
  the mix protocol).
- Grafana branded with the Logos mark; dashboard file named
  logos-delivery-monitoring.json.
- RLN, setup_wizard and RLN keystore tooling intentionally omitted for now.

Also exclude /nimbledeps and /build from the Docker build context: a populated
host nimbledeps/ leaks into the context and has its package submodules stripped
by the **/vendor/* rule, breaking the in-container `make build-deps`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two fixes for the docker-build-ubuntu-22.04 job:

- .dockerignore: drop /build. docker/binaries/Dockerfile.bn.amd64 ADDs the
  freshly compiled binaries from ./build/, so ignoring it makes the docker
  build fail deterministically with '"/build/wakunode2": not found'.
  /nimbledeps stays ignored (that was the actual context-bloat culprit).

- container-image.yml: build wakunode2 and logosdeliverynode in sequential
  make invocations. Under a single `make -j` the two `nimble <task>`
  invocations re-resolve git deps concurrently and clobber each other in
  the shared ~/.nimble/pkgcache. Same fix as ci.yml's -j1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

You can find the images built from this PR at

quay.io/wakuorg/nwaku-pr:4057
quay.io/wakuorg/nwaku-pr:4057-logosdeliverynode

Built from d75f250

@fcecin fcecin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Got Fable 5 to review so maybe this helps:

# Review: PR #4057 — feat(compose): add logosdeliverynode docker-compose stack

**Verdict: LGTM after two small fixes.** The port from logos-delivery-compose is faithful
(most files are byte-identical to the reference), the adaptation in run_node.sh /
docker-compose.yml matches the PR description exactly, and the stack was clearly
live-verified. Two things should be fixed before merge, both quick.

## Must fix

### 1. Dead dashboard panels after the Prometheus job rename

The dashboard JSON is a verbatim copy of the reference `nwaku-monitoring.json`, but this PR
renames the Prometheus scrape job from `nwaku` to `logos-messaging-node` (and thus the
instance label from `nwaku:8003` to `logos-messaging-node:8003`). Two panels still pin the
old names and will show "No data":

- panel **"Start Times (UTC)"**: `process_start_time_seconds{job="nwaku"}`
- panel **"Version"**: `waku_version{instance="nwaku:8003"}`

Fix: search-replace `nwaku` -> `logos-messaging-node` inside
`monitoring/configuration/dashboards/logos-delivery-monitoring.json` (4 occurrences total).
Everything else in the dashboard is either unfiltered or keyed on the `$Instance` template
variable (which is derived from the postgres-exporter job and unaffected).

### 2. Missing `target:` in the compose build

The `build:` block for `logos-messaging-node` has no `target:`, so `docker compose build`
builds the **last** stage of the root Dockerfile — `debug-with-heaptrack`. That means:

- heaptrack is cloned from KDE and compiled with cmake for nothing (extra build time), and
- the network-facing node image ships gdb + heaptrack.

It happens to work only because the compose service overrides `entrypoint: sh` (the stage's
own entrypoint is heaptrack). Add `target: prod` now — or `target: logosdeliverynode` once
PR #4059 (which adds that stage) merges.

## Notes (non-blocking)

- **`.env.example` DOMAIN comment is stale**: it says "Leave empty to auto-detect from
  reverse DNS", but this PR deliberately removed the reverse-DNS auto-guess (run_node.sh
  documents why — the cert-wait deadlock). The README already has the correct wording
  ("empty disables WSS"); align .env.example with it.
- **PR body is stale on `.dockerignore`**: it says "/nimbledeps and /build" are excluded,
  but the follow-up commit correctly kept `/build` in the context (docker/binaries/
  Dockerfile.bn.amd64 ADDs the prebuilt binaries from ./build/). Final state excludes only
  /nimbledeps — worth updating the description.
- The `container-image.yml` serialize commit is byte-identical to the one in PR #4058 —
  merges cleanly in either order, whichever lands second just contributes an empty change.
- Inherited verbatim from the reference repo (fine to leave, listing for awareness):
  - run_certbot.sh defines `EMAIL` but the certbot call hardcodes `--email admin@DOMAIN`;
  - chkhealth.sh passes a stray `GET` argument to curl (works by accident — curl treats it
    as a failing extra URL and the exit status of the last transfer wins);
  - set_storage_retention.sh's sudo check (`[ "$(... | grep -c ...)" ]`) is always true, so
    it uses sudo whenever ./postgresql exists;
  - Grafana runs with anonymous **Admin** on 0.0.0.0:3000 (the README does say so);
  - the certbot service always binds host port 80, even with DOMAIN unset.

@Ivansete-status Ivansete-status left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
I haven't looked at the changes in detail but I like the idea. We might need to deprecata/archive the former docker-compose repo: https://github.com/logos-messaging/logos-delivery-compose.

## Quick start

```bash
cd apps/logos_delivery_node/compose

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is more explicit to use the term docker for that folder's name.

Suggested change
cd apps/logos_delivery_node/compose
cd apps/logos_delivery_node/docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants