From 5cb75fc492de32f2faddbdd15373f2bf1e5ca24b Mon Sep 17 00:00:00 2001 From: nibblebit Date: Tue, 25 Jul 2023 22:53:31 +0200 Subject: [PATCH 1/5] Added autoheal to docker compose --- templates/docker-compose.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/templates/docker-compose.yml b/templates/docker-compose.yml index dbc8b82..ba75ccb 100644 --- a/templates/docker-compose.yml +++ b/templates/docker-compose.yml @@ -34,6 +34,13 @@ services: depends_on: - postgres - pictrs + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8536"] + interval: 1m + timeout: 10s + retries: 3 + labels: + - "autoheal=true" lemmy-ui: image: {{ lemmy_docker_ui_image }} @@ -93,3 +100,12 @@ services: - POSTFIX_myhostname={{ domain }} restart: "always" logging: *default-logging + + autoheal: + restart: always + image: willfarrell/autoheal + environment: + - AUTOHEAL_CONTAINER_LABEL=autoheal + + volumes: + - /var/run/docker.sock:/var/run/docker.sock \ No newline at end of file From 7f63ef6a3522b13bcce4faa32a6ebdc4c3ea6d23 Mon Sep 17 00:00:00 2001 From: nibblebit Date: Wed, 9 Aug 2023 00:02:11 +0200 Subject: [PATCH 2/5] Added simpler autoheal --- templates/docker-compose.yml | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/templates/docker-compose.yml b/templates/docker-compose.yml index b546c97..6430911 100644 --- a/templates/docker-compose.yml +++ b/templates/docker-compose.yml @@ -8,7 +8,7 @@ x-logging: &default-logging services: proxy: - image: nginx:1-alpine + image: nginx:1-alpine ports: # actual and only port facing any connection from outside # Note, change the left number if port 1236 is already in use on your system @@ -25,7 +25,12 @@ services: lemmy: image: {{ lemmy_docker_image }} hostname: lemmy - restart: always + restart: on-failure + healthcheck: + test: ["CMD-SHELL", "wget -S -T 5 --spider -q http://localhost:8536 || exit 1"] + interval: 1m30s + timeout: 10s + retries: 3 logging: *default-logging environment: - RUST_LOG="warn" @@ -34,13 +39,6 @@ services: depends_on: - postgres - pictrs - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8536"] - interval: 1m - timeout: 10s - retries: 3 - labels: - - "autoheal=true" lemmy-ui: image: {{ lemmy_docker_ui_image }} @@ -100,12 +98,3 @@ services: - POSTFIX_myhostname={{ domain }} restart: "always" logging: *default-logging - - autoheal: - restart: always - image: willfarrell/autoheal - environment: - - AUTOHEAL_CONTAINER_LABEL=autoheal - - volumes: - - /var/run/docker.sock:/var/run/docker.sock \ No newline at end of file From 538935afa332a5374275365d2e7827f9faa5e77b Mon Sep 17 00:00:00 2001 From: nibblebit Date: Wed, 9 Aug 2023 00:03:10 +0200 Subject: [PATCH 3/5] Removed some whitespace --- templates/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/docker-compose.yml b/templates/docker-compose.yml index 6430911..3aa208e 100644 --- a/templates/docker-compose.yml +++ b/templates/docker-compose.yml @@ -8,7 +8,7 @@ x-logging: &default-logging services: proxy: - image: nginx:1-alpine + image: nginx:1-alpine ports: # actual and only port facing any connection from outside # Note, change the left number if port 1236 is already in use on your system From 3f26bce0a45691705407360e34d994b93464da77 Mon Sep 17 00:00:00 2001 From: nibblebit Date: Wed, 9 Aug 2023 00:08:35 +0200 Subject: [PATCH 4/5] Synchronised healthcheck timeouts --- templates/docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/docker-compose.yml b/templates/docker-compose.yml index 3aa208e..ae164c2 100644 --- a/templates/docker-compose.yml +++ b/templates/docker-compose.yml @@ -26,10 +26,10 @@ services: image: {{ lemmy_docker_image }} hostname: lemmy restart: on-failure - healthcheck: + healthcheck: #Wget the api root every minute and restart if test: ["CMD-SHELL", "wget -S -T 5 --spider -q http://localhost:8536 || exit 1"] - interval: 1m30s - timeout: 10s + interval: 1m + timeout: 5s retries: 3 logging: *default-logging environment: From 5e9ba76ba7917fcca4e6ab90d1085d9e0e707687 Mon Sep 17 00:00:00 2001 From: nibblebit Date: Wed, 9 Aug 2023 00:11:16 +0200 Subject: [PATCH 5/5] Added comments --- templates/docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/docker-compose.yml b/templates/docker-compose.yml index ae164c2..70e0999 100644 --- a/templates/docker-compose.yml +++ b/templates/docker-compose.yml @@ -26,10 +26,10 @@ services: image: {{ lemmy_docker_image }} hostname: lemmy restart: on-failure - healthcheck: #Wget the api root every minute and restart if - test: ["CMD-SHELL", "wget -S -T 5 --spider -q http://localhost:8536 || exit 1"] + healthcheck: #Wget the api root every minute and restart if timeout exceeds 5 seconds + test: ["CMD-SHELL", "wget -S -T 5 --spider -q http://localhost:8536 || exit 1"] #NOTE the wget timeout is seperate from the heathcheck timeout interval: 1m - timeout: 5s + timeout: 5s #NOTE the heathcheck timeout is seperate from the wget timeout retries: 3 logging: *default-logging environment: