No description
| volumes | ||
| .gitignore | ||
| docker-compose.yaml | ||
| README.md | ||
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
- Login to Keycloak management console with the value of the
KEYCLOAK_ADMINandKEYCLOAK_ADMIN_PASSWORDenvironment variables. - Select
hackathonthenUserthenAdd user - Fill user data and save.
- Select
Credentials,Set passwordand unselectTemporaryto create user password. - In user detail
Role mappingpressAssign roleand select theHRrole orCTOrole (changeFilter by clienttoFilter 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