version: '3.7' networks: back-tier: external: True front-tier: external: True volumes: {{ keycloak_id }}-postgres-data: {} services: {{ keycloak_id }}: image: "{{ keycloak_image_name }}:{{ keycloak_version }}" container_name: "{{ keycloak_id }}" restart: always labels: - "traefik.enable=true" - "traefik.http.routers.{{ keycloak_id }}.service={{ keycloak_id }}" - "traefik.http.routers.{{ keycloak_id }}.rule=Host(`{{ keycloak_id }}.smardigo.digital`)" - "traefik.http.routers.{{ keycloak_id }}.entrypoints=websecure" - "traefik.http.routers.{{ keycloak_id }}.tls=true" - "traefik.http.routers.{{ keycloak_id }}.tls.certresolver=letsencrypt-http" - "traefik.http.services.{{ keycloak_id }}.loadbalancer.server.port=8080" {% if keycloak_external_domain is defined %} - "traefik.http.routers.{{ keycloak_id }}-extern.service={{ keycloak_id }}-extern" - "traefik.http.routers.{{ keycloak_id }}-extern.rule=Host(`{{ keycloak_external_domain }}.smardigo.digital`)" - "traefik.http.routers.{{ keycloak_id }}-extern.entrypoints=websecure" - "traefik.http.routers.{{ keycloak_id }}-extern.tls=true" - "traefik.http.routers.{{ keycloak_id }}-extern.tls.certresolver=letsencrypt-http" - "traefik.http.services.{{ keycloak_id }}-extern.loadbalancer.server.port=8080" {% endif %} environment: KEYCLOAK_USER: "{{ keycloak_admin_username }}" KEYCLOAK_PASSWORD: "{{ keycloak_admin_password }}" PROXY_ADDRESS_FORWARDING: "true" DB_VENDOR: postgres DB_DATABASE: "keycloak-postgres" DB_USER: "{{ keycloak_postgres_username }}" DB_PASSWORD: "{{ keycloak_postgres_password }}" DB_ADDR: "{{ keycloak_id }}-postgres" networks: - "back-tier" - "front-tier" ports: - "8110:8080" {{ keycloak_id }}-postgres: image: "postgres:12" container_name: "{{ keycloak_id }}-postgres" restart: always environment: POSTGRES_DB: "keycloak-postgres" POSTGRES_USER: "{{ keycloak_postgres_username }}" POSTGRES_PASSWORD: "{{ keycloak_postgres_password }}" volumes: - "{{ keycloak_id }}-postgres-data:/var/lib/postgresql/data" networks: - "back-tier"