k8s: REGION in config.env; the no-public-address warning names --announce
REGION (place names or geohashes, comma separated) is passed to the node by the StatefulSet script, which now builds its arguments with set -- so a region is optional and PUBLIC_HOST must be set. The warning for a --public node without a public address now says which case it is (no --announce, or one that is not reachable) and the flag that fixes it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
+17
-3
@@ -37,7 +37,8 @@ so:
|
||||
docker build -t git.stinnesbeck.com/nils/allmende:<tag> . && docker push git.stinnesbeck.com/nils/allmende:<tag>
|
||||
```
|
||||
2. **Name.** Edit `base/config.env` (`PUBLIC_HOST`, and `PUBLIC_PORT` if the
|
||||
router cannot forward 4001 to 4001).
|
||||
router cannot forward 4001 to 4001; `REGION` if the node should keep
|
||||
listings for a region).
|
||||
3. **Apply.**
|
||||
```
|
||||
kubectl apply -k k8s/base # with a LoadBalancer (MetalLB, kube-vip, ...)
|
||||
@@ -85,8 +86,21 @@ so:
|
||||
that file). The same port serves the owner API, which the admin token
|
||||
protects. To keep it private, comment the file out in `base/kustomization.yaml`
|
||||
and use `kubectl -n allmende port-forward svc/allmende-http 8080:8080`.
|
||||
- **Regions.** A bootstrap node follows none. To make it also keep listings,
|
||||
open the UI through the port-forward, sign in and choose regions.
|
||||
- **Regions.** A bootstrap node follows none by default. To make it also keep
|
||||
listings, either set `REGION` in `base/config.env` (a place name or a
|
||||
3-character geohash, several separated by commas: `REGION=mechernich`) and
|
||||
apply again, or open the UI through the port-forward, sign in and choose
|
||||
regions there. A choice made in the browser is kept on the volume and wins
|
||||
over `REGION` from then on; delete `/data/regions.json` to use `REGION`
|
||||
again. Do not edit the `args` script in `statefulset.yaml` for this: a missing
|
||||
trailing `\` there silently drops `--announce` (see below).
|
||||
- **"--public, but this node has no public address" in the log** means the node
|
||||
runs without `--announce`, so it only knows the pod's private address and
|
||||
advertises that. Check that the live StatefulSet's `args` still contain both
|
||||
`--announce` lines and that every line of the `set --` command but the last
|
||||
ends in `\` (`kubectl -n allmende get statefulset allmende -o yaml`). The
|
||||
warning says which case it is: no `--announce` at all, or one that is not
|
||||
publicly reachable. An empty `PUBLIC_HOST` stops the pod with an error instead.
|
||||
- **More than one bootstrap node** on different networks makes the network
|
||||
independent of any single one. Run this on a second cluster or a VPS and add
|
||||
its records next to the first.
|
||||
|
||||
@@ -6,3 +6,12 @@ PUBLIC_HOST=bootstrap.allmende.stinnesbeck.com
|
||||
# The port your router forwards to the cluster, as seen from the internet
|
||||
# (TCP and UDP). Keep it 4001 unless the router cannot forward it.
|
||||
PUBLIC_PORT=4001
|
||||
|
||||
# The regions this node keeps listings for: a place name or a 3-character
|
||||
# geohash, several separated by commas (REGION=mechernich or REGION=u1h,u0u).
|
||||
# Empty (the default) follows none: it then only helps others connect.
|
||||
# It is the starting value: once the owner chooses regions in the browser, those
|
||||
# are kept on the volume and win over this (delete /data/regions.json to use
|
||||
# this again). Changing this file restarts the pod, because the ConfigMap name
|
||||
# changes with its content.
|
||||
REGION=
|
||||
|
||||
@@ -34,13 +34,19 @@ spec:
|
||||
# bootstrap node has nothing to recover; its identity is its peer ID,
|
||||
# which lives on the volume). Then run as a bootstrap node: --public
|
||||
# serves the DHT and relays for nodes behind a NAT, --announce names
|
||||
# the address the router forwards.
|
||||
# the address the router forwards, and REGION (config.env) the regions
|
||||
# to keep listings for, if any.
|
||||
#
|
||||
# When you edit this script: every line of the `set --` command but
|
||||
# the last ends in a backslash. A missing one cuts the command short
|
||||
# and silently drops the flags below it (--announce above all); the
|
||||
# node then logs "--public, but this node has no public address".
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- |
|
||||
: "${PUBLIC_HOST:?set PUBLIC_HOST in k8s/base/config.env}"
|
||||
[ -f /data/admin.token ] || allmende init --no-phrase
|
||||
exec allmende run \
|
||||
--public \
|
||||
set -- --public \
|
||||
--no-default-bootstrap \
|
||||
--no-mdns \
|
||||
--no-login-link \
|
||||
@@ -49,6 +55,12 @@ spec:
|
||||
--listen /ip4/0.0.0.0/udp/4001/quic-v1 \
|
||||
--announce "/dns4/${PUBLIC_HOST}/tcp/${PUBLIC_PORT}" \
|
||||
--announce "/dns4/${PUBLIC_HOST}/udp/${PUBLIC_PORT}/quic-v1"
|
||||
if [ -n "${REGION}" ]; then
|
||||
set -f; IFS=,
|
||||
for r in ${REGION}; do set -- "$@" --region "$r"; done
|
||||
unset IFS; set +f
|
||||
fi
|
||||
exec allmende run "$@"
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: allmende-config
|
||||
|
||||
Reference in New Issue
Block a user