Add internal reverse proxy

This commit is contained in:
fhs52267
2026-03-22 15:47:55 +01:00
parent 74ba68a3a7
commit f6eab3c5cb
4 changed files with 38 additions and 8 deletions

View File

@@ -1,7 +1,9 @@
FROM ghcr.io/yeraze/meshmonitor:latest FROM ghcr.io/yeraze/meshmonitor:latest
USER root USER root
RUN apk add --no-cache jq curl bash RUN apk add --no-cache jq curl bash nginx
COPY nginx.conf /etc/nginx/http.d/default.conf
COPY run.sh /run.sh COPY run.sh /run.sh
RUN chmod a+x /run.sh RUN chmod a+x /run.sh

View File

@@ -1,15 +1,14 @@
name: "MeshMonitor" name: "MeshMonitor"
description: "Meshtastic Monitoring Dashboard" description: "Meshtastic Monitoring Dashboard"
version: "1.0.5" version: "1.0.6"
slug: "meshmonitor" slug: "meshmonitor"
arch: arch:
- aarch64 - aarch64
- amd64 - amd64
# Remove the ingress keys entirely ingress: true
ports: ingress_port: 8099
3001/tcp: 8080 panel_icon: mdi:access-point-network
ports_description: panel_title: "MeshMonitor"
3001/tcp: "Web Interface"
options: options:
MESHTASTIC_NODE_IP: "192.168.1.100" MESHTASTIC_NODE_IP: "192.168.1.100"
MESHTASTIC_TCP_PORT: 4403 MESHTASTIC_TCP_PORT: 4403

16
meshmonitor/nginx.conf Normal file
View File

@@ -0,0 +1,16 @@
server {
listen 8099;
location / {
# Reconstruct the full path expected by the app's BASE_URL
proxy_pass http://127.0.0.1:3001$http_x_ingress_path$request_uri;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

View File

@@ -8,7 +8,20 @@ export DISABLE_ANONYMOUS=$(jq --raw-output '.DISABLE_ANONYMOUS' $CONFIG_PATH)
export DATABASE_PATH="/data/meshmonitor.db" export DATABASE_PATH="/data/meshmonitor.db"
export PORT=3001 export PORT=3001
export TRUST_PROXY=true
export ALLOWED_ORIGINS="*" export ALLOWED_ORIGINS="*"
export COOKIE_SECURE=false
echo "Starting MeshMonitor for node: $MESHTASTIC_NODE_IP..." # Fetch Ingress URL so the Node app knows its subpath
if [ -n "$SUPERVISOR_TOKEN" ]; then
RAW_URL=$(curl -s -H "Authorization: Bearer ${SUPERVISOR_TOKEN}" http://supervisor/addons/self/info | jq --raw-output '.data.ingress_url')
export BASE_URL="${RAW_URL%/}"
echo "Configuring MeshMonitor BASE_URL to: $BASE_URL"
fi
# Start Nginx in the background
mkdir -p /run/nginx
nginx
echo "Starting MeshMonitor..."
exec node dist/server/server.js exec node dist/server/server.js