Add reverse proxy to make LuCI available at host when veth is used.

This commit is contained in:
Albrecht Lohofener
2024-03-20 21:56:43 +01:00
parent 1f5e832595
commit 198e350494
5 changed files with 20 additions and 2 deletions
+1
View File
@@ -17,6 +17,7 @@ RUN apk add --no-cache \
py3-pip \
py3-virtualenv \
uuidgen \
caddy \
&& mkdir -p /usr/share/novnc \
&& wget https://github.com/novnc/noVNC/archive/refs/tags/v${NOVNC_VERSION}.tar.gz -O /tmp/novnc.tar.gz -q \
&& tar -xf /tmp/novnc.tar.gz -C /tmp/ \
+2 -1
View File
@@ -14,7 +14,8 @@ services:
# Define which physical or virtual interfaces shall be attach direct to OpenWrt
#WAN_IF: "enx00e04c0407a6"
#LAN_IF: "enx00e04d68033f"
LAN_IF: "veth" # veth pair between OpenWrt and host system
#LAN_IF: "veth" # veth pair between OpenWrt and host system
#FORWARD_LUCI: "true" # Make LuCI OpenWrt web interface accessible via host LAN
# USB passthrough
# Format <vendorID>:<productID> like 'lsusb' is given
+1
View File
@@ -13,5 +13,6 @@ trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR
: "${LAN_IF:=""}" # Physical LAN interface name
: "${USB_VID_1:=""}" # USB vendor ID
: "${USB_PID_1:=""}" # USB product ID
: "${FORWARD_LUCI:=""}" # Make LuCI OpenWrt web interface accessible via host LAN
: "${IS_U_OS_APP:=""}" # By default this container is not a u-OS app
: "${DEBUG:="N"}" # Disable debugging
+10
View File
@@ -57,3 +57,13 @@ supervisorctl start nginx # Start webserver
# ******* OpenWrt handling *******
supervisorctl start openwrt # Start openwrt
# ******* LuCi forwarding handling *******
if [[ $FORWARD_LUCI = "true" ]]; then
if [[ $LAN_IF = "veth" ]]; then
info "Enable LuCI forwading to host LAN at port 9000"
supervisorctl start caddy # Start reverse proxy
else
error "LuCI forwading is only available if enviroment variable is set to LAN_IF: 'veth'"
fi
fi
+6 -1
View File
@@ -41,4 +41,9 @@ stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopasgroup=true
stopasgroup=true
[program:caddy]
command=nsenter --target 1 --uts --net --ipc caddy reverse-proxy --from :9000 --to 192.168.1.1:80
process_name=%(program_name)s
autostart=false