refactor(docker): remove Keycloak and PostgreSQL services from production configuration
- Deleted PostgreSQL and Keycloak service definitions from docker-compose.prod.yml to streamline the deployment configuration. - Updated README.md with new build arguments for API and Keycloak URLs. - Adjusted Dockerfile.prod to ensure proper ownership for the application directory. This change simplifies the production setup by removing unnecessary services.
This commit is contained in:
@@ -152,8 +152,8 @@ docker build -t dev.aduanasoft.com/anexo76/backend:latest -f ./backend/Dockerfil
|
||||
|
||||
```
|
||||
docker build \
|
||||
--build-arg VITE_API_URL=https://anexo76-dev.aduanasoft.com/api/ \
|
||||
--build-arg VITE_KEYCLOAK_URL=https://anexo76-dev.aduanasoft.com/kcauth/ \
|
||||
--build-arg VITE_API_URL=http://10.47.80.196:3467/api/ \
|
||||
--build-arg VITE_KEYCLOAK_URL=http://10.47.80.196/kcauth/ \
|
||||
--build-arg INTERNAL_API_URL=http://backend:3467/api/ \
|
||||
-t dev.aduanasoft.com/anexo76/frontend:latest \
|
||||
-f ./frontend/Dockerfile.prod \
|
||||
|
||||
@@ -34,122 +34,6 @@ services:
|
||||
memory: 256M
|
||||
shm_size: 128mb
|
||||
|
||||
# PostgreSQL - Base de datos Keycloak
|
||||
postgres-keycloak:
|
||||
image: postgres:16-alpine
|
||||
container_name: anexo76-postgres-keycloak
|
||||
environment:
|
||||
POSTGRES_DB: keycloak
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: ${POSTGRES_KEYCLOAK_PASSWORD:-postgres}
|
||||
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
|
||||
ports:
|
||||
- "5233:5432"
|
||||
volumes:
|
||||
- postgres_keycloak_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- auth-net
|
||||
- backend-net
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "pg_isready -U postgres -d keycloak || exit 1" ]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
start_period: 20s
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 512M
|
||||
reservations:
|
||||
memory: 256M
|
||||
shm_size: 128mb
|
||||
|
||||
# Keycloak - Servidor de autenticación
|
||||
keycloak:
|
||||
image: quay.io/keycloak/keycloak:26.4
|
||||
container_name: anexo76-keycloak
|
||||
environment:
|
||||
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN:-admin}
|
||||
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:-admin}
|
||||
KC_DB: postgres
|
||||
KC_DB_URL_HOST: anexo76-postgres-keycloak
|
||||
KC_DB_URL_PORT: "5432"
|
||||
KC_DB_URL_DATABASE: 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
|
||||
KC_HOSTNAME: anexo76-dev.aduanasoft.com
|
||||
KC_HTTP_ENABLED: "true"
|
||||
KC_HOSTNAME_STRICT: "false"
|
||||
KC_HOSTNAME_STRICT_HTTPS: "false"
|
||||
KC_PROXY: edge
|
||||
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
|
||||
- --db=postgres
|
||||
- --db-url-host=anexo76-postgres-keycloak
|
||||
- --http-relative-path=/kcauth
|
||||
- --db-url-port=5432
|
||||
- --db-url-database=keycloak
|
||||
- --db-username=postgres
|
||||
- --db-password=${POSTGRES_KEYCLOAK_PASSWORD:-postgres}
|
||||
- --http-enabled=true
|
||||
- --hostname-strict=false
|
||||
- --proxy-headers=xforwarded
|
||||
ports:
|
||||
- "8880:8080"
|
||||
- "9000:9000"
|
||||
depends_on:
|
||||
postgres-keycloak:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- keycloak_data:/opt/keycloak/data
|
||||
networks:
|
||||
- auth-net
|
||||
- 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
|
||||
|
||||
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
|
||||
start_period: 30s
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 768M
|
||||
reservations:
|
||||
memory: 512M
|
||||
|
||||
# Backend - FastAPI
|
||||
backend:
|
||||
image: dev.aduanasoft.com/anexo76/backend:latest
|
||||
@@ -204,8 +88,6 @@ services:
|
||||
depends_on:
|
||||
postgres-a76:
|
||||
condition: service_healthy
|
||||
keycloak:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
@@ -399,10 +281,6 @@ services:
|
||||
volumes:
|
||||
postgres_app_data:
|
||||
driver: local
|
||||
postgres_keycloak_data:
|
||||
driver: local
|
||||
keycloak_data:
|
||||
driver: local
|
||||
frontend_node_modules:
|
||||
driver: local
|
||||
backend_cache:
|
||||
|
||||
@@ -59,6 +59,9 @@ COPY --from=build --chown=svelte:nodejs /app/build ./build
|
||||
COPY --from=build --chown=svelte:nodejs /app/package.json ./
|
||||
COPY --from=build --chown=svelte:nodejs /app/node_modules ./node_modules
|
||||
|
||||
# WORKDIR /app queda owned por root; pnpm necesita crear _tmp_* en el cwd al ejecutar scripts.
|
||||
RUN chown svelte:nodejs /app
|
||||
|
||||
USER svelte
|
||||
|
||||
# Puerto para SvelteKit con adapter-node
|
||||
|
||||
Reference in New Issue
Block a user