mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-03-03 16:00:29 +01:00
Test ingress
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
"WORKERS_PER_CORE": "0.5"
|
||||
},
|
||||
"image": "ghcr.io/alexbelgium/mealie-{arch}",
|
||||
"ingress": true,
|
||||
"map": [
|
||||
"config:rw",
|
||||
"share:rw",
|
||||
@@ -81,6 +82,7 @@
|
||||
"name": "Mealie",
|
||||
"options": {
|
||||
"ALLOW_SIGNUP": true,
|
||||
"BASE_SUBPATH": "/mealie",
|
||||
"DATA_DIR": "/config/addons_config/mealie_data",
|
||||
"PGID": 1000,
|
||||
"PUID": 1000,
|
||||
@@ -99,6 +101,7 @@
|
||||
"schema": {
|
||||
"ALLOW_SIGNUP": "bool",
|
||||
"BASE_URL": "str?",
|
||||
"BASE_SUBPATH": "str?",
|
||||
"DATA_DIR": "str?",
|
||||
"PGID": "int",
|
||||
"PUID": "int",
|
||||
@@ -109,6 +112,6 @@
|
||||
"slug": "mealie",
|
||||
"udev": true,
|
||||
"url": "https://github.com/alexbelgium/hassio-addons",
|
||||
"version": "v2.0-beta",
|
||||
"version": "v2.0-beta_ingress_test",
|
||||
"webui": "[PROTO:ssl]://[HOST]:[PORT:9001]"
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ set -e
|
||||
|
||||
if bashio::config.true 'ssl'; then
|
||||
|
||||
bashio::log.info "Add ssl"
|
||||
|
||||
# Validate ssl
|
||||
bashio::config.require.ssl
|
||||
|
||||
@@ -19,3 +21,12 @@ else
|
||||
sed -i "/ssl/d" /etc/nginx/servers/ssl.conf
|
||||
|
||||
fi
|
||||
|
||||
bashio::log.info "Adapting for ingress"
|
||||
|
||||
ingress_port=$(bashio::addon.ingress_port)
|
||||
ingress_interface=$(bashio::addon.ip_address)
|
||||
base_path="$(bashio::config 'BASE_SUBPATH')"
|
||||
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s/%%BASE_SUBPATH%%/${base_path}/g" /etc/nginx/servers/ingress.conf
|
||||
|
||||
40
mealie/rootfs/etc/nginx/servers/ingress.conf
Normal file
40
mealie/rootfs/etc/nginx/servers/ingress.conf
Normal file
@@ -0,0 +1,40 @@
|
||||
server {
|
||||
listen %%interface%%:%%port%% default_server;
|
||||
include /etc/nginx/includes/server_params.conf;
|
||||
include /etc/nginx/includes/proxy_params.conf;
|
||||
|
||||
# https://emby.media/community/index.php?/topic/104238-playback-error-no-compatible-streams-are-currently-available/&do=findComment&comment=1097946
|
||||
proxy_buffering off;
|
||||
gzip_static off;
|
||||
client_max_body_size 0;
|
||||
|
||||
location / {
|
||||
# Proxy pass
|
||||
proxy_pass http://localhost:9000;
|
||||
|
||||
# Next three lines allow websockets
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Improve ip handling
|
||||
proxy_hide_header X-Powered-By;
|
||||
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;
|
||||
proxy_set_header Accept-Encoding "";
|
||||
proxy_read_timeout 90;
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header 'Referrer-Policy' 'no-referrer';
|
||||
}
|
||||
|
||||
# Correct base_url
|
||||
absolute_redirect off;
|
||||
proxy_redirect / %%ingress_entry%%/;
|
||||
proxy_set_header Accept-Encoding "";
|
||||
sub_filter_once off;
|
||||
sub_filter_types *;
|
||||
sub_filter %%BASE_SUBPATH%%/ %%ingress_entry%%/;
|
||||
sub_filter 'href="/"' 'href="%%ingress_entry%%/"';
|
||||
sub_filter '"\/"' '"%%ingress_entry%%\/"';
|
||||
}
|
||||
Reference in New Issue
Block a user