Refactor middleware import path, update Docker configurations, and normalize API base URL

This commit is contained in:
AlexeerCT
2025-12-26 14:21:00 -06:00
parent 3409d0a163
commit 69bf0c472b
5 changed files with 38 additions and 20 deletions

View File

@@ -9,7 +9,7 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_APP_PASSWORD:-postgres}
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
ports:
- "5432:5432"
- "5939:5432"
volumes:
- postgres_app_data:/var/lib/postgresql/data
- ./scripts/postgres-app-entrypoint.sh:/docker-entrypoint-initdb.d/init-app.sh:ro
@@ -45,7 +45,7 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_KEYCLOAK_PASSWORD:-postgres}
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
ports:
- "5433:5432"
- "5233:5432"
volumes:
- postgres_keycloak_data:/var/lib/postgresql/data
- ./scripts/postgres-keycloak-entrypoint.sh:/docker-entrypoint-initdb.d/init-keycloak.sh:ro
@@ -94,12 +94,14 @@ services:
KC_PROXY_HEADERS: "xforwarded"
KC_HEALTH_ENABLED: "true"
KC_METRICS_ENABLED: "true"
KC_HOSTNAME_PATH: /kcauth
KC_LOG_LEVEL: INFO
JAVA_OPTS_APPEND: "-Xms256m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true"
command:
- start-dev
- --db=postgres
- --db-url-host=postgres-keycloak
- --http-relative-path=/kcauth
- --db-url-port=5432
- --db-url-database=keycloak
- --db-username=postgres
@@ -108,7 +110,7 @@ services:
- --hostname-strict=false
- --proxy-headers=xforwarded
ports:
- "8080:8080"
- "8880:8080"
- "9000:9000"
depends_on:
postgres-keycloak:
@@ -120,11 +122,11 @@ services:
- backend-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/9000; echo -e 'GET /health/ready HTTP/1.1\r\nhost: 127.0.0.1\r\nConnection: close\r\n\r\n' >&3; grep -q 'HTTP/1.1 200' <&3 || exit 1"]
test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/9000; echo -e 'GET /kcauth/health/ready HTTP/1.1\r\nhost: 127.0.0.1\r\nConnection: close\r\n\r\n' >&3; grep -q 'HTTP/1.1 200' <&3 || exit 1"]
interval: 10s
timeout: 5s
retries: 30
start_period: 90s
start_period: 30s
logging:
driver: "json-file"
options:
@@ -155,15 +157,17 @@ services:
- KEYCLOAK_REALM=${KEYCLOAK_REALM:-master}
- KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID:-anexo76-backend}
- KEYCLOAK_CLIENT_SECRET=${KEYCLOAK_CLIENT_SECRET:-dev-secret}
- CORS_ORIGINS=${CORS_ORIGINS:-http://localhost:5173,http://localhost:3000}
- CORS_ORIGINS=${CORS_ORIGINS:-https://anexo76-dev.aduanasoft.com,http://localhost:3000}
ports:
- "8000:8000"
- "3467:8000"
depends_on:
postgres-a76:
condition: service_healthy
keycloak:
condition: service_healthy
volumes:
- ./backend:/app
- backend_cache:/app/__pycache__
- ./scripts/backend-entrypoint.sh:/entrypoint.sh:ro
networks:
- backend-net
@@ -191,21 +195,27 @@ services:
# Frontend - SvelteKit
frontend:
image: dev.aduanasoft.com/anexo76/frontend:latest
build:
context: ./frontend
dockerfile: Dockerfile.prod
args:
- BUILDKIT_INLINE_CACHE=1
- VITE_API_URL=https://anexo76-dev.aduanasoft.com/api/
- VITE_KEYCLOAK_URL=https://anexo76-dev.aduanasoft.com/kcauth/
container_name: anexo76-frontend
environment:
- NODE_ENV=${NODE_ENV:-development}
- VITE_API_URL=${VITE_API_URL:-http://localhost:8000/api/}
- VITE_API_URL=${VITE_API_URL:-https://anexo76-dev.aduanasoft.com/api}
- INTERNAL_API_URL=${INTERNAL_API_URL:-http://backend:8000/api/}
- VITE_KEYCLOAK_URL=${VITE_KEYCLOAK_URL:-http://localhost:8080}
- VITE_KEYCLOAK_URL=${VITE_KEYCLOAK_URL:-https://anexo76-dev.aduanasoft.com/kcauth/}
- VITE_KEYCLOAK_REALM=${VITE_KEYCLOAK_REALM:-master}
- VITE_KEYCLOAK_CLIENT_ID=${VITE_KEYCLOAK_CLIENT_ID:-anexo76-frontend}
- KEYCLOAK_URL=${KEYCLOAK_URL:-http://keycloak:8080}
- KEYCLOAK_URL=${KEYCLOAK_URL:-http://keycloak:8080/kcauth}
- KEYCLOAK_REALM=${KEYCLOAK_REALM:-master}
- KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID:-anexo76-backend}
- KEYCLOAK_CLIENT_SECRET=${KEYCLOAK_CLIENT_SECRET:-zRU5NuvUFtBSOuh7Kdc372AItoWGLgz9}
ports:
- "5173:5173"
- "5111:5173"
depends_on:
backend:
condition: service_healthy
@@ -216,7 +226,7 @@ services:
- frontend-net
- auth-net
restart: unless-stopped
command: ["pnpm", "run", "dev", "--", "--host", "0.0.0.0"]
command: ["node", "build"]
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:5173/ || exit 1"]
interval: 15s
@@ -253,4 +263,4 @@ networks:
auth-net:
driver: bridge
frontend-net:
driver: bridge
driver: bridge