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")
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ services:
|
|||||||
- Email__FromName=${EMAIL_FROM_NAME}
|
- Email__FromName=${EMAIL_FROM_NAME}
|
||||||
expose:
|
expose:
|
||||||
- "8080"
|
- "8080"
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- shared_services
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
@@ -58,6 +61,9 @@ services:
|
|||||||
- "3000:80"
|
- "3000:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- shared_services
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
summarizer:
|
summarizer:
|
||||||
@@ -66,6 +72,9 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8001:8001"
|
- "8001:8001"
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
- shared_services
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8001/health', timeout=5).read()"]
|
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:
|
volumes:
|
||||||
jobtracker_data:
|
jobtracker_data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
shared_services:
|
||||||
|
external: true
|
||||||
|
name: jobtracker_shared
|
||||||
|
|||||||
Reference in New Issue
Block a user