fix: harden mariadb startup and shared networking

This commit is contained in:
cesnimda
2026-03-22 22:08:39 +01:00
parent c4bb6f1474
commit 42bc642bfa
2 changed files with 18 additions and 1 deletions
+4 -1
View File
@@ -47,7 +47,10 @@ builder.Services.AddDbContext<JobTrackerContext>((sp, options) =>
if (provider is "mysql" or "mariadb")
{
options.UseMySql(cs, ServerVersion.AutoDetect(cs));
// Avoid ServerVersion.AutoDetect here because it forces an immediate DB connection
// during service registration, which can crash the API if MariaDB is temporarily
// unavailable or on a different network during deploy startup.
options.UseMySql(cs, new MariaDbServerVersion(new Version(11, 0, 0)));
}
else
{
+14
View File
@@ -45,6 +45,9 @@ services:
- Email__FromName=${EMAIL_FROM_NAME}
expose:
- "8080"
networks:
- default
- shared_services
restart: unless-stopped
frontend:
@@ -58,6 +61,9 @@ services:
- "3000:80"
depends_on:
- backend
networks:
- default
- shared_services
restart: unless-stopped
summarizer:
@@ -66,6 +72,9 @@ services:
dockerfile: Dockerfile
ports:
- "8001:8001"
networks:
- default
- shared_services
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8001/health', timeout=5).read()"]
@@ -75,3 +84,8 @@ services:
volumes:
jobtracker_data:
networks:
shared_services:
external: true
name: jobtracker_shared