mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Migration to v5.0
https://github.com/alexbelgium/hassio-addons/issues/416
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
- BACKUP BEFORE UPDATE : major version change
|
||||
- PUID/PGID, ssl values deprecated
|
||||
|
||||
## 2ab714f5-ls35 (11-05-2022)
|
||||
|
||||
- Update to latest version from linuxserver/scrutiny
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
|
||||
ARG BUILD_FROM
|
||||
ARG BUILD_VERSION
|
||||
ARG BUILD_UPSTREAM="8e34ef8d-ls34"
|
||||
#ARG BUILD_UPSTREAM="latest"
|
||||
FROM ${BUILD_FROM}${BUILD_UPSTREAM}
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
##################
|
||||
# 2 Modify Image #
|
||||
@@ -29,26 +27,6 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=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 #
|
||||
##################
|
||||
@@ -90,8 +68,7 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
# Collector
|
||||
RUN chmod 777 /run.sh
|
||||
|
||||
|
||||
############
|
||||
# 5 Labels #
|
||||
|
||||
@@ -30,7 +30,7 @@ Features :
|
||||
- SMART monitoring
|
||||
- Automatic addition of local drives
|
||||
- Hourly updates
|
||||
- Ingress with/without ssl
|
||||
- Ingress
|
||||
- Automatic upstream updates
|
||||
|
||||
## 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.
|
||||
|
||||
```yaml
|
||||
PGID: user
|
||||
GPID: user
|
||||
ssl: true/false (for Ingress)
|
||||
certfile: fullchain.pem #ssl certificate
|
||||
keyfile: privkey.pem #sslkeyfile
|
||||
Updates : Hourly, Daily, Weekly
|
||||
TZ : timezone
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"build_from": {
|
||||
"aarch64": "lscr.io/linuxserver/scrutiny:arm64v8-",
|
||||
"amd64": "lscr.io/linuxserver/scrutiny:amd64-",
|
||||
"armv7": "lscr.io/linuxserver/scrutiny:arm32v7-"
|
||||
"aarch64": "ghcr.io/analogj/scrutiny:master-omnibus",
|
||||
"amd64": "ghcr.io/analogj/scrutiny:master-omnibus"
|
||||
},
|
||||
"codenotary": {
|
||||
"signer": "alexandrep.github@gmail.com"
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
"apparmor": "true",
|
||||
"arch": [
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"armv7"
|
||||
"amd64"
|
||||
],
|
||||
"codenotary": "alexandrep.github@gmail.com",
|
||||
"description": "Scrutiny WebUI for smartd S.M.A.R.T monitoring",
|
||||
@@ -45,30 +44,25 @@
|
||||
"/dev/nvme2"
|
||||
],
|
||||
"environment": {
|
||||
"SCRUTINY_API_ENDPOINT": "http://localhost:8080",
|
||||
"SCRUTINY_COLLECTOR": "true",
|
||||
"SCRUTINY_WEB": "true"
|
||||
"COLLECTOR_API_ENDPOINT": "http://localhost:8080"
|
||||
},
|
||||
"ingress": true,
|
||||
"init": false,
|
||||
"map": [
|
||||
"config:rw"
|
||||
"share:rw"
|
||||
],
|
||||
"name": "Scrutiny",
|
||||
"options": {
|
||||
"PGID": 0,
|
||||
"PUID": 0,
|
||||
"Updates": "Hourly",
|
||||
"certfile": "fullchain.pem",
|
||||
"keyfile": "privkey.pem",
|
||||
"ssl": false
|
||||
"Updates": "Hourly"
|
||||
},
|
||||
"panel_icon": "mdi:glasses",
|
||||
"ports": {
|
||||
"8080/tcp": 8086
|
||||
"8080/tcp": 8086,
|
||||
"8086/tcp": 8087
|
||||
},
|
||||
"ports_description": {
|
||||
"8080/tcp": "Web UI port"
|
||||
"8080/tcp": "Web UI port",
|
||||
"8086/tcp": "InfluxDB admin"
|
||||
},
|
||||
"privileged": [
|
||||
"SYS_ADMIN",
|
||||
@@ -76,16 +70,11 @@
|
||||
"DAC_READ_SEARCH"
|
||||
],
|
||||
"schema": {
|
||||
"PGID": "int",
|
||||
"PUID": "int",
|
||||
"TZ": "str?",
|
||||
"Updates": "list(|Hourly|Daily|Weekly)",
|
||||
"certfile": "str",
|
||||
"keyfile": "str",
|
||||
"ssl": "bool"
|
||||
"Updates": "list(|Hourly|Daily|Weekly)"
|
||||
},
|
||||
"slug": "scrutiny",
|
||||
"udev": true,
|
||||
"url": "https://github.com/AnalogJ/scrutiny",
|
||||
"version": "2ab714f5-ls35"
|
||||
"version": "v0.5.0"
|
||||
}
|
||||
|
||||
58
scrutiny/rootfs/etc/cont-init.d/01-run.sh
Normal file
58
scrutiny/rootfs/etc/cont-init.d/01-run.sh
Normal 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
|
||||
@@ -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
|
||||
@@ -29,5 +29,7 @@ fi
|
||||
|
||||
ingress_port=$(bashio::addon.ingress_port)
|
||||
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/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
root /dev/null;
|
||||
server_name $hostname;
|
||||
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
|
||||
@@ -6,16 +6,34 @@ server {
|
||||
|
||||
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 *;
|
||||
proxy_read_timeout 30;
|
||||
proxy_pass http://backend/web/;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
proxy_read_timeout 30;
|
||||
proxy_pass http://backend/api/;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"github_fulltag": "true",
|
||||
"last_update": "11-05-2022",
|
||||
"paused": true,
|
||||
"paused": false,
|
||||
"repository": "alexbelgium/hassio-addons",
|
||||
"slug": "scrutiny",
|
||||
"source": "dockerhub",
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
- BACKUP BEFORE UPDATE : major version change
|
||||
- PUID/PGID, ssl values deprecated
|
||||
|
||||
## 2ab714f5-ls35 (11-05-2022)
|
||||
|
||||
- Update to latest version from linuxserver/scrutiny
|
||||
@@ -8,10 +11,10 @@
|
||||
|
||||
## 8e34ef8d-ls35 (05-05-2022)
|
||||
|
||||
- Update to latest version from linuxserver/scrutiny
|
||||
- Add codenotary sign
|
||||
- Require unprotected
|
||||
- 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
|
||||
- Added : "/dev/nvme0"
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
ARG BUILD_FROM
|
||||
ARG BUILD_VERSION
|
||||
ARG BUILD_UPSTREAM="8e34ef8d-ls34"
|
||||
FROM ${BUILD_FROM}${BUILD_UPSTREAM}
|
||||
FROM ${BUILD_FROM}
|
||||
|
||||
##################
|
||||
# 2 Modify Image #
|
||||
@@ -28,26 +27,6 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=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 #
|
||||
##################
|
||||
@@ -89,8 +68,7 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
# Collector
|
||||
RUN chmod 777 /run.sh
|
||||
|
||||
|
||||
############
|
||||
# 5 Labels #
|
||||
|
||||
@@ -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
|
||||
|
||||
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
|
||||
@@ -28,7 +30,7 @@ Features :
|
||||
- SMART monitoring
|
||||
- Automatic addition of local drives
|
||||
- Hourly updates
|
||||
- Ingress with/without ssl
|
||||
- Ingress
|
||||
- Automatic upstream updates
|
||||
|
||||
## 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.
|
||||
|
||||
```yaml
|
||||
PGID: user
|
||||
GPID: user
|
||||
ssl: true/false (for Ingress)
|
||||
certfile: fullchain.pem #ssl certificate
|
||||
keyfile: privkey.pem #sslkeyfile
|
||||
Updates : Hourly, Daily, Weekly
|
||||
TZ : timezone
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"build_from": {
|
||||
"aarch64": "lscr.io/linuxserver/scrutiny:arm64v8-",
|
||||
"amd64": "lscr.io/linuxserver/scrutiny:amd64-",
|
||||
"armv7": "lscr.io/linuxserver/scrutiny:arm32v7-"
|
||||
"aarch64": "ghcr.io/analogj/scrutiny:master-omnibus",
|
||||
"amd64": "ghcr.io/analogj/scrutiny:master-omnibus"
|
||||
},
|
||||
"codenotary": {
|
||||
"signer": "alexandrep.github@gmail.com"
|
||||
|
||||
@@ -2,35 +2,69 @@
|
||||
"apparmor": "true",
|
||||
"arch": [
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"armv7"
|
||||
"amd64"
|
||||
],
|
||||
"codenotary": "alexandrep.github@gmail.com",
|
||||
"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": {
|
||||
"SCRUTINY_API_ENDPOINT": "http://localhost:8080",
|
||||
"SCRUTINY_COLLECTOR": "true",
|
||||
"SCRUTINY_WEB": "true"
|
||||
"COLLECTOR_API_ENDPOINT": "http://localhost:8080"
|
||||
},
|
||||
"full_access": true,
|
||||
"image": "ghcr.io/alexbelgium/scrutiny-fa-{arch}",
|
||||
"ingress": true,
|
||||
"init": false,
|
||||
"map": [
|
||||
"share:rw"
|
||||
],
|
||||
"name": "Scrutiny (Full Access)",
|
||||
"options": {
|
||||
"PGID": 0,
|
||||
"PUID": 0,
|
||||
"Updates": "Hourly",
|
||||
"certfile": "fullchain.pem",
|
||||
"keyfile": "privkey.pem",
|
||||
"ssl": false
|
||||
"Updates": "Hourly"
|
||||
},
|
||||
"panel_icon": "mdi:glasses",
|
||||
"ports": {
|
||||
"8080/tcp": 8086
|
||||
"8080/tcp": 8086,
|
||||
"8086/tcp": 8087
|
||||
},
|
||||
"ports_description": {
|
||||
"8080/tcp": "Web UI port"
|
||||
"8080/tcp": "Web UI port",
|
||||
"8086/tcp": "InfluxDB admin"
|
||||
},
|
||||
"privileged": [
|
||||
"SYS_ADMIN",
|
||||
@@ -38,16 +72,11 @@
|
||||
"DAC_READ_SEARCH"
|
||||
],
|
||||
"schema": {
|
||||
"PGID": "int",
|
||||
"PUID": "int",
|
||||
"TZ": "str?",
|
||||
"Updates": "list(|Hourly|Daily|Weekly)",
|
||||
"certfile": "str",
|
||||
"keyfile": "str",
|
||||
"ssl": "bool"
|
||||
"Updates": "list(|Hourly|Daily|Weekly)"
|
||||
},
|
||||
"slug": "scrutiny_fa",
|
||||
"udev": true,
|
||||
"url": "https://github.com/AnalogJ/scrutiny",
|
||||
"version": "2ab714f5-ls35-2"
|
||||
}
|
||||
"version": "v0.5.0"
|
||||
}
|
||||
64
scrutiny_fa/rootfs/etc/cont-init.d/01-run.sh
Normal file
64
scrutiny_fa/rootfs/etc/cont-init.d/01-run.sh
Normal 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
|
||||
@@ -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
|
||||
@@ -29,5 +29,7 @@ fi
|
||||
|
||||
ingress_port=$(bashio::addon.ingress_port)
|
||||
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/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s|%%ingress_entry%%|${ingress_entry}|g" /etc/nginx/servers/ingress.conf
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
root /dev/null;
|
||||
server_name $hostname;
|
||||
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
|
||||
@@ -6,16 +6,34 @@ server {
|
||||
|
||||
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 *;
|
||||
proxy_read_timeout 30;
|
||||
proxy_pass http://backend/web/;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
proxy_read_timeout 30;
|
||||
proxy_pass http://backend/api/;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"github_fulltag": "true",
|
||||
"last_update": "11-05-2022",
|
||||
"paused": true,
|
||||
"paused": false,
|
||||
"repository": "alexbelgium/hassio-addons",
|
||||
"slug": "scrutiny_fa",
|
||||
"source": "dockerhub",
|
||||
|
||||
Reference in New Issue
Block a user