Nuevo start con interaccion para elegir que tipo de servidor estamos

This commit is contained in:
2026-02-23 12:15:44 -06:00
parent a9b9d8290b
commit 17c1ef3947
5 changed files with 140 additions and 79 deletions

View File

@@ -17,7 +17,7 @@ services:
- backend-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d anexo76_core || exit 1"]
test: [ "CMD-SHELL", "pg_isready -U postgres -d anexo76_core || exit 1" ]
interval: 5s
timeout: 3s
retries: 10
@@ -37,7 +37,7 @@ services:
# PostgreSQL - Base de datos Keycloak
postgres-keycloak:
image: postgres:18-alpine
image: postgres:16-alpine
container_name: anexo76-postgres-keycloak
environment:
POSTGRES_DB: keycloak
@@ -54,7 +54,7 @@ services:
- backend-net
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d keycloak || exit 1"]
test: [ "CMD-SHELL", "pg_isready -U postgres -d keycloak || exit 1" ]
interval: 5s
timeout: 3s
retries: 10
@@ -80,10 +80,10 @@ services:
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN:-admin}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:-admin}
KC_DB: postgres
KC_DB_URL_HOST: postgres-keycloak
KC_DB_URL_HOST: anexo76-postgres-keycloak
KC_DB_URL_PORT: "5432"
KC_DB_URL_DATABASE: keycloak
KC_DB_URL: jdbc:postgresql://postgres-keycloak:5432/keycloak
KC_DB_URL: jdbc:postgresql://anexo76-postgres-keycloak:5432/keycloak
KC_DB_USERNAME: postgres
KC_DB_PASSWORD: ${POSTGRES_KEYCLOAK_PASSWORD:-postgres}
KC_DB_SCHEMA: public
@@ -96,12 +96,12 @@ services:
KC_HEALTH_ENABLED: "true"
KC_METRICS_ENABLED: "true"
KC_HOSTNAME_PATH: /kcauth
KC_LOG_LEVEL: INFO
KC_LOG_LEVEL: INFO
JAVA_OPTS_APPEND: "-Xms256m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true"
command:
command:
- start
- --db=postgres
- --db-url-host=postgres-keycloak
- --db-url-host=anexo76-postgres-keycloak
- --http-relative-path=/kcauth
- --db-url-port=5432
- --db-url-database=keycloak
@@ -123,7 +123,19 @@ services:
- backend-net
restart: unless-stopped
healthcheck:
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"]
test:
[
"CMD-SHELL",
"exec 3<>/dev/tcp/127.0.0.1/9000; echo -e 'GET /kcauth/health/ready HTTP/1.1\r
host: 127.0.0.1\r
Connection: close\r
\r
' >&3; grep -q 'HTTP/1.1 200' <&3 || exit 1"
]
interval: 10s
timeout: 5s
retries: 30
@@ -162,6 +174,14 @@ services:
- SITAR_API_URL=${SITAR_API_URL}
- SITAR_API_USER=${SITAR_API_USER}
- SITAR_API_PASSWORD=${SITAR_API_PASSWORD}
- EXTERNAL_API_URL=${EXTERNAL_API_URL}
- EXTERNAL_API_USER=${EXTERNAL_API_USER}
- EXTERNAL_API_PASSWORD=${EXTERNAL_API_PASSWORD}
- VALKEY_URL=${VALKEY_URL:-redis://valkey:6379/0}
- CENTRAL_SERVER_URL=${CENTRAL_SERVER_URL:-""}
- SYNC_SECRET_TOKEN=${SYNC_SECRET_TOKEN:-change-this-sync-token-in-production}
- CLIENT_UUID=${CLIENT_UUID:-""}
- SPOKE_URLS=${SPOKE_URLS:-""}
ports:
- "3467:8000"
depends_on:
@@ -176,24 +196,10 @@ services:
- backend-net
- frontend-net
restart: unless-stopped
entrypoint: ["/entrypoint.sh"]
command:
[
"gunicorn",
"main:app",
"-k",
"uvicorn.workers.UvicornWorker",
"-w",
"${WEB_CONCURRENCY:-1}",
"-b",
"0.0.0.0:8000",
"--log-level",
"info",
"--forwarded-allow-ips",
"*"
]
entrypoint: [ "/entrypoint.sh" ]
command: [ "gunicorn", "main:app", "-k", "uvicorn.workers.UvicornWorker", "-w", "${WEB_CONCURRENCY:-1}", "-b", "0.0.0.0:8000", "--log-level", "info", "--forwarded-allow-ips", "*" ]
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/api/health || exit 1"]
test: [ "CMD-SHELL", "curl -f http://localhost:8000/api/health || exit 1" ]
interval: 15s
timeout: 5s
retries: 5
@@ -216,7 +222,16 @@ services:
container_name: worker
command: celery -A core.celery_app worker --loglevel=info
environment:
- VALKEY_URL=redis://valkey:6379/0
- VALKEY_URL=${VALKEY_URL:-redis://valkey:6379/0}
- CENTRAL_SERVER_URL=${CENTRAL_SERVER_URL:-""}
- SYNC_SECRET_TOKEN=${SYNC_SECRET_TOKEN:-change-this-sync-token-in-production}
- CLIENT_UUID=${CLIENT_UUID:-""}
- SPOKE_URLS=${SPOKE_URLS:-""}
- CORE_DB_HOST=${CORE_DB_HOST:-postgres-a76}
- CORE_DB_PORT=${CORE_DB_PORT:-5432}
- CORE_DB_NAME=${CORE_DB_NAME:-anexo76_core}
- CORE_DB_USER=${CORE_DB_USER:-postgres}
- CORE_DB_PASSWORD=${POSTGRES_APP_PASSWORD:-postgres}
depends_on:
- backend
- valkey
@@ -252,7 +267,7 @@ services:
depends_on:
backend:
condition: service_healthy
entrypoint: ["/frontend-entrypoint.sh"]
entrypoint: [ "/frontend-entrypoint.sh" ]
volumes:
- ./scripts/frontend-entrypoint.sh:/frontend-entrypoint.sh:ro
networks:
@@ -260,9 +275,9 @@ services:
- backend-net
- auth-net
restart: unless-stopped
command: ["pnpm", "start"]
command: [ "pnpm", "start" ]
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:5173/ || exit 1"]
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:5173/ || exit 1" ]
interval: 15s
timeout: 5s
retries: 5