From 7e688c9094f7e4da09d625da11bdedc8e56a31f7 Mon Sep 17 00:00:00 2001 From: Jade Ambrose Date: Mon, 22 Dec 2025 12:37:50 +0000 Subject: [PATCH] feat: support UDP proxy of port 2022 and 2023 for P2Panda apps (#70) # Support P2P communication between P2Panda Apps Apps built with the set of [P2Panda](https://p2panda.org/) libraries perform P2P communication over two UDP ports. The default ports for these are 2022 and 2023. There aren't really a lot (any?) P2Panda web apps out there, most are desktop or mobile apps. So, this change is being specifically request by the [LoRes Tech](https://lores.tech/) project in order to support our [LoRes Node](https://github.com/local-resilience-tech/lores-node/) app. We have a recipe drafted for this [here](https://codeberg.org/lores/lores-node-coop-cloud-recipe) and we will push that to the catalogue once this change is in. It seems better to make this kiwix change as general as possible, which is why we called the flag `P2PANDA_ENABLED` rather than `LORES_NODE_ENABLED`. In practice if there was a larger ecosystem of such apps, we'd probably need to make the actual port numbers configurable. Reviewed-on: https://git.coopcloud.tech/coop-cloud/traefik/pulls/70 Reviewed-by: p4u1 Co-authored-by: Jade Ambrose Co-committed-by: Jade Ambrose --- .drone.yml | 2 +- .env.sample | 4 ++++ abra.sh | 2 +- compose.p2panda.yml | 14 ++++++++++++++ traefik.yml.tmpl | 8 +++++++- 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 compose.p2panda.yml diff --git a/.drone.yml b/.drone.yml index 639af3a..cb77d19 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,7 +16,7 @@ steps: STACK_NAME: traefik LETS_ENCRYPT_ENV: production LETS_ENCRYPT_EMAIL: helo@autonomic.zone - TRAEFIK_YML_VERSION: v22 + TRAEFIK_YML_VERSION: v26 FILE_PROVIDER_YML_VERSION: v10 ENTRYPOINT_VERSION: v4 trigger: diff --git a/.env.sample b/.env.sample index d4544fa..bba7a35 100644 --- a/.env.sample +++ b/.env.sample @@ -131,6 +131,10 @@ COMPOSE_FILE="compose.yml" # COMPOSE_FILE="$COMPOSE_FILE:compose.gitea.yml" # GITEA_SSH_ENABLED=1 +## P2Panda UDP +# COMPOSE_FILE="$COMPOSE_FILE:compose.p2panda.yml" +# P2PANDA_ENABLED=1 + ## Foodsoft SMTP # COMPOSE_FILE="$COMPOSE_FILE:compose.foodsoft.yml" # FOODSOFT_SMTP_ENABLED=1 diff --git a/abra.sh b/abra.sh index ff493b5..faf045b 100644 --- a/abra.sh +++ b/abra.sh @@ -1,3 +1,3 @@ -export TRAEFIK_YML_VERSION=v25 +export TRAEFIK_YML_VERSION=v26 export FILE_PROVIDER_YML_VERSION=v10 export ENTRYPOINT_VERSION=v5 diff --git a/compose.p2panda.yml b/compose.p2panda.yml new file mode 100644 index 0000000..00cecd2 --- /dev/null +++ b/compose.p2panda.yml @@ -0,0 +1,14 @@ +version: "3.8" +services: + app: + environment: + - P2PANDA_ENABLED + ports: + - target: 2022 + published: 2022 + protocol: udp + mode: host + - target: 2023 + published: 2023 + protocol: udp + mode: host \ No newline at end of file diff --git a/traefik.yml.tmpl b/traefik.yml.tmpl index b1ba638..b809384 100644 --- a/traefik.yml.tmpl +++ b/traefik.yml.tmpl @@ -1,7 +1,7 @@ --- core: defaultRuleSyntax: v2 - + log: level: {{ env "LOG_LEVEL" }} maxAge: {{ env "LOG_MAX_AGE" }} @@ -37,6 +37,12 @@ entrypoints: gitea-ssh: address: ":2222" {{ end }} + {{ if eq (env "P2PANDA_ENABLED") "1" }} + p2panda-udp-v4: + address: ":2022/udp" + p2panda-udp-v6: + address: ":2023/udp" + {{ end }} {{ if eq (env "GARAGE_RPC_ENABLED") "1" }} garage-rpc: address: ":3901"