diff --git a/Makefile b/Makefile index 4477741..196c2c3 100644 --- a/Makefile +++ b/Makefile @@ -81,8 +81,12 @@ dev-local: ## Start the local stack at http://app.localhost (also run by the ro DOMAIN=$${DOMAIN:-localhost} ENVIRONMENT=$${ENVIRONMENT:-local} \ $(COMPOSE_LOCAL) up --build -d proxy backend frontend docs mailcatcher +# The host's LAN address is the source of its default route. Without `ip` +# (macOS) it stays empty and the instance keeps calling itself app.$(DOMAIN). dev-lan: ## Same, plus the app on http://:$(APP_PORT) (no DNS needed) + @ip=$$(ip route get 1.1.1.1 2>/dev/null | sed -n 's/.* src \([0-9.]*\).*/\1/p'); \ DOMAIN=$${DOMAIN:-localhost} ENVIRONMENT=$${ENVIRONMENT:-local} APP_PORT=$(APP_PORT) \ + LAN_URL=$${ip:+http://$$ip:$(APP_PORT)} \ $(COMPOSE_LAN) up --build -d proxy backend frontend mailcatcher # The frontend is an nginx image, so a UI change needs a rebuild. Both the diff --git a/docker/compose.lan.yml b/docker/compose.lan.yml index 5b2eba6..0c45626 100644 --- a/docker/compose.lan.yml +++ b/docker/compose.lan.yml @@ -7,6 +7,13 @@ # whole app. services: + backend: + environment: + # The address the instance gives out: the link the Panels dialog shows a + # screen and the one its emails carry. app.${DOMAIN} resolves on this host + # only, so `make dev-lan` passes the published port on the LAN address. + - FRONTEND_HOST=${LAN_URL:-http://app.${DOMAIN:-localhost}} + frontend: ports: !override - "${APP_PORT:-8080}:80" diff --git a/docs/interface/dashboards.md b/docs/interface/dashboards.md index c3a0bb8..9948097 100644 --- a/docs/interface/dashboards.md +++ b/docs/interface/dashboards.md @@ -409,8 +409,8 @@ access. The openpanel firmware, kept in its own repository, draws dashboards as native widgets on an ESP32-P4 wall panel (Waveshare ESP32-P4-WIFI6-Touch-LCD-7B, -1024×600). Once its config page points it at this instance, it shows the -pairing code itself; enter it as in step 4. It reads the same published +1024×600). Once its config page points it at this instance (the dialog's link +works too, the device keeps only its address), it shows the pairing code itself; enter it as in step 4. It reads the same published dashboards and live values and draws every widget type with two exceptions, both shown as a placeholder: a website tile that embeds a page (image tiles work), and a chart of runs, which a panel credential may not read. Media tiles @@ -446,7 +446,8 @@ by the nodes that produce it. !!! note "If the local link is wrong" Pairing links use `FRONTEND_HOST`. Set it to the app address reachable - from the screen's network. + from the screen's network. `make dev-lan` sets it to the published port on + the host's LAN address. ### A screen somewhere you cannot reach