From 1ec2961b3b214c7af4b541396adc94948b626c47 Mon Sep 17 00:00:00 2001 From: Michael Kaye <1917473+michaelkaye@users.noreply.github.com> Date: Fri, 17 Jul 2020 18:25:48 +0100 Subject: Add help for creating a user via docker (#7885) --- docker/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docker/README.md') diff --git a/docker/README.md b/docker/README.md index 8c337149ca..008a9ff708 100644 --- a/docker/README.md +++ b/docker/README.md @@ -94,6 +94,21 @@ The following environment variables are supported in run mode: * `UID`, `GID`: the user and group id to run Synapse as. Defaults to `991`, `991`. * `TZ`: the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) the container will run with. Defaults to `UTC`. +## Generating an (admin) user + +After synapse is running, you may wish to create a user via `register_new_matrix_user`. + +This requires a `registration_shared_secret` to be set in your config file. Synapse +must be restarted to pick up this change. + +You can then call the script: + +``` +docker exec -it synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml --help +``` + +Remember to remove the `registration_shared_secret` and restart if you no-longer need it. + ## TLS support The default configuration exposes a single HTTP port: http://localhost:8008. It -- cgit 1.5.1 From 64e8a4697abd84329aa59877b9bca5704d9e0f4c Mon Sep 17 00:00:00 2001 From: Christopher May-Townsend Date: Mon, 24 Aug 2020 18:15:18 +0100 Subject: Add healthcheck for default localhost 8008 port on /health endpoint. (#8147) --- changelog.d/8147.docker | 1 + docker/Dockerfile | 4 ++++ docker/README.md | 29 +++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 changelog.d/8147.docker (limited to 'docker/README.md') diff --git a/changelog.d/8147.docker b/changelog.d/8147.docker new file mode 100644 index 0000000000..dcc951d8f5 --- /dev/null +++ b/changelog.d/8147.docker @@ -0,0 +1 @@ +Added curl for healthcheck support and readme updates for the change. Contributed by @maquis196. diff --git a/docker/Dockerfile b/docker/Dockerfile index 8b3a4246a5..432d56a8ee 100644 --- a/docker/Dockerfile +++ b/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 diff --git a/docker/README.md b/docker/README.md index 008a9ff708..d0da34778e 100644 --- a/docker/README.md +++ b/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 +``` -- cgit 1.5.1