Migration to v5.0

https://github.com/alexbelgium/hassio-addons/issues/416
This commit is contained in:
Alexandre
2022-08-26 19:55:26 +02:00
parent 73159492ce
commit e4e7a6ee8d
24 changed files with 262 additions and 261 deletions

View File

@@ -1,3 +1,6 @@
- BACKUP BEFORE UPDATE : major version change
- PUID/PGID, ssl values deprecated
## 2ab714f5-ls35 (11-05-2022) ## 2ab714f5-ls35 (11-05-2022)
- Update to latest version from linuxserver/scrutiny - Update to latest version from linuxserver/scrutiny

View File

@@ -16,9 +16,7 @@
ARG BUILD_FROM ARG BUILD_FROM
ARG BUILD_VERSION ARG BUILD_VERSION
ARG BUILD_UPSTREAM="8e34ef8d-ls34" FROM ${BUILD_FROM}
#ARG BUILD_UPSTREAM="latest"
FROM ${BUILD_FROM}${BUILD_UPSTREAM}
################## ##################
# 2 Modify Image # # 2 Modify Image #
@@ -29,26 +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
# hadolint ignore=DL4006
RUN \
# Avoid custom-init.d duplications
if [ -f /etc/cont-init.d/02-tamper-check ]; then rm /etc/cont-init.d/02-tamper-check; fi \
\
# Prevent changing ownership of /config
&& if [ -f /etc/cont-init.d/10-adduser ]; then sed -i "/chown abc:abc \/config$/d" /etc/cont-init.d/10-adduser; fi \
\
# Allow UID and GID setting
&& sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \
&& sed -i 's/{PUID:-911}/(bashio::config "PUID")/g' /etc/cont-init.d/10-adduser \
&& sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' /etc/cont-init.d/10-adduser \
# use /data instead of /config for database
&& sed -i 's| /config| /data|g' /defaults/scrutiny.yaml \
&& sed -i 's| /config| /data|g' /etc/cont-init.d/* \
&& sed -i 's| /config| /data|g' /etc/logrotate.d/scrutiny \
&& sed -i 's| /config| /data|g' /etc/crontabs/root \
# correct url paths
&& grep -rl '/web/' /app/scrutiny-web/ | xargs sed -i 's|/web/|./|g'
################## ##################
# 3 Install apps # # 3 Install apps #
################## ##################
@@ -90,8 +68,7 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get
# 4 Entrypoint # # 4 Entrypoint #
################ ################
# Collector
RUN chmod 777 /run.sh
############ ############
# 5 Labels # # 5 Labels #

View File

@@ -30,7 +30,7 @@ Features :
- SMART monitoring - SMART monitoring
- Automatic addition of local drives - Automatic addition of local drives
- Hourly updates - Hourly updates
- Ingress with/without ssl - Ingress
- Automatic upstream updates - Automatic upstream updates
## Configuration ## Configuration
@@ -43,11 +43,8 @@ It automatically mounts all local drives.
Enable full access only if you are encountering issues. SMART access should work without full access in all other scenarios. Enable full access only if you are encountering issues. SMART access should work without full access in all other scenarios.
```yaml ```yaml
PGID: user Updates : Hourly, Daily, Weekly
GPID: user TZ : timezone
ssl: true/false (for Ingress)
certfile: fullchain.pem #ssl certificate
keyfile: privkey.pem #sslkeyfile
``` ```
## Installation ## Installation

View File

@@ -1,8 +1,7 @@
{ {
"build_from": { "build_from": {
"aarch64": "lscr.io/linuxserver/scrutiny:arm64v8-", "aarch64": "ghcr.io/analogj/scrutiny:master-omnibus",
"amd64": "lscr.io/linuxserver/scrutiny:amd64-", "amd64": "ghcr.io/analogj/scrutiny:master-omnibus"
"armv7": "lscr.io/linuxserver/scrutiny:arm32v7-"
}, },
"codenotary": { "codenotary": {
"signer": "alexandrep.github@gmail.com" "signer": "alexandrep.github@gmail.com"

View File

@@ -2,8 +2,7 @@
"apparmor": "true", "apparmor": "true",
"arch": [ "arch": [
"aarch64", "aarch64",
"amd64", "amd64"
"armv7"
], ],
"codenotary": "alexandrep.github@gmail.com", "codenotary": "alexandrep.github@gmail.com",
"description": "Scrutiny WebUI for smartd S.M.A.R.T monitoring", "description": "Scrutiny WebUI for smartd S.M.A.R.T monitoring",
@@ -45,30 +44,25 @@
"/dev/nvme2" "/dev/nvme2"
], ],
"environment": { "environment": {
"SCRUTINY_API_ENDPOINT": "http://localhost:8080", "COLLECTOR_API_ENDPOINT": "http://localhost:8080"
"SCRUTINY_COLLECTOR": "true",
"SCRUTINY_WEB": "true"
}, },
"ingress": true, "ingress": true,
"init": false, "init": false,
"map": [ "map": [
"config:rw" "share:rw"
], ],
"name": "Scrutiny", "name": "Scrutiny",
"options": { "options": {
"PGID": 0, "Updates": "Hourly"
"PUID": 0,
"Updates": "Hourly",
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"ssl": false
}, },
"panel_icon": "mdi:glasses", "panel_icon": "mdi:glasses",
"ports": { "ports": {
"8080/tcp": 8086 "8080/tcp": 8086,
"8086/tcp": 8087
}, },
"ports_description": { "ports_description": {
"8080/tcp": "Web UI port" "8080/tcp": "Web UI port",
"8086/tcp": "InfluxDB admin"
}, },
"privileged": [ "privileged": [
"SYS_ADMIN", "SYS_ADMIN",
@@ -76,16 +70,11 @@
"DAC_READ_SEARCH" "DAC_READ_SEARCH"
], ],
"schema": { "schema": {
"PGID": "int",
"PUID": "int",
"TZ": "str?", "TZ": "str?",
"Updates": "list(|Hourly|Daily|Weekly)", "Updates": "list(|Hourly|Daily|Weekly)"
"certfile": "str",
"keyfile": "str",
"ssl": "bool"
}, },
"slug": "scrutiny", "slug": "scrutiny",
"udev": true, "udev": true,
"url": "https://github.com/AnalogJ/scrutiny", "url": "https://github.com/AnalogJ/scrutiny",
"version": "2ab714f5-ls35" "version": "v0.5.0"
} }

View File

@@ -0,0 +1,58 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
#################
# Create folder #
#################
echo "Updating folders structure"
DATABASELOCATION="/data"
mkdir -p "$DATABASELOCATION"/config
mkdir -p "$DATABASELOCATION"/influxdb
if [ -d /opt/scrutiny/config ]; then rm -r /opt/scrutiny/config; fi
if [ -d /opt/scrutiny/influxdb ]; then rm -r /opt/scrutiny/influxdb; fi
ln -s "$DATABASELOCATION"/config /opt/scrutiny
ln -s "$DATABASELOCATION"/influxdb /opt/scrutiny
###############################
# Migrating previous database #
###############################
if [ -f /data/scrutiny.db ]; then
bashio::log.warning "Previous database detected, migration will start. Backup stored in /share/scrutiny.db.bak"
cp /data/scrutiny.db /share/scrutiny.db.bak
mv /data/scrutiny.db "$DATABASELOCATION"/config/
fi
######
# TZ #
######
# Align timezone with options
if bashio::config.has_value "TZ"; then
TZ="$(bashio::config 'TZ')"
bashio::log.info "Timezone : $TZ"
sed -i "1a export TZ=$TZ" /etc/cont-init.d/10-timezone
fi
################
# CRON OPTIONS #
################
# Align update with options
FREQUENCY="$(bashio::config 'Updates')"
bashio::log.info "$FREQUENCY updates"
case "$FREQUENCY" in
"Hourly")
sed -i "1a export COLLECTOR_CRON_SCHEDULE=\"0 * * * *\"" /etc/cont-init.d/50-cron-config
;;
"Daily")
sed -i "1a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * *\"" /etc/cont-init.d/50-cron-config
;;
"Weekly")
sed -i "1a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * 0\"" /etc/cont-init.d/50-cron-config
;;
esac

View File

@@ -1,50 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
##############
# Data usage #
##############
bashio::log.info "Setting permissions"
chown -R abc:abc /data
#######################
# VIEWPORT CORRECTION #
#######################
# correct viewport bug
# grep -rl '"lt-md":"(max-width: 959px)"' /app | xargs sed -i 's|"lt-md":"(max-width: 959px)"|"lt-md":"(max-width: 100px)"|g' || true
######################
# API URL CORRECTION #
######################
# allow true url for ingress
grep -rl '/api/' /app | xargs sed -i 's|/api/|api/|g' || true
grep -rl 'api/' /app | xargs sed -i 's|api/|./api/|g' || true
################
# CRON OPTIONS #
################
rm /config/crontabs/* || true
sed -i '$d' /etc/crontabs/root
sed -i -e '$a @reboot /run.sh' /etc/crontabs/root
# Align update with options
FREQUENCY=$(bashio::config 'Updates')
bashio::log.info "$FREQUENCY updates"
case $FREQUENCY in
"Hourly")
sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root
;;
"Daily")
sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root
;;
"Weekly")
sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root
;;
esac

View File

@@ -29,5 +29,7 @@ fi
ingress_port=$(bashio::addon.ingress_port) ingress_port=$(bashio::addon.ingress_port)
ingress_interface=$(bashio::addon.ip_address) ingress_interface=$(bashio::addon.ip_address)
ingress_entry=$(bashio::addon.ingress_entry)
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf 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/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf

View File

@@ -1,4 +1,3 @@
root /dev/null;
server_name $hostname; server_name $hostname;
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;

View File

@@ -6,16 +6,34 @@ server {
client_max_body_size 0; client_max_body_size 0;
location / { root /opt/scrutiny/web;
if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") {
set $x_scheme $1;
set $x_host $2;
set $x_port $3;
}
if ($http_referer ~* "^(http[s]?)://([^:]+)(/.*)$") {
set $x_scheme $1;
set $x_host $2;
set $x_port "";
}
location = / {
return 301 $x_scheme://$host:$x_port%%ingress_entry%%/web/dashboard;
}
location /api {
add_header Access-Control-Allow-Origin *;
proxy_read_timeout 30;
proxy_pass http://backend/api;
}
location /web/ {
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
proxy_read_timeout 30; proxy_read_timeout 30;
proxy_pass http://backend/web/; proxy_pass http://backend/web/;
} }
location /api/ {
add_header Access-Control-Allow-Origin *;
proxy_read_timeout 30;
proxy_pass http://backend/api/;
}
} }

View File

@@ -1,13 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
# wait for scrutiny to load
bashio::net.wait_for 8080
#####################
# ADD LOCAL DEVICES #
#####################
# search for local devices
# shellcheck disable=SC2015
scrutiny-collector-metrics run >/dev/null && bashio::log.info "Local Devices Added" || bashio::log.error "Local Devices Not Added"

View File

@@ -1,7 +1,7 @@
{ {
"github_fulltag": "true", "github_fulltag": "true",
"last_update": "11-05-2022", "last_update": "11-05-2022",
"paused": true, "paused": false,
"repository": "alexbelgium/hassio-addons", "repository": "alexbelgium/hassio-addons",
"slug": "scrutiny", "slug": "scrutiny",
"source": "dockerhub", "source": "dockerhub",

View File

@@ -1,3 +1,6 @@
- BACKUP BEFORE UPDATE : major version change
- PUID/PGID, ssl values deprecated
## 2ab714f5-ls35 (11-05-2022) ## 2ab714f5-ls35 (11-05-2022)
- Update to latest version from linuxserver/scrutiny - Update to latest version from linuxserver/scrutiny
@@ -8,10 +11,10 @@
## 8e34ef8d-ls35 (05-05-2022) ## 8e34ef8d-ls35 (05-05-2022)
- Update to latest version from linuxserver/scrutiny
- Add codenotary sign
- Require unprotected - Require unprotected
- Added full access. Use only if you can't connect without - Added full access. Use only if you can't connect without
- Update to latest version from linuxserver/scrutiny
- Add codenotary sign
- New standardized logic for Dockerfile build and packages installation - New standardized logic for Dockerfile build and packages installation
- Added : "/dev/nvme0" - Added : "/dev/nvme0"

View File

@@ -16,8 +16,7 @@
ARG BUILD_FROM ARG BUILD_FROM
ARG BUILD_VERSION ARG BUILD_VERSION
ARG BUILD_UPSTREAM="8e34ef8d-ls34" FROM ${BUILD_FROM}
FROM ${BUILD_FROM}${BUILD_UPSTREAM}
################## ##################
# 2 Modify Image # # 2 Modify Image #
@@ -28,26 +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
# hadolint ignore=DL4006
RUN \
# Avoid custom-init.d duplications
if [ -f /etc/cont-init.d/02-tamper-check ]; then rm /etc/cont-init.d/02-tamper-check; fi \
\
# Prevent changing ownership of /config
&& if [ -f /etc/cont-init.d/10-adduser ]; then sed -i "/chown abc:abc \/config$/d" /etc/cont-init.d/10-adduser; fi \
\
# Allow UID and GID setting
&& sed -i 's/bash/bashio/g' /etc/cont-init.d/10-adduser \
&& sed -i 's/{PUID:-911}/(bashio::config "PUID")/g' /etc/cont-init.d/10-adduser \
&& sed -i 's/{PGID:-911}/(bashio::config "PGID")/g' /etc/cont-init.d/10-adduser \
# use /data instead of /config for database
&& sed -i 's| /config| /data|g' /defaults/scrutiny.yaml \
&& sed -i 's| /config| /data|g' /etc/cont-init.d/* \
&& sed -i 's| /config| /data|g' /etc/logrotate.d/scrutiny \
&& sed -i 's| /config| /data|g' /etc/crontabs/root \
# correct url paths
&& grep -rl '/web/' /app/scrutiny-web/ | xargs sed -i 's|/web/|./|g'
################## ##################
# 3 Install apps # # 3 Install apps #
################## ##################
@@ -89,8 +68,7 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get
# 4 Entrypoint # # 4 Entrypoint #
################ ################
# Collector
RUN chmod 777 /run.sh
############ ############
# 5 Labels # # 5 Labels #

View File

@@ -1,3 +1,5 @@
## ⚠ Open Request : [[Scrutiny] Help needed to migrate to the official Scrutiny Image? (opened 2022-08-05)](https://github.com/alexbelgium/hassio-addons/issues/416) by [@AnalogJ](https://github.com/AnalogJ)
# Home assistant add-on: Scrutiny # Home assistant add-on: Scrutiny
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium) [![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
@@ -28,7 +30,7 @@ Features :
- SMART monitoring - SMART monitoring
- Automatic addition of local drives - Automatic addition of local drives
- Hourly updates - Hourly updates
- Ingress with/without ssl - Ingress
- Automatic upstream updates - Automatic upstream updates
## Configuration ## Configuration
@@ -41,11 +43,8 @@ It automatically mounts all local drives.
Enable full access only if you are encountering issues. SMART access should work without full access in all other scenarios. Enable full access only if you are encountering issues. SMART access should work without full access in all other scenarios.
```yaml ```yaml
PGID: user Updates : Hourly, Daily, Weekly
GPID: user TZ : timezone
ssl: true/false (for Ingress)
certfile: fullchain.pem #ssl certificate
keyfile: privkey.pem #sslkeyfile
``` ```
## Installation ## Installation

View File

@@ -1,8 +1,7 @@
{ {
"build_from": { "build_from": {
"aarch64": "lscr.io/linuxserver/scrutiny:arm64v8-", "aarch64": "ghcr.io/analogj/scrutiny:master-omnibus",
"amd64": "lscr.io/linuxserver/scrutiny:amd64-", "amd64": "ghcr.io/analogj/scrutiny:master-omnibus"
"armv7": "lscr.io/linuxserver/scrutiny:arm32v7-"
}, },
"codenotary": { "codenotary": {
"signer": "alexandrep.github@gmail.com" "signer": "alexandrep.github@gmail.com"

View File

@@ -2,35 +2,69 @@
"apparmor": "true", "apparmor": "true",
"arch": [ "arch": [
"aarch64", "aarch64",
"amd64", "amd64"
"armv7"
], ],
"codenotary": "alexandrep.github@gmail.com", "codenotary": "alexandrep.github@gmail.com",
"description": "Scrutiny WebUI for smartd S.M.A.R.T monitoring (Full Access)", "description": "Scrutiny WebUI for smartd S.M.A.R.T monitoring (Full Access)",
"devices": [
"/dev/sda",
"/dev/sdb",
"/dev/sdc",
"/dev/sdd",
"/dev/sde",
"/dev/sdf",
"/dev/sdg",
"/dev/nvme",
"/dev/nvme0n1p1",
"/dev/nvme0n1p2",
"/dev/mmcblk",
"/dev/sda1",
"/dev/sdb1",
"/dev/sdc1",
"/dev/sdd1",
"/dev/sde1",
"/dev/sdf1",
"/dev/sdg1",
"/dev/sda2",
"/dev/sdb2",
"/dev/sdc2",
"/dev/sdd2",
"/dev/sde2",
"/dev/sdf2",
"/dev/sdg2",
"/dev/sda3",
"/dev/sdb3",
"/dev/sda4",
"/dev/sdb4",
"/dev/nvme0",
"/dev/nvme1",
"/dev/nvme2",
"/dev/nvme0",
"/dev/nvme1",
"/dev/nvme2"
],
"environment": { "environment": {
"SCRUTINY_API_ENDPOINT": "http://localhost:8080", "COLLECTOR_API_ENDPOINT": "http://localhost:8080"
"SCRUTINY_COLLECTOR": "true",
"SCRUTINY_WEB": "true"
}, },
"full_access": true, "full_access": true,
"image": "ghcr.io/alexbelgium/scrutiny-fa-{arch}", "image": "ghcr.io/alexbelgium/scrutiny-fa-{arch}",
"ingress": true, "ingress": true,
"init": false, "init": false,
"map": [
"share:rw"
],
"name": "Scrutiny (Full Access)", "name": "Scrutiny (Full Access)",
"options": { "options": {
"PGID": 0, "Updates": "Hourly"
"PUID": 0,
"Updates": "Hourly",
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"ssl": false
}, },
"panel_icon": "mdi:glasses", "panel_icon": "mdi:glasses",
"ports": { "ports": {
"8080/tcp": 8086 "8080/tcp": 8086,
"8086/tcp": 8087
}, },
"ports_description": { "ports_description": {
"8080/tcp": "Web UI port" "8080/tcp": "Web UI port",
"8086/tcp": "InfluxDB admin"
}, },
"privileged": [ "privileged": [
"SYS_ADMIN", "SYS_ADMIN",
@@ -38,16 +72,11 @@
"DAC_READ_SEARCH" "DAC_READ_SEARCH"
], ],
"schema": { "schema": {
"PGID": "int",
"PUID": "int",
"TZ": "str?", "TZ": "str?",
"Updates": "list(|Hourly|Daily|Weekly)", "Updates": "list(|Hourly|Daily|Weekly)"
"certfile": "str",
"keyfile": "str",
"ssl": "bool"
}, },
"slug": "scrutiny_fa", "slug": "scrutiny_fa",
"udev": true, "udev": true,
"url": "https://github.com/AnalogJ/scrutiny", "url": "https://github.com/AnalogJ/scrutiny",
"version": "2ab714f5-ls35-2" "version": "v0.5.0"
} }

View File

@@ -0,0 +1,64 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
#######################
# Require unprotected #
#######################
bashio::require.unprotected
#################
# Create folder #
#################
echo "Updating folders structure"
DATABASELOCATION="/data"
mkdir -p "$DATABASELOCATION"/config
mkdir -p "$DATABASELOCATION"/influxdb
if [ -d /opt/scrutiny/config ]; then rm -r /opt/scrutiny/config; fi
if [ -d /opt/scrutiny/influxdb ]; then rm -r /opt/scrutiny/influxdb; fi
ln -s "$DATABASELOCATION"/config /opt/scrutiny
ln -s "$DATABASELOCATION"/influxdb /opt/scrutiny
###############################
# Migrating previous database #
###############################
if [ -f /data/scrutiny.db ]; then
bashio::log.warning "Previous database detected, migration will start. Backup stored in /share/scrutiny.db.bak"
cp /data/scrutiny.db /share/scrutiny.db.bak
mv /data/scrutiny.db "$DATABASELOCATION"/config/
fi
######
# TZ #
######
# Align timezone with options
if bashio::config.has_value "TZ"; then
TZ="$(bashio::config 'TZ')"
bashio::log.info "Timezone : $TZ"
sed -i "1a export TZ=$TZ" /etc/cont-init.d/10-timezone
fi
################
# CRON OPTIONS #
################
# Align update with options
FREQUENCY="$(bashio::config 'Updates')"
bashio::log.info "$FREQUENCY updates"
case "$FREQUENCY" in
"Hourly")
sed -i "1a export COLLECTOR_CRON_SCHEDULE=\"0 * * * *\"" /etc/cont-init.d/50-cron-config
;;
"Daily")
sed -i "1a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * *\"" /etc/cont-init.d/50-cron-config
;;
"Weekly")
sed -i "1a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * 0\"" /etc/cont-init.d/50-cron-config
;;
esac

View File

@@ -1,56 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
#######################
# Require unprotected #
#######################
bashio::require.unprotected
##############
# Data usage #
##############
bashio::log.info "Setting permissions"
chown -R abc:abc /data
#######################
# VIEWPORT CORRECTION #
#######################
# correct viewport bug
# grep -rl '"lt-md":"(max-width: 959px)"' /app | xargs sed -i 's|"lt-md":"(max-width: 959px)"|"lt-md":"(max-width: 100px)"|g' || true
######################
# API URL CORRECTION #
######################
# allow true url for ingress
grep -rl '/api/' /app | xargs sed -i 's|/api/|api/|g' || true
grep -rl 'api/' /app | xargs sed -i 's|api/|./api/|g' || true
################
# CRON OPTIONS #
################
rm /config/crontabs/* || true
sed -i '$d' /etc/crontabs/root
sed -i -e '$a @reboot /run.sh' /etc/crontabs/root
# Align update with options
FREQUENCY=$(bashio::config 'Updates')
bashio::log.info "$FREQUENCY updates"
case $FREQUENCY in
"Hourly")
sed -i -e '$a 0 * * * * /run.sh' /etc/crontabs/root
;;
"Daily")
sed -i -e '$a 0 0 * * * /run.sh' /etc/crontabs/root
;;
"Weekly")
sed -i -e '$a 0 0 * * 0 /run.sh' /etc/crontabs/root
;;
esac

View File

@@ -29,5 +29,7 @@ fi
ingress_port=$(bashio::addon.ingress_port) ingress_port=$(bashio::addon.ingress_port)
ingress_interface=$(bashio::addon.ip_address) ingress_interface=$(bashio::addon.ip_address)
ingress_entry=$(bashio::addon.ingress_entry)
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf 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/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf

View File

@@ -1,4 +1,3 @@
root /dev/null;
server_name $hostname; server_name $hostname;
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;

View File

@@ -6,16 +6,34 @@ server {
client_max_body_size 0; client_max_body_size 0;
location / { root /opt/scrutiny/web;
if ($http_referer ~* "^(http[s]?)://([^:]+):(\d*)(/.*)$") {
set $x_scheme $1;
set $x_host $2;
set $x_port $3;
}
if ($http_referer ~* "^(http[s]?)://([^:]+)(/.*)$") {
set $x_scheme $1;
set $x_host $2;
set $x_port "";
}
location = / {
return 301 $x_scheme://$host:$x_port%%ingress_entry%%/web/dashboard;
}
location /api {
add_header Access-Control-Allow-Origin *;
proxy_read_timeout 30;
proxy_pass http://backend/api;
}
location /web/ {
add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Origin *;
proxy_read_timeout 30; proxy_read_timeout 30;
proxy_pass http://backend/web/; proxy_pass http://backend/web/;
} }
location /api/ {
add_header Access-Control-Allow-Origin *;
proxy_read_timeout 30;
proxy_pass http://backend/api/;
}
} }

View File

@@ -1,13 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
# wait for scrutiny to load
bashio::net.wait_for 8080
#####################
# ADD LOCAL DEVICES #
#####################
# search for local devices
# shellcheck disable=SC2015
scrutiny-collector-metrics run >/dev/null && bashio::log.info "Local Devices Added" || bashio::log.error "Local Devices Not Added"

View File

@@ -1,7 +1,7 @@
{ {
"github_fulltag": "true", "github_fulltag": "true",
"last_update": "11-05-2022", "last_update": "11-05-2022",
"paused": true, "paused": false,
"repository": "alexbelgium/hassio-addons", "repository": "alexbelgium/hassio-addons",
"slug": "scrutiny_fa", "slug": "scrutiny_fa",
"source": "dockerhub", "source": "dockerhub",