chore(discord): add healthcheck to compose.yaml discord service

Issue #32
This commit is contained in:
2026-05-21 14:21:35 +03:00
parent feb3e08b63
commit 5b65ac4a2f
2 changed files with 22 additions and 0 deletions
+5
View File
@@ -77,6 +77,11 @@ services:
- "Discord__Token=${DISCORD_BOT_TOKEN:?Set DISCORD_BOT_TOKEN in .env}" - "Discord__Token=${DISCORD_BOT_TOKEN:?Set DISCORD_BOT_TOKEN in .env}"
networks: networks:
- gmrelay - gmrelay
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8082/health || exit 1"]
interval: 10s
timeout: 5s
retries: 3
web: web:
image: git.codeanddice.ru/toutsu/gmrelay-web:2.7.0 image: git.codeanddice.ru/toutsu/gmrelay-web:2.7.0
@@ -93,4 +93,21 @@ public sealed class DiscordProjectStructureTests
Assert.Contains("DISCORD_BOT_TOKEN", envExample); Assert.Contains("DISCORD_BOT_TOKEN", envExample);
} }
[Fact]
public void Compose_ShouldIncludeDiscordHealthcheck()
{
var repoRoot = GetRepoRoot();
var compose = File.ReadAllText(Path.Combine(repoRoot, "compose.yaml"));
var discordIndex = compose.IndexOf("discord:", StringComparison.Ordinal);
Assert.True(discordIndex >= 0, "compose.yaml should contain discord service");
var nextServiceIndex = compose.IndexOf(" web:", StringComparison.Ordinal);
var discordBlock = compose[discordIndex..nextServiceIndex];
Assert.Contains("healthcheck:", discordBlock);
Assert.Contains("test:", discordBlock);
Assert.Contains("localhost:8082/health", discordBlock);
}
} }