diff options
author | maxice8 <30738253+maxice8@users.noreply.github.com> | 2024-09-29 11:53:13 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-29 09:53:13 -0500 |
commit | 429672e0b4b8ff0978924fdd0a06b90cccf59773 (patch) | |
tree | 05decef8b4e726b9cd63b2e2d9a0ce8253047ede | |
parent | 605fd6d726ec20c9e70f3a63e9e31995339f9a01 (diff) |
docs(docker): add healthcheck to docker-compose (#9742)
### Purpose
Syncthing had a healthcheck API for a while, and the example Dockerfile
for it has it in the form of:
HEALTHCHECK --interval=1m --timeout=10s \
CMD curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o
--color=never OK || exit 1
Let's add it to the docker-compose as well
### Testing
I use this docker-compose.yml file to deploy via ansible (using
community.docker.docker_compose_v2) to my machine with success, using
`wait: true` in ansible for it to use `docker compose up --wait`.
```yml
- name: Enable syncthing docker
community.docker.docker_compose_v2:
project_src: /srv/syncthing
wait: true
wait_timeout: 90
```
-rw-r--r-- | README-Docker.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/README-Docker.md b/README-Docker.md index 02b0dc5d7b..5d7a736c37 100644 --- a/README-Docker.md +++ b/README-Docker.md @@ -49,6 +49,11 @@ services: - 22000:22000/udp # QUIC file transfers - 21027:21027/udp # Receive local discovery broadcasts restart: unless-stopped + healthcheck: + test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1 + interval: 1m + timeout: 10s + retries: 3 ``` ## Discovery @@ -84,6 +89,11 @@ services: - /wherever/st-sync:/var/syncthing network_mode: host restart: unless-stopped + healthcheck: + test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1 + interval: 1m + timeout: 10s + retries: 3 ``` Be aware that syncthing alone is now in control of what interfaces and ports it |