fix: harden mariadb startup and shared networking
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user