mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-31 21:04:05 +02:00
add scrutiny full access
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
"ports_description": {
|
"ports_description": {
|
||||||
"8080/tcp": "Web UI port"
|
"8080/tcp": "Web UI port"
|
||||||
},
|
},
|
||||||
"full_access": true,
|
|
||||||
"devices": [
|
"devices": [
|
||||||
"/dev/sda",
|
"/dev/sda",
|
||||||
"/dev/sdb",
|
"/dev/sdb",
|
||||||
|
|||||||
32
scrutiny_fa/CHANGELOG.md
Normal file
32
scrutiny_fa/CHANGELOG.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
- Added full access. Use only if you can't connect without
|
||||||
|
- New standardized logic for Dockerfile build and packages installation
|
||||||
|
- Added : "/dev/nvme0"
|
||||||
|
|
||||||
|
## 0.3.13 (26-10-2021)
|
||||||
|
|
||||||
|
- Update to latest version from analogj/scrutiny
|
||||||
|
- Allow mounting of devices up to sdg2
|
||||||
|
|
||||||
|
## 0.3.12 (29-09-2021)
|
||||||
|
|
||||||
|
- Update to latest version from AnalogJ/scrutiny
|
||||||
|
- Aligned with AnalogJ namings
|
||||||
|
|
||||||
|
## fd4f0429
|
||||||
|
|
||||||
|
- New ingress icon, thanks to @ElVit
|
||||||
|
- New features, selecting of update rate with addon option
|
||||||
|
- Add banner in log
|
||||||
|
- Align to upstream
|
||||||
|
|
||||||
|
## 27b923b5-ls12
|
||||||
|
|
||||||
|
- Removed full access flag
|
||||||
|
- Improved code for local devices scanning after first installation
|
||||||
|
- Solved an issue that made a blank screen on mobile devices
|
||||||
|
- Implementation of Ingress with/without ssl
|
||||||
|
|
||||||
|
## 27b923b5-ls11
|
||||||
|
|
||||||
|
- Enables PUID/GUID options
|
||||||
|
- Daily update of values
|
||||||
105
scrutiny_fa/Dockerfile
Normal file
105
scrutiny_fa/Dockerfile
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#============================#
|
||||||
|
# ALEXBELGIUM'S DOCKERFILE #
|
||||||
|
#============================#
|
||||||
|
# _.------.
|
||||||
|
# _.-` ('>.-`"""-.
|
||||||
|
# '.--'` _'` _ .--.)
|
||||||
|
# -' '-.-';` `
|
||||||
|
# ' - _.' ``'--.
|
||||||
|
# '---` .-'""`
|
||||||
|
# /`
|
||||||
|
#=== Home Assistant Addon ===#
|
||||||
|
|
||||||
|
#################
|
||||||
|
# 1 Build Image #
|
||||||
|
#################
|
||||||
|
|
||||||
|
ARG BUILD_FROM
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
FROM ${BUILD_FROM}
|
||||||
|
|
||||||
|
##################
|
||||||
|
# 2 Modify Image #
|
||||||
|
##################
|
||||||
|
|
||||||
|
# hadolint ignore=DL4006
|
||||||
|
RUN \
|
||||||
|
# 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 #
|
||||||
|
##################
|
||||||
|
|
||||||
|
# Add rootfs
|
||||||
|
COPY rootfs/ /
|
||||||
|
|
||||||
|
# Modules
|
||||||
|
ARG MODULES="00-banner.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 \
|
||||||
|
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||||
|
&& mkdir -p /etc/cont-init.d \
|
||||||
|
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||||
|
&& chmod -R 755 /etc/cont-init.d || printf '%s\n' "${MODULES}" >/MODULESFILE
|
||||||
|
|
||||||
|
# Manual apps
|
||||||
|
ENV PACKAGES="jq \
|
||||||
|
curl \
|
||||||
|
cifs-utils \
|
||||||
|
nginx"
|
||||||
|
|
||||||
|
# Automatic apps & bashio
|
||||||
|
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 \
|
||||||
|
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||||
|
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||||
|
&& chmod 777 /automatic_packages.sh \
|
||||||
|
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||||
|
&& rm /automatic_packages.sh || printf '%s\n' "${PACKAGES:-}" > /ENVFILE
|
||||||
|
|
||||||
|
################
|
||||||
|
# 4 Entrypoint #
|
||||||
|
################
|
||||||
|
|
||||||
|
# Collector
|
||||||
|
RUN chmod 777 /run.sh
|
||||||
|
|
||||||
|
############
|
||||||
|
# 5 Labels #
|
||||||
|
############
|
||||||
|
|
||||||
|
ARG BUILD_ARCH
|
||||||
|
ARG BUILD_DATE
|
||||||
|
ARG BUILD_DESCRIPTION
|
||||||
|
ARG BUILD_NAME
|
||||||
|
ARG BUILD_REF
|
||||||
|
ARG BUILD_REPOSITORY
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
LABEL \
|
||||||
|
io.hass.name="${BUILD_NAME}" \
|
||||||
|
io.hass.description="${BUILD_DESCRIPTION}" \
|
||||||
|
io.hass.arch="${BUILD_ARCH}" \
|
||||||
|
io.hass.type="addon" \
|
||||||
|
io.hass.version=${BUILD_VERSION} \
|
||||||
|
maintainer="alexbelgium (https://github.com/alexbelgium)" \
|
||||||
|
org.opencontainers.image.title="${BUILD_NAME}" \
|
||||||
|
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
|
||||||
|
org.opencontainers.image.vendor="Home Assistant Add-ons" \
|
||||||
|
org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \
|
||||||
|
org.opencontainers.image.licenses="MIT" \
|
||||||
|
org.opencontainers.image.url="https://github.com/alexbelgium" \
|
||||||
|
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
|
||||||
|
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
|
||||||
|
org.opencontainers.image.created=${BUILD_DATE} \
|
||||||
|
org.opencontainers.image.revision=${BUILD_REF} \
|
||||||
|
org.opencontainers.image.version=${BUILD_VERSION}
|
||||||
112
scrutiny_fa/README.md
Normal file
112
scrutiny_fa/README.md
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
# Home assistant add-on: Scrutiny
|
||||||
|
|
||||||
|
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
[](https://www.codacy.com/gh/alexbelgium/hassio-addons/dashboard?utm_source=github.com&utm_medium=referral&utm_content=alexbelgium/hassio-addons&utm_campaign=Badge_Grade)
|
||||||
|
[](https://github.com/marketplace/actions/super-linter)
|
||||||
|
[](https://github.com/alexbelgium/hassio-addons/actions/workflows/builder.yaml)
|
||||||
|
|
||||||
|
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white
|
||||||
|
|
||||||
|
_Thanks to everyone having starred my repo! To star it click on the image below, then it will be on top right. Thanks!_
|
||||||
|
|
||||||
|
[](https://github.com/alexbelgium/hassio-addons/stargazers)
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[Scrutiny](https://github.com/AnalogJ/scrutiny) is a Hard Drive Health Dashboard & Monitoring solution, merging manufacturer provided S.M.A.R.T metrics with real-world failure rates. This addon is based on the [docker image](https://hub.docker.com/r/linuxserver/scrutiny) from [linuxserver.io](https://www.linuxserver.io/).
|
||||||
|
|
||||||
|
Features :
|
||||||
|
|
||||||
|
- SMART monitoring
|
||||||
|
- Automatic addition of local drives
|
||||||
|
- Hourly updates
|
||||||
|
- Ingress with/without ssl
|
||||||
|
- Automatic upstream updates
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Webui can be found at <http://your-ip:8080>, or through Ingress.
|
||||||
|
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
|
||||||
|
GUID: user
|
||||||
|
GPID: user
|
||||||
|
ssl: true/false (for Ingress)
|
||||||
|
certfile: fullchain.pem #ssl certificate
|
||||||
|
keyfile: privkey.pem #sslkeyfile
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on.
|
||||||
|
|
||||||
|
1. [Add my Hass.io add-ons repository][repository] to your home assistant instance.
|
||||||
|
1. Install this add-on.
|
||||||
|
1. Click the `Save` button to store your configuration.
|
||||||
|
1. Set the add-on options to your preferences
|
||||||
|
1. Start the add-on.
|
||||||
|
1. Check the logs of the add-on to see if everything went well.
|
||||||
|
1. Open the webUI (Ingress based) and adapt the software options
|
||||||
|
|
||||||
|
# Integration in home assistant
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Integration with HA can be done with the [rest platform](https://www.home-assistant.io/integrations/rest) in configuration.yaml.
|
||||||
|
|
||||||
|
Two types of api endpoints are available:
|
||||||
|
|
||||||
|
- Summary data : http://YOURIP:ADDONPORT/api/summary
|
||||||
|
- Detailed data : http://YOURIP:ADDONPORT/api/WWN/details
|
||||||
|
|
||||||
|
For the detailed data, wmn can be found for each hdd within the scrutiny app. For example for me : http://192.168.178.23:8086/api/device/0x50014ee606c14537/details
|
||||||
|
|
||||||
|
Example to get data from the first hdd.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
rest:
|
||||||
|
- verify_ssl: false
|
||||||
|
scan_interval: 60
|
||||||
|
resource: http://YOURIP:ADDONPORT/api/summary
|
||||||
|
sensor:
|
||||||
|
- name: "HDD disk 1"
|
||||||
|
json_attributes_path: "$.data[0].smart_results[0]"
|
||||||
|
value_template: "OK"
|
||||||
|
json_attributes:
|
||||||
|
- "device_wwn"
|
||||||
|
- "date"
|
||||||
|
- "smart_status"
|
||||||
|
- "temp"
|
||||||
|
- "power_on_hours"
|
||||||
|
- "power_cycle_count"
|
||||||
|
- "ata_attributes"
|
||||||
|
- "nvme_attributes"
|
||||||
|
- "scsi_attributes"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Illustration
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Create an issue on github, or ask on the [home assistant thread](https://community.home-assistant.io/t/home-assistant-addon-scrutiny-smart-dashboard/295747)
|
||||||
|
|
||||||
|
https://github.com/alexbelgium/hassio-addons
|
||||||
|
|
||||||
|
[repository]: https://github.com/alexbelgium/hassio-addons
|
||||||
68
scrutiny_fa/apparmor.txt
Normal file
68
scrutiny_fa/apparmor.txt
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#include <tunables/global>
|
||||||
|
|
||||||
|
profile db21ed7f_scrutiny flags=(attach_disconnected,mediate_deleted) {
|
||||||
|
#include <abstractions/base>
|
||||||
|
|
||||||
|
capability,
|
||||||
|
file,
|
||||||
|
signal,
|
||||||
|
mount,
|
||||||
|
umount,
|
||||||
|
remount,
|
||||||
|
network udp,
|
||||||
|
network tcp,
|
||||||
|
network dgram,
|
||||||
|
network stream,
|
||||||
|
network inet,
|
||||||
|
network inet6,
|
||||||
|
network netlink raw,
|
||||||
|
|
||||||
|
capability setgid,
|
||||||
|
capability setuid,
|
||||||
|
capability dac_override,
|
||||||
|
capability sys_admin,
|
||||||
|
capability dac_read_search,
|
||||||
|
capability sys_rawio,
|
||||||
|
|
||||||
|
# S6-Overlay
|
||||||
|
/bin/** ix,
|
||||||
|
/usr/bin/** ix,
|
||||||
|
/usr/lib/bashio/** ix,
|
||||||
|
/etc/s6/** rix,
|
||||||
|
/run/s6/** rix,
|
||||||
|
/etc/services.d/** rwix,
|
||||||
|
/etc/cont-init.d/** rwix,
|
||||||
|
/etc/cont-finish.d/** rwix,
|
||||||
|
/init rix,
|
||||||
|
/var/run/** mrwkl,
|
||||||
|
/var/run/ mrwkl,
|
||||||
|
/dev/i2c-1 mrwkl,
|
||||||
|
# Files required
|
||||||
|
/dev/sda1 mrwkl,
|
||||||
|
/dev/sdb1 mrwkl,
|
||||||
|
/dev/mmcblk0p1 mrwkl,
|
||||||
|
/dev/* mrwkl,
|
||||||
|
/tmp/** mrkwl,
|
||||||
|
/dev/sda mrwkl,
|
||||||
|
/dev/sdb mrwkl,
|
||||||
|
/dev/sdc mrwkl,
|
||||||
|
/dev/sdd mrwkl,
|
||||||
|
/dev/sde mrwkl,
|
||||||
|
/dev/sdf mrwkl,
|
||||||
|
/dev/sdg mrwkl,
|
||||||
|
/dev/nvme0 mrwkl,
|
||||||
|
/dev/nvme1 mrwkl,
|
||||||
|
/dev/nvme2 mrwkl,
|
||||||
|
/dev/nvme3 mrwkl,
|
||||||
|
/dev/nvme4 mrwkl,
|
||||||
|
|
||||||
|
# Data access
|
||||||
|
/data/** rw,
|
||||||
|
|
||||||
|
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
|
||||||
|
ptrace (trace,read) peer=docker-default,
|
||||||
|
|
||||||
|
# docker daemon confinement requires explict allow rule for signal
|
||||||
|
signal (receive) set=(kill,term) peer=/usr/bin/docker,
|
||||||
|
|
||||||
|
}
|
||||||
7
scrutiny_fa/build.json
Normal file
7
scrutiny_fa/build.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"build_from": {
|
||||||
|
"armv7": "lscr.io/linuxserver/scrutiny:arm32v7-latest",
|
||||||
|
"aarch64": "lscr.io/linuxserver/scrutiny:arm64v8-latest",
|
||||||
|
"amd64": "lscr.io/linuxserver/scrutiny:amd64-latest"
|
||||||
|
}
|
||||||
|
}
|
||||||
46
scrutiny_fa/config.json
Normal file
46
scrutiny_fa/config.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "Scrutiny (Full Access)",
|
||||||
|
"version": "0.3.13-7",
|
||||||
|
"upstream": "0.3.13",
|
||||||
|
"slug": "scrutiny_fa",
|
||||||
|
"description": "Scrutiny WebUI for smartd S.M.A.R.T monitoring (Full Access)",
|
||||||
|
"url": "https://github.com/AnalogJ/scrutiny",
|
||||||
|
"startup": "services",
|
||||||
|
"arch": ["aarch64", "amd64", "armv7"],
|
||||||
|
"ingress": true,
|
||||||
|
"ingress_port": 8099,
|
||||||
|
"panel_icon": "mdi:glasses",
|
||||||
|
"ports": {
|
||||||
|
"8080/tcp": 8086
|
||||||
|
},
|
||||||
|
"ports_description": {
|
||||||
|
"8080/tcp": "Web UI port"
|
||||||
|
},
|
||||||
|
"full_access": true,
|
||||||
|
"udev": "true",
|
||||||
|
"apparmor": "true",
|
||||||
|
"map": [],
|
||||||
|
"boot": "auto",
|
||||||
|
"environment": {
|
||||||
|
"SCRUTINY_API_ENDPOINT": "http://localhost:8080",
|
||||||
|
"SCRUTINY_WEB": "true",
|
||||||
|
"SCRUTINY_COLLECTOR": "true"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"ssl": false,
|
||||||
|
"certfile": "fullchain.pem",
|
||||||
|
"keyfile": "privkey.pem",
|
||||||
|
"Updates": "Hourly",
|
||||||
|
"PUID": 0,
|
||||||
|
"PGID": 0
|
||||||
|
},
|
||||||
|
"schema": {
|
||||||
|
"ssl": "bool",
|
||||||
|
"certfile": "str",
|
||||||
|
"keyfile": "str",
|
||||||
|
"Updates": "list(|Hourly|Daily|Weekly)",
|
||||||
|
"PUID": "int",
|
||||||
|
"PGID": "int",
|
||||||
|
"TZ": "str?"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
scrutiny_fa/icon.png
Normal file
BIN
scrutiny_fa/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
scrutiny_fa/logo.png
Normal file
BIN
scrutiny_fa/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# If dockerfile failed install manually
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Automatic modules download #
|
||||||
|
##############################
|
||||||
|
if [ -e "/MODULESFILE" ]; then
|
||||||
|
MODULES=$(</MODULESFILE)
|
||||||
|
MODULES="${MODULES:-00-banner.sh}"
|
||||||
|
echo "Executing modules script : $MODULES"
|
||||||
|
|
||||||
|
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 \
|
||||||
|
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||||
|
&& mkdir -p /etc/cont-init.d \
|
||||||
|
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||||
|
&& chmod -R 755 /etc/cont-init.d
|
||||||
|
fi
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Automatic installer #
|
||||||
|
#######################
|
||||||
|
if [ -e "/ENVFILE" ]; then
|
||||||
|
PACKAGES=$(</ENVFILE)
|
||||||
|
echo "Executing dependency script with custom elements : $PACKAGES"
|
||||||
|
|
||||||
|
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 \
|
||||||
|
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||||
|
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||||
|
&& chmod 777 /automatic_packages.sh \
|
||||||
|
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||||
|
&& rm /automatic_packages.sh
|
||||||
|
fi
|
||||||
50
scrutiny_fa/rootfs/etc/cont-init.d/31-run.sh
Normal file
50
scrutiny_fa/rootfs/etc/cont-init.d/31-run.sh
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/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
|
||||||
33
scrutiny_fa/rootfs/etc/cont-init.d/32-nginx.sh
Normal file
33
scrutiny_fa/rootfs/etc/cont-init.d/32-nginx.sh
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
#################
|
||||||
|
# NGINX SETTING #
|
||||||
|
#################
|
||||||
|
declare port
|
||||||
|
declare certfile
|
||||||
|
declare ingress_interface
|
||||||
|
declare ingress_port
|
||||||
|
declare keyfile
|
||||||
|
|
||||||
|
port=$(bashio::addon.port 80)
|
||||||
|
if bashio::var.has_value "${port}"; then
|
||||||
|
bashio::config.require.ssl
|
||||||
|
|
||||||
|
if bashio::config.true 'ssl'; then
|
||||||
|
certfile=$(bashio::config 'certfile')
|
||||||
|
keyfile=$(bashio::config 'keyfile')
|
||||||
|
|
||||||
|
mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
|
||||||
|
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/servers/direct.conf
|
||||||
|
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/servers/direct.conf
|
||||||
|
|
||||||
|
else
|
||||||
|
mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
ingress_port=$(bashio::addon.ingress_port)
|
||||||
|
ingress_interface=$(bashio::addon.ip_address)
|
||||||
|
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
||||||
|
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||||
96
scrutiny_fa/rootfs/etc/nginx/includes/mime.types
Normal file
96
scrutiny_fa/rootfs/etc/nginx/includes/mime.types
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
types {
|
||||||
|
text/html html htm shtml;
|
||||||
|
text/css css;
|
||||||
|
text/xml xml;
|
||||||
|
image/gif gif;
|
||||||
|
image/jpeg jpeg jpg;
|
||||||
|
application/javascript js;
|
||||||
|
application/atom+xml atom;
|
||||||
|
application/rss+xml rss;
|
||||||
|
|
||||||
|
text/mathml mml;
|
||||||
|
text/plain txt;
|
||||||
|
text/vnd.sun.j2me.app-descriptor jad;
|
||||||
|
text/vnd.wap.wml wml;
|
||||||
|
text/x-component htc;
|
||||||
|
|
||||||
|
image/png png;
|
||||||
|
image/svg+xml svg svgz;
|
||||||
|
image/tiff tif tiff;
|
||||||
|
image/vnd.wap.wbmp wbmp;
|
||||||
|
image/webp webp;
|
||||||
|
image/x-icon ico;
|
||||||
|
image/x-jng jng;
|
||||||
|
image/x-ms-bmp bmp;
|
||||||
|
|
||||||
|
font/woff woff;
|
||||||
|
font/woff2 woff2;
|
||||||
|
|
||||||
|
application/java-archive jar war ear;
|
||||||
|
application/json json;
|
||||||
|
application/mac-binhex40 hqx;
|
||||||
|
application/msword doc;
|
||||||
|
application/pdf pdf;
|
||||||
|
application/postscript ps eps ai;
|
||||||
|
application/rtf rtf;
|
||||||
|
application/vnd.apple.mpegurl m3u8;
|
||||||
|
application/vnd.google-earth.kml+xml kml;
|
||||||
|
application/vnd.google-earth.kmz kmz;
|
||||||
|
application/vnd.ms-excel xls;
|
||||||
|
application/vnd.ms-fontobject eot;
|
||||||
|
application/vnd.ms-powerpoint ppt;
|
||||||
|
application/vnd.oasis.opendocument.graphics odg;
|
||||||
|
application/vnd.oasis.opendocument.presentation odp;
|
||||||
|
application/vnd.oasis.opendocument.spreadsheet ods;
|
||||||
|
application/vnd.oasis.opendocument.text odt;
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.presentation
|
||||||
|
pptx;
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||||
|
xlsx;
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||||
|
docx;
|
||||||
|
application/vnd.wap.wmlc wmlc;
|
||||||
|
application/x-7z-compressed 7z;
|
||||||
|
application/x-cocoa cco;
|
||||||
|
application/x-java-archive-diff jardiff;
|
||||||
|
application/x-java-jnlp-file jnlp;
|
||||||
|
application/x-makeself run;
|
||||||
|
application/x-perl pl pm;
|
||||||
|
application/x-pilot prc pdb;
|
||||||
|
application/x-rar-compressed rar;
|
||||||
|
application/x-redhat-package-manager rpm;
|
||||||
|
application/x-sea sea;
|
||||||
|
application/x-shockwave-flash swf;
|
||||||
|
application/x-stuffit sit;
|
||||||
|
application/x-tcl tcl tk;
|
||||||
|
application/x-x509-ca-cert der pem crt;
|
||||||
|
application/x-xpinstall xpi;
|
||||||
|
application/xhtml+xml xhtml;
|
||||||
|
application/xspf+xml xspf;
|
||||||
|
application/zip zip;
|
||||||
|
|
||||||
|
application/octet-stream bin exe dll;
|
||||||
|
application/octet-stream deb;
|
||||||
|
application/octet-stream dmg;
|
||||||
|
application/octet-stream iso img;
|
||||||
|
application/octet-stream msi msp msm;
|
||||||
|
|
||||||
|
audio/midi mid midi kar;
|
||||||
|
audio/mpeg mp3;
|
||||||
|
audio/ogg ogg;
|
||||||
|
audio/x-m4a m4a;
|
||||||
|
audio/x-realaudio ra;
|
||||||
|
|
||||||
|
video/3gpp 3gpp 3gp;
|
||||||
|
video/mp2t ts;
|
||||||
|
video/mp4 mp4;
|
||||||
|
video/mpeg mpeg mpg;
|
||||||
|
video/quicktime mov;
|
||||||
|
video/webm webm;
|
||||||
|
video/x-flv flv;
|
||||||
|
video/x-m4v m4v;
|
||||||
|
video/x-mng mng;
|
||||||
|
video/x-ms-asf asx asf;
|
||||||
|
video/x-ms-wmv wmv;
|
||||||
|
video/x-msvideo avi;
|
||||||
|
}
|
||||||
15
scrutiny_fa/rootfs/etc/nginx/includes/proxy_params.conf
Normal file
15
scrutiny_fa/rootfs/etc/nginx/includes/proxy_params.conf
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_ignore_client_abort off;
|
||||||
|
proxy_read_timeout 86400s;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_send_timeout 86400s;
|
||||||
|
proxy_max_temp_file_size 0;
|
||||||
|
|
||||||
|
proxy_set_header Accept-Encoding "";
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
1
scrutiny_fa/rootfs/etc/nginx/includes/resolver.conf
Normal file
1
scrutiny_fa/rootfs/etc/nginx/includes/resolver.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
resolver 127.0.0.11;
|
||||||
6
scrutiny_fa/rootfs/etc/nginx/includes/server_params.conf
Normal file
6
scrutiny_fa/rootfs/etc/nginx/includes/server_params.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
root /dev/null;
|
||||||
|
server_name $hostname;
|
||||||
|
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Robots-Tag none;
|
||||||
9
scrutiny_fa/rootfs/etc/nginx/includes/ssl_params.conf
Normal file
9
scrutiny_fa/rootfs/etc/nginx/includes/ssl_params.conf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
ssl_protocols TLSv1.2;
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;
|
||||||
|
ssl_ecdh_curve secp384r1;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_tickets off;
|
||||||
|
ssl_stapling on;
|
||||||
|
ssl_stapling_verify on;
|
||||||
3
scrutiny_fa/rootfs/etc/nginx/includes/upstream.conf
Normal file
3
scrutiny_fa/rootfs/etc/nginx/includes/upstream.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
upstream backend {
|
||||||
|
server 127.0.0.1:8080;
|
||||||
|
}
|
||||||
56
scrutiny_fa/rootfs/etc/nginx/nginx.conf
Normal file
56
scrutiny_fa/rootfs/etc/nginx/nginx.conf
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Run nginx in foreground.
|
||||||
|
daemon off;
|
||||||
|
|
||||||
|
# This is run inside Docker.
|
||||||
|
user root;
|
||||||
|
|
||||||
|
# Pid storage location.
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
# Set number of worker processes.
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
# Enables the use of JIT for regular expressions to speed-up their processing.
|
||||||
|
pcre_jit on;
|
||||||
|
|
||||||
|
# Write error log to Hass.io add-on log.
|
||||||
|
error_log /proc/1/fd/1 error;
|
||||||
|
|
||||||
|
# Load allowed environment vars
|
||||||
|
env HASSIO_TOKEN;
|
||||||
|
|
||||||
|
# Load dynamic modules.
|
||||||
|
include /etc/nginx/modules/*.conf;
|
||||||
|
|
||||||
|
# Max num of simultaneous connections by a worker process.
|
||||||
|
events {
|
||||||
|
worker_connections 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/includes/mime.types;
|
||||||
|
|
||||||
|
log_format hassio '[$time_local] $status '
|
||||||
|
'$http_x_forwarded_for($remote_addr) '
|
||||||
|
'$request ($http_user_agent)';
|
||||||
|
|
||||||
|
access_log /proc/1/fd/1 hassio;
|
||||||
|
client_max_body_size 4G;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
gzip on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
sendfile on;
|
||||||
|
server_tokens off;
|
||||||
|
tcp_nodelay on;
|
||||||
|
tcp_nopush on;
|
||||||
|
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
|
include /etc/nginx/includes/resolver.conf;
|
||||||
|
include /etc/nginx/includes/upstream.conf;
|
||||||
|
|
||||||
|
include /etc/nginx/servers/*.conf;
|
||||||
|
}
|
||||||
21
scrutiny_fa/rootfs/etc/nginx/servers/ingress.conf
Normal file
21
scrutiny_fa/rootfs/etc/nginx/servers/ingress.conf
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
server {
|
||||||
|
listen %%interface%%:%%port%% default_server;
|
||||||
|
|
||||||
|
include /etc/nginx/includes/server_params.conf;
|
||||||
|
include /etc/nginx/includes/proxy_params.conf;
|
||||||
|
|
||||||
|
client_max_body_size 0;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
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/;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
8
scrutiny_fa/rootfs/etc/services.d/nginx/finish
Normal file
8
scrutiny_fa/rootfs/etc/services.d/nginx/finish
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/execlineb -S0
|
||||||
|
# ==============================================================================
|
||||||
|
# Take down the S6 supervision tree when Nginx fails
|
||||||
|
# ==============================================================================
|
||||||
|
if { s6-test ${1} -ne 0 }
|
||||||
|
if { s6-test ${1} -ne 256 }
|
||||||
|
|
||||||
|
s6-svscanctl -t /var/run/s6/services
|
||||||
10
scrutiny_fa/rootfs/etc/services.d/nginx/run
Normal file
10
scrutiny_fa/rootfs/etc/services.d/nginx/run
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
# Wait for transmission to become available
|
||||||
|
bashio::net.wait_for 8080 localhost 900
|
||||||
|
|
||||||
|
bashio::log.info "Starting NGinx..."
|
||||||
|
|
||||||
|
exec nginx
|
||||||
13
scrutiny_fa/rootfs/run.sh
Normal file
13
scrutiny_fa/rootfs/run.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/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"
|
||||||
Reference in New Issue
Block a user