From 1ade75b635fef06ffd04e7741f5983d9cc739d21 Mon Sep 17 00:00:00 2001 From: trent Date: Tue, 11 Aug 2026 04:32:48 +0800 Subject: [PATCH] Update for dns changes --- .env.example | 7 ++++++- .gitea/workflows/cd.yml | 3 ++- VigilCare.WardGateway/Program.cs | 4 +++- VigilCare.WardGateway/appsettings.json | 3 +++ docker-compose.prod.yml | 1 + vigilcare-dashboard/Dockerfile | 4 ++-- vigilcare-dashboard/nginx.conf | 5 +++++ 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 0bf0244..8a53804 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,12 @@ IMAGE_TAG=v1.0.0 API_PORT=5270 GATEWAY_PORT=5081 DASHBOARD_PORT=8088 -DASHBOARD_ORIGIN=https://vigilcare.example.com +DASHBOARD_ORIGIN=https://vigilcare-clinical.vectur45.com +# Set Gitea Actions variable PROD_API_URL to the public API origin (baked into +# the dashboard image at build). Example: +# PROD_API_URL=https://api.vigilcare-clinical.vectur45.com +# Gateway public host (nginx only; compose keeps CentralApi on the Docker network): +# https://gateway.vigilcare-clinical.vectur45.com # ---- external PostgreSQL ---- # Runtime (DML-only) connection used by the API container. diff --git a/.gitea/workflows/cd.yml b/.gitea/workflows/cd.yml index 8e1bc18..47c18cd 100644 --- a/.gitea/workflows/cd.yml +++ b/.gitea/workflows/cd.yml @@ -3,7 +3,8 @@ # # Secrets: REGISTRY_USERNAME, REGISTRY_TOKEN, PG_CONNECTION_DDL, # DEPLOY_HOST, DEPLOY_USER, DEPLOY_SSH_KEY -# Variables: PROD_API_URL, REGISTRY (optional; defaults below) +# Variables: PROD_API_URL (e.g. https://api.vigilcare-clinical.vectur45.com), +# REGISTRY (optional; defaults below) name: CD on: diff --git a/VigilCare.WardGateway/Program.cs b/VigilCare.WardGateway/Program.cs index 30f965c..99ddc64 100644 --- a/VigilCare.WardGateway/Program.cs +++ b/VigilCare.WardGateway/Program.cs @@ -80,8 +80,10 @@ try builder.Services.AddControllers() .AddJsonOptions(o => o.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); + var corsOrigins = builder.Configuration.GetSection("Dashboard:CorsOrigins").Get() + ?? ["http://localhost:5173"]; builder.Services.AddCors(o => o.AddPolicy("Dashboard", p => - p.WithOrigins("http://localhost:5173").AllowAnyHeader().AllowAnyMethod())); + p.WithOrigins(corsOrigins).AllowAnyHeader().AllowAnyMethod())); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); diff --git a/VigilCare.WardGateway/appsettings.json b/VigilCare.WardGateway/appsettings.json index be676cf..81d65b2 100644 --- a/VigilCare.WardGateway/appsettings.json +++ b/VigilCare.WardGateway/appsettings.json @@ -16,6 +16,9 @@ "CentralApi": { "BaseUrl": "http://localhost:5270" }, + "Dashboard": { + "CorsOrigins": [ "http://localhost:5173" ] + }, "Gateway": { "GatewayId": "22222222-2222-2222-2222-222222222222", "SiteId": "11111111-1111-1111-1111-111111111111", diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index d554889..745eca0 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -89,6 +89,7 @@ services: Gateway__SiteId: "${GATEWAY_SITE_ID}" Gateway__Department: "${GATEWAY_DEPARTMENT:-ICU}" ApiKey__Gateway: "${GATEWAY_API_KEY}" + Dashboard__CorsOrigins__0: "${DASHBOARD_ORIGIN}" Jwt__SigningKey: "${GATEWAY_JWT_SIGNING_KEY}" Jwt__Issuer: "${GATEWAY_JWT_ISSUER:-vigilcare-gateway}" Jwt__Audience: "${GATEWAY_JWT_AUDIENCE:-vigilcare-dashboard}" diff --git a/vigilcare-dashboard/Dockerfile b/vigilcare-dashboard/Dockerfile index 7273584..d84b025 100644 --- a/vigilcare-dashboard/Dockerfile +++ b/vigilcare-dashboard/Dockerfile @@ -17,5 +17,5 @@ COPY --from=build /src/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 -HEALTHCHECK --interval=30s --timeout=3s --retries=3 \ - CMD wget -qO- http://localhost/ >/dev/null || exit 1 \ No newline at end of file +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1 \ No newline at end of file diff --git a/vigilcare-dashboard/nginx.conf b/vigilcare-dashboard/nginx.conf index 4362483..c79c3ab 100644 --- a/vigilcare-dashboard/nginx.conf +++ b/vigilcare-dashboard/nginx.conf @@ -1,5 +1,10 @@ server { listen 80; + # Required explicitly: the nginx image's 10-listen-on-ipv6-by-default.sh + # only patches the stock default.conf. We replace that file, so without + # this line the container listens on IPv4 only while HEALTHCHECK wget + # resolves localhost to ::1 and fails → Docker reports unhealthy. + listen [::]:80; server_name _; root /usr/share/nginx/html; index index.html;