Public Access
feat(home-assistant): add ingress add-on
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
RUN apk add --no-cache jq
|
||||
|
||||
COPY run.sh /run.sh
|
||||
RUN chmod a+x /run.sh
|
||||
|
||||
EXPOSE 8099
|
||||
CMD ["/run.sh"]
|
||||
@@ -0,0 +1,19 @@
|
||||
name: MealPlanner Ingress
|
||||
version: "0.1.0"
|
||||
slug: mealplanner_ingress
|
||||
description: Home Assistant Ingress proxy for an existing MealPlanner deployment.
|
||||
arch:
|
||||
- amd64
|
||||
- aarch64
|
||||
- armv7
|
||||
startup: application
|
||||
boot: auto
|
||||
init: false
|
||||
ingress: true
|
||||
ingress_port: 8099
|
||||
panel_icon: mdi:food-fork-drink
|
||||
panel_title: MealPlanner
|
||||
options:
|
||||
upstream_url: "http://192.168.1.54:8082"
|
||||
schema:
|
||||
upstream_url: str
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
OPTIONS_FILE=/data/options.json
|
||||
UPSTREAM_URL=$(jq -r '.upstream_url // empty' "$OPTIONS_FILE")
|
||||
|
||||
case "$UPSTREAM_URL" in
|
||||
http://*|https://*) ;;
|
||||
*)
|
||||
echo "upstream_url must start with http:// or https://" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
UPSTREAM_URL=${UPSTREAM_URL%/}
|
||||
|
||||
cat > /etc/nginx/conf.d/default.conf <<EOF
|
||||
server {
|
||||
listen 8099;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_pass ${UPSTREAM_URL};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host \$proxy_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-Host \$host;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
proxy_set_header X-Ingress-Path \$http_x_ingress_path;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_redirect off;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
exec nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user