Installing keycloak

Keycloak is a redhat (and therefore now IBM) product for Identity and Access Management, so you can add authentication to applications and secure services. It’s all available out of the box.

If you need an auth service for your app, Keycloak is a perfect candidate.

Keycloak Screenshot

Docker compose

I like docker compose, so here is how I do it using official example from their repo:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
version: '3'
volumes:
  postgres_data:
      driver: local
services:
  postgres:
      image: postgres
      volumes:
        - postgres_data:/var/lib/postgresql/data
      environment:
        POSTGRES_DB: dbname
        POSTGRES_USER: dbuser
        POSTGRES_PASSWORD: dbpassword
  keycloak:
      image: jboss/keycloak
      environment:
        DB_VENDOR: POSTGRES
        DB_ADDR: postgres
        DB_DATABASE: dbname
        DB_USER: dbuser
        DB_PASSWORD: dbpassword
        KEYCLOAK_USER: admin
        KEYCLOAK_PASSWORD: adminpwd
        ports:
        - 26000:8080
      depends_on:
        - postgres

Alternative local installation

You can also run the simplest script to get it run in docker mode for local dev.

1
$ docker run -p 8090:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=H2 jboss/keycloak

Will run you docker on 8090 with admin/admin as user password and H2 as embeded database - so no need for external SQL engine.