Files
logos-messaging-nim/apps/logos_delivery_node/compose/set_postgres_shm.sh
NagyZoltanPeterandClaude Opus 4.8 0d433ea83f feat(compose): add logosdeliverynode docker-compose stack (#4057)
* feat(compose): add logosdeliverynode docker-compose stack

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>

* fix(ci): keep build/ in docker context; serialize container-image builds

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>

* Review fixes: dashboard typo, missing target for docker build, env.example adjustment
2026-08-14 03:14:40 +02:00

29 lines
711 B
Bash
Executable File

#!/bin/sh
# check if POSTGRES_SHM is already specified
if [ -f "./.env" ]; then
. ./.env
fi
if [ -n "$POSTGRES_SHM" ]; then
>&2 echo "POSTGRES_SHM is specified in .env file, doing nothing"
exit 0
fi
# Set PostgreSQL container Shared Memory value
TOTAL_MEM_MB=$(free -m|grep Mem| awk '{ print $2 }')
if [ "${TOTAL_MEM_MB}" -ge 4096 ]; then
# Allocate 2GB of Shared Memory for Postgres if machine has more than 4GB RAM
POSTGRES_SHM='2g'
else
# Allocate 1GB of Shared Memory for Postgres
POSTGRES_SHM='1g'
fi
>&2 echo "Setting PostgreSQL container SHM to ${POSTGRES_SHM}"
if [ "$1" = "echo-value" ]; then
echo ${POSTGRES_SHM}
else
echo "POSTGRES_SHM=${POSTGRES_SHM}" >> .env
fi