fix: compose passes .env through env_file; clearer name and channel messages [CI]
ci/woodpecker/push/main-amd64-build Pipeline was successful

podman-compose does not substitute defaults inside "environment:" (a value
like ${MOSHIRO_NAME:-} reached the node as the literal text), so the node was
enrolled with an invalid name and reported the wrong network scope. The three
compose files now read .env with env_file and only interpolate image and
network_mode; the Backend .env keys are the container's own names
(MoShiro__PublicUrl, MoShiro__ClaimCode).

- The generated .env no longer carries a comment line for MOSHIRO_NAME; the
  dialog says how to choose a name instead.
- The container entrypoint prints the name it enrolls with and defaults
  MOSHIRO_NETWORK_SCOPE to host (Docker Desktop sets container in .env).
- The overview and line pages say "measurement channel not established"
  instead of "not connected": the agent can be reachable and pingable while
  the measurement TCP/UDP path is not.
This commit is contained in:
justme committed 2026-10-08 20:47:38 +08:00
1 parent 12be44645f
commit bac1c27e72
10 files changed
+27 -31

No files matched your search

+3
View File
@@ -4,6 +4,8 @@
set -eu
role="${MOSHIRO_ROLE:?MOSHIRO_ROLE is set by the image}"
# compose 默认用宿主网络;Docker Desktop(没有宿主网络)的 .env 里写 MOSHIRO_NETWORK_SCOPE=container
export MOSHIRO_NETWORK_SCOPE="${MOSHIRO_NETWORK_SCOPE:-host}"
dir=/etc/moshiro
identity="$dir/$role-id"
config="$dir/$role.json"
@@ -15,6 +17,7 @@ if [ ! -f "$identity/node.json" ]; then
echo "first start: set MOSHIRO_SERVER and MOSHIRO_JOIN in .env (the panel shows the complete content)" >&2
exit 1
fi
echo "enrolling as '$MOSHIRO_NAME' (1-64 letters, digits, . _ - ; set MOSHIRO_NAME in .env to choose another)" >&2
# 每个节点都必须有属主(passkey):信任根指纹和属主缺一个就不注册
if [ -z "${MOSHIRO_GENESIS:-}" ] || [ -z "${MOSHIRO_CONTROLLERS:-}" ]; then
if [ "${MOSHIRO_ALLOW_NO_OWNER:-}" != 1 ]; then