Files
logos-messaging-nim/apps/logos_delivery_node/docker/set_postgres_shm.sh
T
NagyZoltanPeter d3c0979dd5 chore(docker): rename compose folder and fix review follow-ups from #4057 (#4129)
Follow-up to the review of #4057.

- Rename apps/logos_delivery_node/compose -> apps/logos_delivery_node/docker
  (review request); the only path reference was in the folder's own README.
- run_certbot.sh: pass the configured EMAIL to certbot instead of the
  hardcoded admin@$DOMAIN, and forward EMAIL to the certbot container so
  setting it in .env takes effect. Empty still falls back to admin@$DOMAIN.
- set_storage_retention.sh: `grep -c` always prints a count, so the old
  sudo test was always true and sudo was used whenever ./postgresql existed.
  Test readability of the data directory directly instead.
- chkhealth.sh: drop the stray `GET` argument, which curl treated as an
  extra (failing) URL.
- docker-compose.yml: put certbot behind the `wss` profile so it no longer
  publishes host port 80 on deployments that do not use WebSocket-Secure,
  and drop the node's meaningless `depends_on: certbot` (run_node.sh polls
  for the certificate on disk anyway).
2026-08-18 18:03:04 +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