From bb83b4b8bd6c9e9e14620b1785d0a36e0939edc2 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Thu, 21 Mar 2024 08:54:08 +1100 Subject: [PATCH] removal of unnecessary env variables --- .env | 2 -- docker-compose.yml | 2 -- dockerfiles/README.md | 8 -------- dockerfiles/setup.sh | 18 ++++-------------- docs/DEBUG_PLUGINS.md | 4 ++++ docs/DEBUG_TIPS.md | 1 - docs/REVERSE_DNS.md | 2 -- 7 files changed, 8 insertions(+), 29 deletions(-) diff --git a/.env b/.env index a7092470..9344583d 100755 --- a/.env +++ b/.env @@ -7,8 +7,6 @@ LOGS_LOCATION=/path/to/docker_logs #ENVIRONMENT VARIABLES TZ=Europe/Paris -HOST_USER_ID=1000 -HOST_USER_GID=1000 PORT=20211 #DEVELOPMENT VARIABLES diff --git a/docker-compose.yml b/docker-compose.yml index f68481aa..120d5391 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -62,7 +62,5 @@ services: environment: - TZ=${TZ} - PORT=${PORT} - - HOST_USER_ID=${HOST_USER_ID} - - HOST_USER_GID=${HOST_USER_GID} # ❗ DANGER ZONE BELOW - Setting ALWAYS_FRESH_INSTALL=true will delete the content of the /db & /config folders - ALWAYS_FRESH_INSTALL=${ALWAYS_FRESH_INSTALL} diff --git a/dockerfiles/README.md b/dockerfiles/README.md index f363968b..e7668402 100755 --- a/dockerfiles/README.md +++ b/dockerfiles/README.md @@ -40,8 +40,6 @@ docker run -d --rm --network=host \ | `PORT` |Port of the web interface | `20211` | | `LISTEN_ADDR` |Set the specific IP Address for the listener address for the nginx webserver (web interface). This could be useful when using multiple subnets to hide the web interface from all untrusted networks. | `0.0.0.0` | |`TZ` |Time zone to display stats correctly. Find your time zone [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | `Europe/Berlin` | -|`HOST_USER_GID` |User ID (UID) to map the user in the container to a server user with sufficient read&write permissions on the mapped files | `1000` | -|`HOST_USER_ID` |User Group ID (GID) to map the user group in the container to a server user group with sufficient read&write permissions on the mapped files | `1000` | |`ALWAYS_FRESH_INSTALL` | Setting `ALWAYS_FRESH_INSTALL=true` will delete the content of the `/db` & `/config` folders. For testing purposes. Can be coupled with [watchtower](https://github.com/containrrr/watchtower) to have an always freshly installed `pi.alert`/`_dev` image. | `N/A` | ### Docker paths @@ -137,8 +135,6 @@ services: - local/path/logs:/home/pi/pialert/front/log environment: - TZ=Europe/Berlin - - HOST_USER_ID=1000 - - HOST_USER_GID=1000 - PORT=20211 ``` @@ -188,8 +184,6 @@ services: - ${LOGS_LOCATION}:/home/pi/pialert/front/log environment: - TZ=${TZ} - - HOST_USER_ID=${HOST_USER_ID} - - HOST_USER_GID=${HOST_USER_GID} - PORT=${PORT} ``` @@ -205,8 +199,6 @@ LOGS_LOCATION=/path/to/docker_logs #ENVIRONMENT VARIABLES TZ=Europe/Paris -HOST_USER_ID=1000 -HOST_USER_GID=1000 PORT=20211 #DEVELOPMENT VARIABLES diff --git a/dockerfiles/setup.sh b/dockerfiles/setup.sh index 8cfd0b65..495ef2e7 100755 --- a/dockerfiles/setup.sh +++ b/dockerfiles/setup.sh @@ -34,21 +34,11 @@ fi cp -na "${INSTALL_DIR}/pialert/back/pialert.conf" "${INSTALL_DIR}/pialert/config/pialert.conf" cp -na "${INSTALL_DIR}/pialert/back/pialert.db" "${FILEDB}" -# # if custom variables not set we do not need to do anything -# if [ -n "${TZ}" ]; then -# FILECONF="${INSTALL_DIR}/pialert/config/pialert.conf" -# echo "[INSTALL] Setup timezone" -# sed -i "\#^TIMEZONE=#c\TIMEZONE='${TZ}'" "${FILECONF}" -# fi - # if custom variables not set we do not need to do anything -if [ -n "${TZ}" ]; then - FILECONF=$INSTALL_DIR/pialert/config/pialert.conf - if [ -f "$FILECONF" ]; then - sed -ie "s|Europe/Berlin|${TZ}|g" $INSTALL_DIR/pialert/config/pialert.conf - else - sed -ie "s|Europe/Berlin|${TZ}|g" $INSTALL_DIR/pialert/back/pialert.conf_bak - fi +if [ -n "${TZ}" ]; then + FILECONF="${INSTALL_DIR}/pialert/config/pialert.conf" + echo "[INSTALL] Setup timezone" + sed -i "\#^TIMEZONE=#c\TIMEZONE='${TZ}'" "${FILECONF}" fi echo "[INSTALL] Setup NGINX" diff --git a/docs/DEBUG_PLUGINS.md b/docs/DEBUG_PLUGINS.md index a32e6311..387726fd 100755 --- a/docs/DEBUG_PLUGINS.md +++ b/docs/DEBUG_PLUGINS.md @@ -35,6 +35,7 @@ Input data from the plugin might cause mapping issues in specific edge cases. Lo 17:31:05 [Plugins] base64 value: b'MTkyLjE2OC4xLjAvMjQgLS1pbnRlcmZhY2U9ZXRoMQ==' 17:31:05 [Plugins] Timeout: 10 17:31:05 [Plugins] Executing: SELECT n.hwaddr AS Object_PrimaryID, 'null' AS Object_SecondaryID, datetime() AS DateTime, na.ip AS Watched_Value1, n.lastQuery AS Watched_Value2, na.name AS Watched_Value3, n.macVendor AS Watched_Value4, 'null' AS Extra, n.hwaddr AS ForeignKey FROM EXTERNAL_PIHOLE.Network AS n LEFT JOIN EXTERNAL_PIHOLE.Network_Addresses AS na ON na.network_id = n.id WHERE n.hwaddr NOT LIKE 'ip-%' AND n.hwaddr is not '00:00:00:00:00:00' AND na.ip is not null +🔻 17:31:05 [Plugins] SUCCESS, received 2 entries 17:31:05 [Plugins] sqlParam entries: [(0, 'PIHOLE', '01:01:01:01:01:01', 'null', 'null', '2023-12-25 06:31:05', '172.30.0.1', 0, 'aaaa', 'vvvvvvvvv', 'not-processed', 'null', 'null', '01:01:01:01:01:01'), (0, 'PIHOLE', '02:42:ac:1e:00:02', 'null', 'null', '2023-12-25 06:31:05', '172.30.0.2', 0, 'dddd', 'vvvvv2222', 'not-processed', 'null', 'null', '02:42:ac:1e:00:02')] 17:31:05 [Plugins] Processing : PIHOLE @@ -52,10 +53,13 @@ Input data from the plugin might cause mapping issues in specific edge cases. Lo 17:31:05 [Plugins] Mapping objects to database table: CurrentScan 17:31:05 [Plugins] SQL query for mapping: INSERT into CurrentScan ( "cur_MAC", "cur_IP", "cur_LastQuery", "cur_Name", "cur_Vendor", "cur_ScanMethod") VALUES ( ?, ?, ?, ?, ?, ?) 17:31:05 [Plugins] SQL sqlParams for mapping: [('01:01:01:01:01:01', '172.30.0.1', 0, 'aaaa', 'vvvvvvvvv', 'PIHOLE'), ('02:42:ac:1e:00:02', '172.30.0.2', 0, 'dddd', 'vvvvv2222', 'PIHOLE')] +🔺 17:31:05 [API] Update API starting 17:31:06 [API] Updating table_plugins_history.json file in /front/api ``` +> The debug output between the 🔻red arrows🔺 is important for debugging (arrows added only to highlight the section on this page, they are not available in teh actual debug log) + In the above output notice the section logging how many events are produced by the plugin: ``` diff --git a/docs/DEBUG_TIPS.md b/docs/DEBUG_TIPS.md index 3043be95..847af421 100755 --- a/docs/DEBUG_TIPS.md +++ b/docs/DEBUG_TIPS.md @@ -55,7 +55,6 @@ services: * If facing issues (AJAX errors, can't write to DB, empty screen, etc,) make sure permissions are set correctly, and check the logs under `/home/pi/pialert/front/log`. * To solve permission issues you can try setting the owner and group of the `pialert.db` by executing the following on the host system: `docker exec pialert chown -R www-data:www-data /home/pi/pialert/db/pialert.db`. -* Map to local User and Group IDs. Specify the enviroment variables `HOST_USER_ID` and `HOST_USER_GID` if needed. * If still facing issues, try to map the pialert.db file (⚠ not folder) to `:/home/pi/pialert/db/pialert.db` (see [docker-compose Examples](https://github.com/jokob-sk/Pi.Alert/blob/main/dockerfiles/README.md#-docker-composeyml-examples) for details) ### Container restarts / crashes diff --git a/docs/REVERSE_DNS.md b/docs/REVERSE_DNS.md index 1d03b1a0..eb3e2010 100755 --- a/docs/REVERSE_DNS.md +++ b/docs/REVERSE_DNS.md @@ -48,8 +48,6 @@ services: environment: - TZ=Europe/Berlin - PORT=20211 - - HOST_USER_ID=1000 - - HOST_USER_GID=1000 ports: - "20211:20211" network_mode: host