From 75926c6128f8b1a55e557a764415455ae5686aeb Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt <2270806+jammsen@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:41:24 +0100 Subject: [PATCH 1/2] Added the option to enable webhook curl debugging for weird error edge-cases --- CHANGELOG.md | 4 ++++ Dockerfile | 1 + default.env | 1 + docs/ENV_VARS.md | 1 + includes/webhook.sh | 13 ++++++++----- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9fb86..cf426ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ [Back to main](README.md#changelog) +## 2024-02-13 + +* Added the option to enable webhook curl debugging for weird error edge-cases + ## 2024-02-13 * **Breaking changes:** * Changed the default BACKUP_RETENTION_POLICY to true and changed BACKUP_RETENTION_AMOUNT_TO_KEEP to 72, meaning 3 days worth of backup are kept in the default configuration diff --git a/Dockerfile b/Dockerfile index b42cba5..1434606 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,6 +34,7 @@ ENV DEBIAN_FRONTEND=noninteractive \ RESTART_CRON_EXPRESSION="0 3,15 * * *" \ # Webhook-settings WEBHOOK_ENABLED=false \ + WEBHOOK_DEBUG_ENABLED=false \ WEBHOOK_URL= \ WEBHOOK_INFO_TITLE="Info" \ WEBHOOK_INFO_DESCRIPTION="This is an info from the server" \ diff --git a/default.env b/default.env index 4d92349..4f96cf9 100644 --- a/default.env +++ b/default.env @@ -15,6 +15,7 @@ RESTART_ENABLED=false RESTART_CRON_EXPRESSION="0 3,15 * * *" # Webhook-settings WEBHOOK_ENABLED=false +WEBHOOK_DEBUG_ENABLED=false WEBHOOK_URL="YOUR-URL-IN-HERE" WEBHOOK_INFO_TITLE="Info" WEBHOOK_INFO_DESCRIPTION="This is an info from the server" diff --git a/docs/ENV_VARS.md b/docs/ENV_VARS.md index 89678db..215689d 100644 --- a/docs/ENV_VARS.md +++ b/docs/ENV_VARS.md @@ -24,6 +24,7 @@ These settings control the behavior of the Docker container: | RESTART_ENABLED | Automatic restarts the server | false | Boolean | | RESTART_CRON_EXPRESSION | Needs a Cron-Expression - See [Cron expression](#cron-expression) | 0 3,15 * * * | Cron-Expression | | WEBHOOK_ENABLED | Set to enabled will send webhook notifications, NEEDS `WEBHOOK_URL` | false | Boolean | +| WEBHOOK_DEBUG_ENABLED | Set to enabled will enable feedback of curl and not use --silent | false | Boolean | | WEBHOOK_URL | Defines the url the webhook to send data to | | Url | | WEBHOOK_* | See below the table "Webhook environment variables" | | String | | SERVER_SETTINGS_MODE | Determines whether settings can be modified via environment variables or via file, except `COMMUNITY_SERVER` and `MULTITHREAD_ENABLED`! | `auto` | Enum
`auto`: Settings are modified only by environment variables, manual edits will be ignored
`manual`: Settings are modified only by editing the file directly, environment variables are ignored | diff --git a/includes/webhook.sh b/includes/webhook.sh index 52224fb..d319abf 100644 --- a/includes/webhook.sh +++ b/includes/webhook.sh @@ -20,11 +20,14 @@ send_webhook_notification() { local title="$1" local description="$2" local color="$3" - - # Debug Curl - #curl --ssl-no-revoke -H "Content-Type: application/json" -X POST -d "$(generate_post_data "$title" "$description" "$color")" "$WEBHOOK_URL" - # Prod Curl - curl --silent --ssl-no-revoke -H "Content-Type: application/json" -X POST -d "$(generate_post_data "$title" "$description" "$color")" "$WEBHOOK_URL" + + if [[ -n $WEBHOOK_DEBUG_ENABLED ]] && [[ $WEBHOOK_DEBUG_ENABLED == "true" ]]; then + # Debug Curl + curl --ssl-no-revoke -H "Content-Type: application/json" -X POST -d "$(generate_post_data "$title" "$description" "$color")" "$WEBHOOK_URL" + else + # Prod Curl + curl --silent --ssl-no-revoke -H "Content-Type: application/json" -X POST -d "$(generate_post_data "$title" "$description" "$color")" "$WEBHOOK_URL" + fi } #Aliases to use in scripts From dd1a9ede90ab51ce467e47c8a3d9ab489d07aa8c Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt <2270806+jammsen@users.noreply.github.com> Date: Wed, 14 Feb 2024 17:12:14 +0100 Subject: [PATCH 2/2] Bugfix for webhook.sh --- Dockerfile | 20 ++++++++++---------- includes/webhook.sh | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1434606..c709d9c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -128,16 +128,6 @@ ENV DEBIAN_FRONTEND=noninteractive \ EXPOSE 8211/udp EXPOSE 25575/tcp -COPY --chmod=755 entrypoint.sh / -COPY --chmod=755 scripts/ /scripts -COPY --chmod=755 includes/ /includes -COPY --chmod=755 configs/rcon.yaml /home/steam/steamcmd/rcon.yaml - -RUN mkdir -p "$BACKUP_PATH" \ - && ln -s /scripts/backupmanager.sh /usr/local/bin/backup \ - && ln -s /scripts/rconcli.sh /usr/local/bin/rconcli \ - && ln -s /scripts/restart.sh /usr/local/bin/restart - # Install minimum required packages for dedicated server RUN apt-get update \ && apt-get install -y --no-install-recommends --no-install-suggests gosu procps xdg-user-dirs \ @@ -169,6 +159,16 @@ RUN curl -fsSLO "$RCON_URL" \ && mv "rcon-0.10.3-amd64_linux/$RCON_BINARY" "/usr/local/bin/${RCON_BINARY}" \ && rm -Rf rcon-0.10.3-amd64_linux rcon-0.10.3-amd64_linux.tar.gz +COPY --chmod=755 entrypoint.sh / +COPY --chmod=755 scripts/ /scripts +COPY --chmod=755 includes/ /includes +COPY --chmod=755 configs/rcon.yaml /home/steam/steamcmd/rcon.yaml + +RUN mkdir -p "$BACKUP_PATH" \ + && ln -s /scripts/backupmanager.sh /usr/local/bin/backup \ + && ln -s /scripts/rconcli.sh /usr/local/bin/rconcli \ + && ln -s /scripts/restart.sh /usr/local/bin/restart + VOLUME ["${GAME_ROOT}"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/includes/webhook.sh b/includes/webhook.sh index d319abf..4b894a1 100644 --- a/includes/webhook.sh +++ b/includes/webhook.sh @@ -6,7 +6,7 @@ generate_post_data() { cat <