From 5f8863ce7755423feaec706ec6fe1be323470c35 Mon Sep 17 00:00:00 2001 From: Derick Phan Date: Thu, 26 Mar 2026 18:44:26 -0700 Subject: [PATCH] Add entrypoint script for configurable Reticulum networking in Docker Replaces static CMD with an entrypoint that generates RNS config from environment variables (RNS_TCP_HOST/PORT), enabling TCP transport for environments without LAN auto-discovery (e.g. Docker on macOS). Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 2 +- app.py | 2 +- docker-compose.yml | 6 ++++++ entrypoint.sh | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 76fcb4e..c80b226 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ RUN mkdir -p /data \ EXPOSE 8080 -CMD ["python", "app.py"] +ENTRYPOINT ["./entrypoint.sh"] diff --git a/app.py b/app.py index 01c4541..2149429 100644 --- a/app.py +++ b/app.py @@ -42,7 +42,7 @@ def start_gateway(reticulum): def main(): init_db() - reticulum = RNS.Reticulum() + reticulum = RNS.Reticulum(configdir=os.environ.get("RNS_CONFIG_DIR")) identity = load_or_create_identity() destination = RNS.Destination( diff --git a/docker-compose.yml b/docker-compose.yml index 99191f2..151a79c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,12 @@ services: volumes: - tinyweb-data:/data restart: unless-stopped + # Connect to another Reticulum instance over TCP. + # Required on macOS (Docker can't do LAN auto-discovery). + # On Linux, auto-discovery works with network_mode: host. + # environment: + # - RNS_TCP_HOST=10.0.0.100 + # - RNS_TCP_PORT=4242 volumes: tinyweb-data: diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..4131973 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Generate Reticulum config with optional TCP peer +# Set RNS_TCP_HOST and RNS_TCP_PORT env vars to connect to a remote instance + +CONFIG_DIR="/data/.reticulum" +CONFIG_FILE="$CONFIG_DIR/config" + +mkdir -p "$CONFIG_DIR" + +if [ ! -f "$CONFIG_FILE" ]; then + cat > "$CONFIG_FILE" <> "$CONFIG_FILE" <