Skip to content

Commit

Permalink
Merge pull request #201 from jammsen/develop
Browse files Browse the repository at this point in the history
Merge to master
  • Loading branch information
jammsen authored Feb 14, 2024
2 parents 032b904 + dd1a9ed commit ab84f25
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 11 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down Expand Up @@ -127,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 \
Expand Down Expand Up @@ -168,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"]
Expand Down
1 change: 1 addition & 0 deletions default.env
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions docs/ENV_VARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<br>`auto`: Settings are modified only by environment variables, manual edits will be ignored<br>`manual`: Settings are modified only by editing the file directly, environment variables are ignored |
Expand Down
17 changes: 10 additions & 7 deletions includes/webhook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
generate_post_data() {
cat <<EOF
{
"content": "",
"content": "Status update",
"embeds": [{
"title": "$1",
"description": "$2",
Expand All @@ -19,12 +19,15 @@ EOF
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"
local linecolor="$3"

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" "$linecolor")" "$WEBHOOK_URL"
else
# Prod Curl
curl --silent --ssl-no-revoke -H "Content-Type: application/json" -X POST -d "$(generate_post_data "$title" "$description" "$linecolor")" "$WEBHOOK_URL"
fi
}

#Aliases to use in scripts
Expand Down

0 comments on commit ab84f25

Please sign in to comment.