Implemented authentication with Keycloak

This commit is contained in:
Dennis Nemec
2025-10-02 20:22:11 +02:00
parent e8954ba5c1
commit b87d7e0268
15 changed files with 1697 additions and 94 deletions

View File

@ -23,7 +23,7 @@ services:
dockerfile: Dockerfile
container_name: rust-microservice
ports:
- "8080:8080"
- "3000:8080"
environment:
- REDIS_URL=redis://redis:6379
- RUST_LOG=info
@ -34,10 +34,46 @@ services:
- app-network
restart: unless-stopped
keycloak_web:
image: quay.io/keycloak/keycloak:23.0.7
container_name: keycloak_web
environment:
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://keycloakdb:5432/keycloak
KC_DB_USERNAME: ${POSTGRES_USER}
KC_DB_PASSWORD: ${POSTGRES_PASSWORD}
KC_HOSTNAME: localhost
KC_HOSTNAME_PORT: 8080
KC_HOSTNAME_STRICT: false
KC_HOSTNAME_STRICT_HTTPS: false
KC_LOG_LEVEL: info
KC_METRICS_ENABLED: true
KC_HEALTH_ENABLED: true
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD}
command: start-dev
depends_on:
- keycloakdb
ports:
- 8080:8080
keycloakdb:
image: postgres:15
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
networks:
app-network:
driver: bridge
volumes:
redis-data:
driver: local
postgres_data:
driver: local