From bdb39a1d2cca81078ecb109dd860149afec1543c Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Sat, 25 Mar 2023 04:08:11 +0100 Subject: [PATCH] add docker-swarm-usage.md reference to host-your-own.md and tidy up docker-swarm-usage.md --- docs/docker-swarm-usage.md | 39 +++++++++++++++++++++++++++++++------- docs/host-your-own.md | 4 ++++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/docs/docker-swarm-usage.md b/docs/docker-swarm-usage.md index 7a28350..ae2c97e 100644 --- a/docs/docker-swarm-usage.md +++ b/docs/docker-swarm-usage.md @@ -2,17 +2,42 @@ ## Healthcheck -The Docker Image includes a Healthcheck with the following options (Look at Dockerfile): +The [Docker Image](../Dockerfile) includes a Healthcheck with the following options: ---interval=30s: This option specifies the time interval at which the health check should be performed. In this case, the health check will be performed every 30 seconds. +``` +--interval=30s +``` +> Specifies the time interval at which the health check should be performed. In this case, the health check will be performed every 30 seconds. ---timeout=10s: This option specifies the amount of time to wait for a response from the health check command. If the response does not arrive within 10 seconds, the health check will be considered a failure. +
---start-period=5s: This option specifies the amount of time to wait before starting the health check process. In this case, the health check process will begin 5 seconds after the container is started. +``` +--timeout=10s +``` +> Specifies the amount of time to wait for a response from the health check command. If the response does not arrive within 10 seconds, the health check will be considered a failure. ---retries=3: This option specifies the number of times Docker should retry the health check before considering the container to be unhealthy. +
-The CMD instruction is used to define the command that will be run as part of the health check. In this case, the command is "wget --quiet --tries=1 --spider http://localhost:3000/ || exit 1". This command will attempt to connect to http://localhost:3000/ and if it fails, it will exit with a status code of 1. If this command returns a status code other than 0, the health check will be considered a failure. +``` +--start-period=5s +``` +> Specifies the amount of time to wait before starting the health check process. In this case, the health check process will begin 5 seconds after the container is started. -Overall, this HEALTHCHECK instruction is defining a health check process that will run every 30 seconds, wait up to 10 seconds for a response, begin 5 seconds after the container is started, and retry up to 3 times. The health check will consist of attempting to connect to http://localhost:3000/ and will consider the container to be unhealthy if it is unable to connect. +
+ +``` +--retries=3 +``` +> Specifies the number of times Docker should retry the health check before considering the container to be unhealthy. + +
+ + +The CMD instruction is used to define the command that will be run as part of the health check. +In this case, the command is `wget --quiet --tries=1 --spider http://localhost:3000/ || exit 1`. This command will attempt to connect to `http://localhost:3000/` +and if it fails it will exit with a status code of `1`. If this command returns a status code other than `0`, the health check will be considered a failure. + +Overall, this HEALTHCHECK instruction is defining a health check process that will run every 30 seconds, wait up to 10 seconds for a response, +begin 5 seconds after the container is started, and retry up to 3 times. +The health check will consist of attempting to connect to http://localhost:3000/ and will consider the container to be unhealthy if it is unable to connect. diff --git a/docs/host-your-own.md b/docs/host-your-own.md index 6209895..f93f27a 100644 --- a/docs/host-your-own.md +++ b/docs/host-your-own.md @@ -82,6 +82,8 @@ docker run -d --restart=unless-stopped --name=pairdrop -p 127.0.0.1:3000:3000 gh > > To specify options replace `npm run start:prod` according to [the documentation below.](#options--flags-1) +> The Docker Image includes a Healthcheck. To learn more see [Docker Swarm Usage](./docker-swarm-usage.md#docker-swarm-usage) + ### Docker Image self-built #### Build the image ```bash @@ -101,6 +103,8 @@ docker run -d --restart=unless-stopped --name=pairdrop -p 127.0.0.1:3000:3000 -i > > To specify options replace `npm run start:prod` according to [the documentation below.](#options--flags-1) +> The Docker Image includes a Healthcheck. To learn more see [Docker Swarm Usage](./docker-swarm-usage.md#docker-swarm-usage) +
## Deployment with Docker Compose