DEV Community

Discussion on: OAuth2 auth with Nuxt.js/Vue.js (frontend), Vert.x (backend for BL) and Keycloak (auth server) 👩‍💻👨‍💻

Collapse
 
johanneslichtenberger profile image
Johannes Lichtenberger

Hmm, does someone, know why the host could not be resolved when the Vert.x server redirects to Keycloak?

keycloak:8080/auth/realms/sirixdb/...

At least in the docker network it is for instance reachable by the server service (Vert.x based HTTP-Server), but not from the "frontend backend server", that is Node.js.

My docker-compose file:

version: '3'
services:
  waitforkeycloak:
    image: dadarek/wait-for-dependencies
    depends_on:
      - keycloak
    command: keycloak:8080
  keycloak:
    image: jboss/keycloak
    ports:
      - 8080:8080
    environment:
      - KEYCLOAK_USER=admin
      - KEYCLOAK_PASSWORD=admin
      - KEYCLOAK_LOGLEVEL=DEBUG
      - KEYCLOAK_IMPORT=/opt/keycloak/realm-export.json
    restart: always
    volumes:
      - ./sirix/bundles/sirix-rest-api/src/test/resources/realm-export.json:/opt/keycloak/realm-export.json
    command:
      - "-b 0.0.0.0"
      - "-bmanagement 0.0.0.0"
  server:
    build: ./sirix
    image: sirixdb/sirix
    ports:
      - "9443:9443"
    restart: always
    volumes:
      - /opt/sirix
      - ./sirix/bundles/sirix-rest-api/src/main/resources/cert.pem:/opt/sirix/sirix-data/cert.pem
      - ./sirix/bundles/sirix-rest-api/src/main/resources/key.pem:/opt/sirix/sirix-data/key.pem
      - ./sirix/bundles/sirix-rest-api/src/main/resources/sirix-conf.json:/opt/sirix/sirix-conf.json
    depends_on:
      - keycloak
  frontend:
    build: ./sirix-web-frontend
    image: sirixdb/sirix-web-frontend
    ports:
      - "3005:3005"
    restart: always
    volumes:
      - /usr/src/nuxt-app
    depends_on:
      - server
      - keycloak
Collapse
 
johanneslichtenberger profile image
Johannes Lichtenberger

I've added a section in the README how to set things up with docker-compose...