This commit is contained in:
Alexandre
2022-12-20 13:45:19 +01:00
parent 521863bb33
commit 7d5a54f577
7 changed files with 57 additions and 33 deletions

View File

@@ -1,19 +1,25 @@
- Readd Ingress feature
- WARNING : update to supervisor 2022.11 before installing - WARNING : update to supervisor 2022.11 before installing
## 1.4.5 (11-11-2022) ## 1.4.5 (11-11-2022)
- Update to latest version from TandoorRecipes/recipes - Update to latest version from TandoorRecipes/recipes
- Ingress broken due to "spaces" feature, dev ongoing - Ingress broken due to "spaces" feature, dev ongoing
## 1.4.4 (01-10-2022) ## 1.4.4 (01-10-2022)
- Update to latest version from TandoorRecipes/recipes - Update to latest version from TandoorRecipes/recipes
## 1.4.3 (28-09-2022) ## 1.4.3 (28-09-2022)
- Update to latest version from TandoorRecipes/recipes - Update to latest version from TandoorRecipes/recipes
## 1.4.2 (24-09-2022) ## 1.4.2 (24-09-2022)
- Update to latest version from TandoorRecipes/recipes - Update to latest version from TandoorRecipes/recipes
## 1.4.1 (22-09-2022) ## 1.4.1 (22-09-2022)
- Update to latest version from TandoorRecipes/recipes - Update to latest version from TandoorRecipes/recipes
- Allow nabucasa url - Allow nabucasa url
- Ingress addition - Ingress addition

View File

@@ -27,7 +27,6 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
S6_SERVICES_GRACETIME=0 S6_SERVICES_GRACETIME=0
################## ##################
# 3 Install apps # # 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 if [ -f /entrypoint.sh ]; then chmod 755 /entrypoint.sh; fi
# Modules # Modules
ARG MODULES="00-banner.sh" ARG MODULES="00-banner.sh 01-custom_script.sh"
# Automatic modules download # 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 \ 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 && chmod -R 755 /etc/cont-init.d
# Manual apps # Manual apps
ENV PACKAGES="nginx" ENV PACKAGES="nginx mysql-client"
# Automatic apps & bashio # Automatic apps & bashio
# hadolint ignore=SC2015 # 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 \ && chmod 777 /automatic_packages.sh \
&& eval /./automatic_packages.sh "${PACKAGES:-}" \ && eval /./automatic_packages.sh "${PACKAGES:-}" \
&& rm /automatic_packages.sh && rm /automatic_packages.sh
################ ################
# 4 Entrypoint # # 4 Entrypoint #
################ ################

View File

@@ -13,6 +13,7 @@
"TRUSTED_PROXIES": "**" "TRUSTED_PROXIES": "**"
}, },
"image": "ghcr.io/alexbelgium/tandoor_recipes-{arch}", "image": "ghcr.io/alexbelgium/tandoor_recipes-{arch}",
"ingress": true,
"map": [ "map": [
"config:rw" "config:rw"
], ],
@@ -45,5 +46,5 @@
], ],
"slug": "tandoor_recipes", "slug": "tandoor_recipes",
"url": "https://github.com/alexbelgium/hassio-addons", "url": "https://github.com/alexbelgium/hassio-addons",
"version": "1.4.5" "version": "1.4.5-2"
} }

View File

@@ -1,18 +1,6 @@
#!/usr/bin/bashio #!/usr/bin/bashio
# shellcheck shell=bash # 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 # # NGINX SETTING #
################# #################

View File

@@ -16,12 +16,13 @@ for element in ${ALLOWED_HOSTS//,/ }; do # Separate comma separated values
CSRF_TRUSTED_ORIGINS="http://$element,https://$element,$CSRF_TRUSTED_ORIGINS" CSRF_TRUSTED_ORIGINS="http://$element,https://$element,$CSRF_TRUSTED_ORIGINS"
done done
export CSRF_TRUSTED_ORIGINS export CSRF_TRUSTED_ORIGINS
export ALLOWED_HOSTS="*"
################# #################
# Allow ingress # # 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 # # 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 "This addon is using the Maria DB addon"
bashio::log.warning "Please ensure this is included in your backups" bashio::log.warning "Please ensure this is included in your backups"
bashio::log.warning "Uninstalling the MariaDB addon will remove any data" 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) postgresql_external)

View File

@@ -5,6 +5,7 @@ proxy_redirect off;
proxy_send_timeout 86400s; proxy_send_timeout 86400s;
proxy_max_temp_file_size 0; proxy_max_temp_file_size 0;
proxy_set_header Host $http_host;
proxy_set_header Accept-Encoding ""; proxy_set_header Accept-Encoding "";
proxy_set_header Connection $connection_upgrade; proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;

View File

@@ -6,15 +6,28 @@ server {
root /opt/recipes/cookbook; root /opt/recipes/cookbook;
location /switch-space { location /switch-space/ {
proxy_pass http://127.0.0.1:8080/switch-space; proxy_pass http://127.0.0.1:8080/switch-space/;
proxy_set_header Host $http_host;
proxy_buffering off; proxy_redirect "/" "%%ingress_entry%%/";
proxy_read_timeout 30;
proxy_set_header Connection "Upgrade"; # Allow ingress subpath
proxy_set_header Upgrade $http_upgrade; #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 / { location / {
proxy_pass http://127.0.0.1:8080; proxy_pass http://127.0.0.1:8080;
@@ -22,7 +35,7 @@ server {
proxy_read_timeout 30; proxy_read_timeout 30;
proxy_set_header Connection "Upgrade"; proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
# Allow ingress subpath # Allow ingress subpath
proxy_set_header X-Script-Name %%ingress_entry%%; proxy_set_header X-Script-Name %%ingress_entry%%;
proxy_cookie_path / %%ingress_entry%%/; proxy_cookie_path / %%ingress_entry%%/;
@@ -32,7 +45,7 @@ server {
add_header X-Frame-Options SAMEORIGIN; # Required for ingress frame add_header X-Frame-Options SAMEORIGIN; # Required for ingress frame
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
proxy_set_header Accept-Encoding ""; proxy_set_header Accept-Encoding "";
# avoid mixed content # avoid mixed content
# Ensure work with both http and https (code by @met67) # Ensure work with both http and https (code by @met67)
if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") { if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") {
@@ -51,7 +64,7 @@ server {
proxy_set_header X-Port $x_port; proxy_set_header X-Port $x_port;
proxy_set_header X-Forwarded-Proto $x_scheme; 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 # Correct url without port when using https
sub_filter_once off; sub_filter_once off;
@@ -60,7 +73,16 @@ server {
sub_filter http://$x_host/ http://$x_host$x_port/; sub_filter http://$x_host/ http://$x_host$x_port/;
# Rewrite url # Rewrite url
sub_filter "/static/" "%%ingress_entry%%/static/"; sub_filter "/static" "%%ingress_entry%%/static";
sub_filter "/media/" "%%ingress_entry%%/media/"; sub_filter "/media" "%%ingress_entry%%/media";
} }
location /media/ {
alias /config/addons_config/tandoor_recipes/mediafiles/;
}
location /static/ {
alias /data/recipes/staticfiles/;
}
} }