diff --git a/tandoor_recipes/CHANGELOG.md b/tandoor_recipes/CHANGELOG.md index 9ab449123..5fa51492c 100644 --- a/tandoor_recipes/CHANGELOG.md +++ b/tandoor_recipes/CHANGELOG.md @@ -1,19 +1,25 @@ +- Readd Ingress feature - WARNING : update to supervisor 2022.11 before installing ## 1.4.5 (11-11-2022) + - Update to latest version from TandoorRecipes/recipes - Ingress broken due to "spaces" feature, dev ongoing ## 1.4.4 (01-10-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.4.3 (28-09-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.4.2 (24-09-2022) + - Update to latest version from TandoorRecipes/recipes ## 1.4.1 (22-09-2022) + - Update to latest version from TandoorRecipes/recipes - Allow nabucasa url - Ingress addition diff --git a/tandoor_recipes/Dockerfile b/tandoor_recipes/Dockerfile index 8a506468e..76c8c38e0 100644 --- a/tandoor_recipes/Dockerfile +++ b/tandoor_recipes/Dockerfile @@ -27,7 +27,6 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \ S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ S6_SERVICES_GRACETIME=0 - ################## # 3 Install apps # ################## @@ -41,7 +40,7 @@ RUN if [ -d /etc/cont-init.d ]; then chmod -R 755 /etc/cont-init.d; fi && \ if [ -f /entrypoint.sh ]; then chmod 755 /entrypoint.sh; fi # Modules -ARG MODULES="00-banner.sh" +ARG MODULES="00-banner.sh 01-custom_script.sh" # Automatic modules download RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \ @@ -52,7 +51,7 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get && chmod -R 755 /etc/cont-init.d # Manual apps -ENV PACKAGES="nginx" +ENV PACKAGES="nginx mysql-client" # Automatic apps & bashio # hadolint ignore=SC2015 @@ -62,7 +61,6 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get && chmod 777 /automatic_packages.sh \ && eval /./automatic_packages.sh "${PACKAGES:-}" \ && rm /automatic_packages.sh - ################ # 4 Entrypoint # ################ diff --git a/tandoor_recipes/config.json b/tandoor_recipes/config.json index b95dc42bd..350df1bb1 100644 --- a/tandoor_recipes/config.json +++ b/tandoor_recipes/config.json @@ -13,6 +13,7 @@ "TRUSTED_PROXIES": "**" }, "image": "ghcr.io/alexbelgium/tandoor_recipes-{arch}", + "ingress": true, "map": [ "config:rw" ], @@ -45,5 +46,5 @@ ], "slug": "tandoor_recipes", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "1.4.5" -} + "version": "1.4.5-2" +} \ 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 79a0f8ca9..f181b00ca 100755 --- a/tandoor_recipes/rootfs/etc/cont-init.d/32-ingress.sh +++ b/tandoor_recipes/rootfs/etc/cont-init.d/32-ingress.sh @@ -1,18 +1,6 @@ #!/usr/bin/bashio # shellcheck shell=bash -rm /etc/nginx/servers/ingress.conf -exit 0 - -######## -# TEST # -######## -if [ -f /config/tandoortest.sh ]; then - echo "running test file" - chmod +x /config/tandoortest.sh - /./config/tandoortest.sh -fi - ################# # 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 e2726028c..af5f290e9 100755 --- a/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh +++ b/tandoor_recipes/rootfs/etc/cont-init.d/99-run.sh @@ -16,12 +16,13 @@ for element in ${ALLOWED_HOSTS//,/ }; do # Separate comma separated values CSRF_TRUSTED_ORIGINS="http://$element,https://$element,$CSRF_TRUSTED_ORIGINS" done export CSRF_TRUSTED_ORIGINS +export ALLOWED_HOSTS="*" ################# # Allow ingress # ################# -sed -i "s|href=\"{% base_path request \'base\' %}\"|href=\"{% base_path request \'base\' %}/\"|g" /opt/recipes/cookbook/templates/base.html +#sed -i "s|href=\"{% base_path request \'base\' %}\"|href=\"{% base_path request \'base\' %}/\"|g" /opt/recipes/cookbook/templates/base.html ################### # Define database # @@ -71,6 +72,13 @@ case $(bashio::config 'DB_TYPE') in bashio::log.warning "This addon is using the Maria DB addon" bashio::log.warning "Please ensure this is included in your backups" bashio::log.warning "Uninstalling the MariaDB addon will remove any data" + + bashio::log.info "Creating database if required" + + mysql \ + -u "${POSTGRES_USER}" -p"${POSTGRES_PASSWORD}" \ + -h "${POSTGRES_HOST}" -P "${POSTGRES_PORT}" \ + -e "CREATE DATABASE IF NOT EXISTS \`${POSTGRES_DB}\` ;" ;; postgresql_external) diff --git a/tandoor_recipes/rootfs/etc/nginx/includes/proxy_params.conf b/tandoor_recipes/rootfs/etc/nginx/includes/proxy_params.conf index 28c65a0a8..c64000920 100644 --- a/tandoor_recipes/rootfs/etc/nginx/includes/proxy_params.conf +++ b/tandoor_recipes/rootfs/etc/nginx/includes/proxy_params.conf @@ -5,6 +5,7 @@ proxy_redirect off; proxy_send_timeout 86400s; proxy_max_temp_file_size 0; +proxy_set_header Host $http_host; proxy_set_header Accept-Encoding ""; proxy_set_header Connection $connection_upgrade; proxy_set_header Upgrade $http_upgrade; diff --git a/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf b/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf index 74ce5028c..97a8b9429 100644 --- a/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf +++ b/tandoor_recipes/rootfs/etc/nginx/servers/ingress.conf @@ -6,15 +6,28 @@ server { root /opt/recipes/cookbook; - location /switch-space { - proxy_pass http://127.0.0.1:8080/switch-space; - proxy_set_header Host $http_host; - proxy_buffering off; - proxy_read_timeout 30; - proxy_set_header Connection "Upgrade"; - proxy_set_header Upgrade $http_upgrade; - - } +location /switch-space/ { + proxy_pass http://127.0.0.1:8080/switch-space/; + + proxy_redirect "/" "%%ingress_entry%%/"; + + # Allow ingress subpath + #proxy_set_header X-Script-Name %%ingress_entry%%; + proxy_cookie_path / %%ingress_entry%%/; + + # Allow frames + add_header X-Frame-Options SAMEORIGIN; + add_header Access-Control-Allow-Origin *; + proxy_set_header Accept-Encoding ""; + + absolute_redirect off; + sub_filter_once off; + sub_filter_types *; + + sub_filter "/static" "%%ingress_entry%%/static"; + sub_filter "/media" "%%ingress_entry%%/media"; + sub_filter "http://127.0.0.1:8080/" "/"; +} location / { proxy_pass http://127.0.0.1:8080; @@ -22,7 +35,7 @@ server { proxy_read_timeout 30; proxy_set_header Connection "Upgrade"; proxy_set_header Upgrade $http_upgrade; - + # Allow ingress subpath proxy_set_header X-Script-Name %%ingress_entry%%; proxy_cookie_path / %%ingress_entry%%/; @@ -32,7 +45,7 @@ server { add_header X-Frame-Options SAMEORIGIN; # Required for ingress frame add_header Access-Control-Allow-Origin *; proxy_set_header Accept-Encoding ""; - + # avoid mixed content # Ensure work with both http and https (code by @met67) if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") { @@ -51,7 +64,7 @@ server { proxy_set_header X-Port $x_port; proxy_set_header X-Forwarded-Proto $x_scheme; - proxy_set_header Host $host$x_port; # Required for addresses without ports + proxy_set_header Host $x_host$x_port; # Required for addresses without ports # Correct url without port when using https sub_filter_once off; @@ -60,7 +73,16 @@ server { sub_filter http://$x_host/ http://$x_host$x_port/; # Rewrite url - sub_filter "/static/" "%%ingress_entry%%/static/"; - sub_filter "/media/" "%%ingress_entry%%/media/"; + sub_filter "/static" "%%ingress_entry%%/static"; + sub_filter "/media" "%%ingress_entry%%/media"; } + +location /media/ { + alias /config/addons_config/tandoor_recipes/mediafiles/; + } + +location /static/ { + alias /data/recipes/staticfiles/; + } + }