Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ENV AUTOHEAL_CONTAINER_LABEL=autoheal \
AUTOHEAL_DEFAULT_STOP_TIMEOUT=10 \
DOCKER_SOCK=/var/run/docker.sock \
CURL_TIMEOUT=30 \
WEBHOOK_URL=""
WEBHOOK_URL="" \
WEBHOOK_JSON_KEY="text"

HEALTHCHECK --interval=5s CMD pgrep -f autoheal || exit 1

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ AUTOHEAL_DEFAULT_STOP_TIMEOUT=10 # Docker waits max 10 seconds (the Docker def
DOCKER_SOCK=/var/run/docker.sock # Unix socket for curl requests to Docker API
CURL_TIMEOUT=30 # --max-time seconds for curl requests to Docker API
WEBHOOK_URL="" # post message to the webhook if a container was restarted (or restart failed)
WEBHOOK_JSON_KEY="text" # the key to use for the message in the json body of the request to the webhook url
```

### Optional Container Labels
Expand Down
3 changes: 2 additions & 1 deletion docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ DOCKER_SOCK=${DOCKER_SOCK:-/var/run/docker.sock}
UNIX_SOCK=""
CURL_TIMEOUT=${CURL_TIMEOUT:-30}
WEBHOOK_URL=${WEBHOOK_URL:-""}
WEBHOOK_JSON_KEY=${WEBHOOK_JSON_KEY:-"text"}

# only use unix domain socket if no TCP endpoint is defined
case "${DOCKER_SOCK}" in
Expand Down Expand Up @@ -72,7 +73,7 @@ generate_webhook_payload() {
local text="$@"
cat <<EOF
{
"text":"$text"
"$WEBHOOK_JSON_KEY":"$text"
}
EOF
}
Expand Down