ibuetler / docker-keycloak-traefik-workshop

Docker with Keycloak and Traefik Workshop
243 stars 43 forks source link

Doesnt work on real server site? #9

Closed thepenguinthatwants closed 5 years ago

thepenguinthatwants commented 5 years ago

I've tried to get this work on my server but it doesnt seem to work.

version: "3.4"

services:
  keycloak_db:
    image: postgres:11.2-alpine
    environment:
        - POSTGRES_DB=keycloak
        - POSTGRES_USER=keycloak
        - POSTGRES_PASSWORD=changeme-postgres
        - POSTGRES_ROOT_PASSWORD=changeme-rootpw
    networks:
      web:
    volumes:
      - ./data:/var/lib/postgresql/data
    labels:
      - traefik.docker.network=web

  keycloak:
    image: jboss/keycloak:latest
    hostname: keycloak
    environment:
      - DB_VENDOR=POSTGRES
      - DB_ADDR=keycloak_db
      - DB_DATABASE=keycloak
      - DB_PORT=5432
      - DB_USER=keycloak
      - DB_SCHEMA=public
      - DB_PASSWORD=changeme-postgres
      - PROXY_ADDRESS_FORWARDING=true
      - KEYCLOAK_LOGLEVEL=INFO
      - KEYCLOAK_USER=admin
      - KEYCLOAK_PASSWORD=changeme-keycloak
    networks:
      web:
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:keycloak.example.xyz
      - traefik.port=8443
      - traefik.docker.network=web
      - traefik.protocol=https
    command: ["-b", "0.0.0.0", "-Dkeycloak.profile.feature.docker=enabled"]

networks:
  web:
    external: true

Final lines of the logs contains

keycloak_1     | 20:25:46,656 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 69) RESTEASY002205: Adding provider class org.keycloak.services.error.KeycloakErrorHandler from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1     | 20:25:46,656 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 69) RESTEASY002205: Adding provider class org.keycloak.services.filters.KeycloakTransactionCommitter from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1     | 20:25:46,656 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 69) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.RobotsResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1     | 20:25:46,656 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 69) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.RealmsResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1     | 20:25:46,657 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 69) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.admin.AdminRoot from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1     | 20:25:46,657 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 69) RESTEASY002210: Adding provider singleton org.keycloak.services.util.ObjectMapperResolver from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1     | 20:25:46,657 INFO  [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 69) RESTEASY002220: Adding singleton resource org.keycloak.services.resources.WelcomeResource from Application class org.keycloak.services.resources.KeycloakApplication
keycloak_1     | 20:25:46,901 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 69) WFLYUT0021: Registered web context: '/auth' for server 'default-server'
keycloak_1     | 20:25:47,125 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 46) WFLYSRV0010: Deployed "keycloak-server.war" (runtime-name : "keycloak-server.war")
keycloak_1     | 20:25:47,284 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
keycloak_1     | 20:25:47,292 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
keycloak_1     | 20:25:47,292 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
keycloak_1     | 20:25:47,293 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Keycloak 7.0.0 (WildFly Core 9.0.2.Final) started in 41495ms - Started 683 of 988 services (701 services are lazy, passive or on-demand)
keycloak_1     | 20:26:50,152 WARN  [org.jboss.as.domain.management.security] (default I/O-1) WFLYDM0113: Generated self signed certificate at /opt/jboss/keycloak/standalone/configuration/application.keystore. Please note that self signed certificates are not secure, and should only be used for testing purposes. Do not use this self signed certificate in production.
keycloak_1     | SHA-1 fingerprint of the generated key is 63:17:70:c4:39:2b:9a:7f:91:03:ba:73:d9:30:da:d4:93:27:f3:d6
keycloak_1     | SHA-256 fingerprint of the generated key is ba:78:c1:81:f0:b0:2f:55:99:75:a6:ad:e1:67:2e:30:fd:06:46:f4:aa:1b:07:b0:73:4e:b2:fe:2c:17:02:1f

When I visit the site by browser Internal Server Error

ibuetler commented 5 years ago

I understand your frustration with this. I did this setup on multiple OS and Linux distro's but decided to do the workshop with the LiveCD, at it has a docker daemon pre-installed and is ready to use.

I don't know exactly what raises the problem. Apologize for this. I propose you do the workshop on the Hacking-Lab LiveCD to learn how Keycloak will protect the simple service. This is what I can support and help. Thank you for your understanding. Ivan