瀏覽代碼

Add healthcheck for default localhost 8008 port on /health endpoint. (#8147)

tags/v1.20.0rc1
Christopher May-Townsend 3 年之前
committed by GitHub
父節點
當前提交
64e8a4697a
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 3 個文件被更改,包括 34 次插入0 次删除
  1. +1
    -0
      changelog.d/8147.docker
  2. +4
    -0
      docker/Dockerfile
  3. +29
    -0
      docker/README.md

+ 1
- 0
changelog.d/8147.docker 查看文件

@@ -0,0 +1 @@
Added curl for healthcheck support and readme updates for the change. Contributed by @maquis196.

+ 4
- 0
docker/Dockerfile 查看文件

@@ -55,6 +55,7 @@ RUN pip install --prefix="/install" --no-warn-script-location \
FROM docker.io/python:${PYTHON_VERSION}-slim

RUN apt-get update && apt-get install -y \
curl \
libpq5 \
xmlsec1 \
gosu \
@@ -69,3 +70,6 @@ VOLUME ["/data"]
EXPOSE 8008/tcp 8009/tcp 8448/tcp

ENTRYPOINT ["/start.py"]

HEALTHCHECK --interval=1m --timeout=5s \
CMD curl -fSs http://localhost:8008/health || exit 1

+ 29
- 0
docker/README.md 查看文件

@@ -162,3 +162,32 @@ docker build -t matrixdotorg/synapse -f docker/Dockerfile .

You can choose to build a different docker image by changing the value of the `-f` flag to
point to another Dockerfile.

## Disabling the healthcheck

If you are using a non-standard port or tls inside docker you can disable the healthcheck
whilst running the above `docker run` commands.

```
--no-healthcheck
```
## Setting custom healthcheck on docker run

If you wish to point the healthcheck at a different port with docker command, add the following

```
--health-cmd 'curl -fSs http://localhost:1234/health'
```

## Setting the healthcheck in docker-compose file

You can add the following to set a custom healthcheck in a docker compose file.
You will need version >2.1 for this to work.

```
healthcheck:
test: ["CMD", "curl", "-fSs", "http://localhost:8008/health"]
interval: 1m
timeout: 10s
retries: 3
```

Loading…
取消
儲存