diff --git a/tandoor_recipes/CHANGELOG.md b/tandoor_recipes/CHANGELOG.md index 2b9cb22c2..e404d38b2 100644 --- a/tandoor_recipes/CHANGELOG.md +++ b/tandoor_recipes/CHANGELOG.md @@ -1,33 +1,44 @@ +- Ingress addition ## 1.3.3 (04-08-2022) + - Update to latest version from TandoorRecipes/recipes - Align armv7 with latest ## 1.3.2 (14-07-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.3.0 (09-07-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.2.7 (26-05-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.2.6 (19-05-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.2.5 (12-05-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.2.4 (07-05-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.2.3 (05-05-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.2.1 (01-05-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.2.0 (01-05-2022) + - Update to latest version from TandoorRecipes/recipes - Add codenotary sign diff --git a/tandoor_recipes/config.json b/tandoor_recipes/config.json index 3ec098140..f1d7c09f9 100644 --- a/tandoor_recipes/config.json +++ b/tandoor_recipes/config.json @@ -6,9 +6,10 @@ ], "codenotary": "alexandrep.github@gmail.com", "description": "recipe manager", + "ingress": true, "environment": { "DB_ENGINE": "django.db.backends.sqlite3", - "DEBUG": "0", + "DEBUG": "1", "POSTGRES_DB": "/config/addons_config/tandoor_recipes/recipes.db" }, "map": [ @@ -21,6 +22,7 @@ "SECRET_KEY": "YOUR_SECRET_KEY" }, "panel_icon": "mdi:silverware-fork-knife", + "panel_title": "Tandoor Recipes", "ports": { "8080/tcp": 9928 }, @@ -42,6 +44,6 @@ ], "slug": "tandoor_recipes", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "1.3.3", + "version": "1.3.3-v2", "webui": "[PROTO:ssl]://[HOST]:[PORT:8080]" -} +} \ No newline at end of file diff --git a/tandoor_recipes/rootfs/etc/cont-init.d/32-ingress.sh b/tandoor_recipes/rootfs/etc/cont-init.d/32-ingress.sh index 01ea61ff5..f181b00ca 100644 --- a/tandoor_recipes/rootfs/etc/cont-init.d/32-ingress.sh +++ b/tandoor_recipes/rootfs/etc/cont-init.d/32-ingress.sh @@ -1,6 +1,5 @@ #!/usr/bin/bashio # shellcheck shell=bash -exit 0 ################# # NGINX SETTING # diff --git a/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh b/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh index 16905fd3f..b200cf5ff 100644 --- a/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh +++ b/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh @@ -13,12 +13,7 @@ export SECRET_KEY=$(bashio::config 'SECRET_KEY') && bashio::log.blue "SECRET_KEY # Allow ingress # ################# -#bashio::log.info "Setting ingress" -#ingress_entry="$(bashio::addon.ingress_entry)" -#export SCRIPT_NAME="$ingress_entry" -#export JS_REVERSE_SCRIPT_PREFIX="${ingress_entry}/" -#export STATIC_URL="${ingress_entry}/static/" -#export MEDIA_URL="${ingress_entry}/media/" +sed -i "s|href=\"{% base_path request \'base\' %}\"|href=\"{% base_path request \'base\' %}/\"|g" /opt/recipes/cookbook/templates/base.html ################### # Define database # @@ -93,8 +88,8 @@ chmod 755 /data/recipes/staticfiles ln -s /config/addons_config/tandoor_recipes/mediafiles /opt/recipes ln -s /data/recipes/staticfiles /opt/recipes -#bashio::log.info "Launching nginx" -#exec nginx & echo "done" +bashio::log.info "Launching nginx" +exec nginx & echo "done" bashio::log.info "Launching app" cd /opt/recipes || exit diff --git a/tandoor_recipes/rootfs/etc/nginx/includes/server_params.conf b/tandoor_recipes/rootfs/etc/nginx/includes/server_params.conf index 09c06543e..a0ff6baa0 100644 --- a/tandoor_recipes/rootfs/etc/nginx/includes/server_params.conf +++ b/tandoor_recipes/rootfs/etc/nginx/includes/server_params.conf @@ -1,4 +1,3 @@ -root /dev/null; server_name $hostname; add_header X-Content-Type-Options nosniff; diff --git a/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf b/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf index a34a3cf16..4c10f6fdb 100644 --- a/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf +++ b/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf @@ -4,67 +4,31 @@ server { include /etc/nginx/includes/proxy_params.conf; client_max_body_size 0; + root /opt/recipes/cookbook; + location / { - # Security - ###################### - allow 172.30.32.2; - deny all; - proxy_hide_header "X-Content-Type-Options"; + proxy_pass http://127.0.0.1:8080; + proxy_buffering off; + proxy_read_timeout 30; + proxy_set_header Connection "Upgrade"; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $http_host; # try $host instead if this doesn't work + proxy_set_header X-Forwarded-Proto $scheme; # http or https + + # Allow ingress subpath + proxy_set_header X-Script-Name %%ingress_entry%%; + proxy_cookie_path / %%ingress_entry%%/; - # Base - ###################### - #proxy_bind $server_addr; - proxy_pass http://127.0.0.1:8080; - proxy_set_header Connection "Upgrade"; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Host $http_host; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - proxy_read_timeout 30; + # Rewrite url + sub_filter_once off; + sub_filter_types *; + sub_filter "/static" "%%ingress_entry%%/static"; + sub_filter "/media" "%%ingress_entry%%/media"; - # Avoid mixed contents - ###################### - if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") - { - set $x_scheme $1; - set $x_host $2; - set $x_port ":$3"; + # Allow frames + proxy_hide_header "Content-Security-Policy"; + add_header X-Frame-Options SAMEORIGIN; + add_header Access-Control-Allow-Origin *; + proxy_set_header Accept-Encoding ""; } - if ($http_referer ~* "^(http[s]?)://([^:]+)(/.*)$") - { - set $x_scheme $1; - set $x_host $2; - set $x_port ""; - } - proxy_set_header X-Scheme $x_scheme; - proxy_redirect http://$host/ $x_scheme://$x_host$x_port/; - proxy_redirect $x_scheme://$host/ $x_scheme://$x_host$x_port/; - - # Allow subpath - ###################### - proxy_set_header X-Script-Name %%ingress_entry%%; - proxy_cookie_path / %%ingress_entry%%/; - - # Allow iframe - ###################### - proxy_hide_header "Content-Security-Policy"; - proxy_hide_header X-Frame-Options; - add_header Access-Control-Allow-Origin *; - proxy_set_header Accept-Encoding ""; - - # Rewrite url - ###################### - sub_filter_once off; - sub_filter_types *; - sub_filter "/static" "%%ingress_entry%%/static"; - sub_filter "/media" "%%ingress_entry%%/media"; - sub_filter "/view" "%%ingress_entry%%/view"; - sub_filter "/search" "%%ingress_entry%%/search"; - sub_filter "/edit" "%%ingress_entry%%/edit"; - #sub_filter "%%ingress_entry%%/%%ingress_entry%%/" "/"; - #sub_filter "/api" "%%ingress_entry%%/api"; - #sub_filter "%%ingress_entry%%/api/hassio" "/api/hassio"; - - } - }