syncthing: remove healthcheck hack (#3643)

This commit is contained in:
Stavros Kois
2025-11-18 11:48:13 +02:00
committed by GitHub
parent d58637cea1
commit 39807fc6e4
3 changed files with 2 additions and 28 deletions

View File

@@ -54,4 +54,4 @@ sources:
- https://hub.docker.com/r/syncthing/syncthing
title: Syncthing
train: stable
version: 1.2.26
version: 1.2.27

View File

@@ -1,14 +1,10 @@
{% from "macros/healthcheck.sh" import healthcheck %}
{% set tpl = ix_lib.base.render.Render(values) %}
{% set c1 = tpl.add_container(values.consts.syncthing_container_name, "image") %}
{% do c1.remove_security_opt("no-new-privileges") %}
{% do c1.add_caps(["CHOWN", "DAC_OVERRIDE", "FOWNER", "SETUID", "SETGID", "SETPCAP", "SETFCAP", "SYS_ADMIN"]) %}
{% do c1.configs.add("ix-healthcheck.sh", healthcheck(values), "/ix-healthcheck.sh", "0755") %}
{% do c1.healthcheck.set_custom_test("/ix-healthcheck.sh") %}
{# TODO: After some time, remove the above "hack" and revert back to normal healthcheck #}
{# {% do c1.healthcheck.set_test("wget", {"port": values.network.web_port.port_number, "path": "/rest/noauth/health"}) %} #}
{% do c1.healthcheck.set_test("wget", {"port": values.network.web_port.port_number, "path": "/rest/noauth/health"}) %}
{% do c1.environment.add_env("PCAP", ["cap_sys_admin", "cap_chown", "cap_dac_override", "cap_fowner"]|join(",") + "+ep") %}
{% do c1.environment.add_env("STNOUPGRADE", true) %}

View File

@@ -1,22 +0,0 @@
{% macro healthcheck(values) -%}
#!/bin/sh
{% set base_path = "/var/syncthing/config" %}
{# If the db is migrated, use the normal healthcheck #}
if [ -d "{{base_path}}/index-v2" ]; then
wget --quiet --spider http://127.0.0.1:{{values.network.web_port.port_number}}/rest/noauth/health || exit 1
exit 0
fi
{#
Let syncthing migrate the db, in the meantime, report healthy,
so docker compose up command does not timeout.
#}
if [ -d "{{base_path}}/index-v0.14.0.db" ]; then
echo "Migrating database, reporting healthy"
exit 0
fi
{# Something went wrong, report unhealthy #}
echo "Something went wrong, reporting unhealthy"
exit 1
{% endmacro %}