No description
Find a file
2025-02-18 14:35:47 +01:00
volumes feat: add frontend client in keycloak config 2025-02-18 12:01:49 +01:00
.gitignore 🙈 update .gitignore 2025-02-17 14:59:12 +01:00
docker-compose.yaml feat: change ipd db external port 2025-02-18 14:35:47 +01:00
README.md feat: add port config as env var 2025-02-18 11:43:40 +01:00

Docker container

Setup

1. Setup environment variables

Create .env file and copy/paste this environment variables:

# KEYCLOAK
KEYCLOAK_ADMIN=admin
KEYCLOAK_ADMIN_PASSWORD=admin
KEYCLOAK_PORT=8080

# POSTGRES (Keycloak database)
POSTGRES_KC_PASSWORD=admin
POSTGRES_KC_USER=admin
POSTGRES_KC_DB=keycloakdb
POSTGRES_KC_PORT=5433 

# PGADMIN
PGADMIN_DEFAULT_EMAIL=admin@pgadmin.com
PGADMIN_DEFAULT_PASSWORD=admin

WARNING: If necessary, update application-dev.properties or/and application.properties with the correct values.

2. Create volumes

Create directory for postgres and pgadmin volumes :

mkdir volumes/pgadmin && mkdir volumes/postgres-keycloak

Expected folder structure :

. docker 
    | README.md
    | docker-compose.yaml
    | .env
    | volumes 
        | pgadmin                   
        | postgres-keycloak         
        | keycloak-import
            | realm-config.json

Type this : sudo chown -R 5050:5050 volumes/pgadmin if this error appears :

ERROR  : Failed to create the directory /var/lib/pgadmin/sessions:
pgadmin-1   |            [Errno 13] Permission denied: '/var/lib/pgadmin/sessions'

Start containers

docker compose up

Create Keycloak users

  1. Login to Keycloak management console with the value of the KEYCLOAK_ADMIN and KEYCLOAK_ADMIN_PASSWORD environment variables.
  2. Select hackathon then User then Add user
  3. Fill user data and save.
  4. Select Credentials, Set password and unselect Temporary to create user password.
  5. In user detail Role mapping press Assign role and select the HR role or CTO role (change Filter by client to Filter by realm roles).

Connect to pgAdmin

Login in pgAdmin with PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD.

In Server > Register > Server

  • Name : keycloakdb (abitrary)

In Connection :

  • Host name / address : keycloakdb (container name)
  • Maintenance database: postgres
  • User : POSTGRES_KC_USER
  • Password : POSTGRES_KC_PASSWORD