Skip to content

Commit 8c70a96

Browse files
committed
Add Keycloak
1 parent a5a836c commit 8c70a96

File tree

6 files changed

+2082
-5
lines changed

6 files changed

+2082
-5
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
[![Build](https://github.com/Romanow/docker-compose-examples/actions/workflows/build.yaml/badge.svg?branch=master)](https://github.com/Romanow/docker-compose-examples/actions/workflows/build.yaml)
22
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
3+
[![License](https://img.shields.io/github/license/Romanow/docker-compose-examples)](https://github.com/Romanow/docker-compose-exampleslist/blob/main/LICENSE)
34

45
# Docker Compose examples
56

7+
## Common services
8+
9+
* [Frontend](frontend/README.md)
10+
* [Java](java/README.md)
11+
* [Keycloak](keycloak/README.md)
12+
13+
## Storages
14+
15+
* [Postgres](postgres/README.md)
16+
* [Elastic](elastic/README.md)
17+
* [Minio](minio/README.md)
18+
19+
## Queues
20+
621
* [Kafka](kafka/README.md)
722
* [Artemis](artemis/README.md)
23+
24+
## Observability
25+
826
* [Monitoring](monitoring/README.md)
9-
* [Postgres](postgres/README.md)
1027
* [Logging](logging/README.md)
1128
* [Tracing](tracing/README.md)
12-
* [Elastic](elastic/README.md)
13-
* [Minio](minio/README.md)
14-
* [Frontend](frontend/README.md)
15-
* [Java](java/README.md)

keycloak/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Keycloak

keycloak/docker-compose.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
services:
2+
postgres:
3+
image: postgres:15
4+
container_name: postgres
5+
environment:
6+
POSTGRES_USER: postgres
7+
POSTGRES_PASSWORD: "postgres"
8+
POSTGRES_DB: postgres
9+
healthcheck:
10+
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER" ]
11+
interval: 10s
12+
timeout: 5s
13+
retries: 5
14+
volumes:
15+
- postgres:/var/lib/postgresql/data
16+
- ./postgres/:/docker-entrypoint-initdb.d/
17+
ports:
18+
- "5432:5432"
19+
20+
keycloak:
21+
image: "bitnami/keycloak:26"
22+
container_name: keycloak
23+
environment:
24+
KEYCLOAK_HTTP_PORT: 8100
25+
KEYCLOAK_ADMIN: admin
26+
KEYCLOAK_ADMIN_PASSWORD: admin
27+
KEYCLOAK_DATABASE_VENDOR: postgresql
28+
KEYCLOAK_DATABASE_HOST: postgres
29+
KEYCLOAK_DATABASE_PORT: 5432
30+
KEYCLOAK_DATABASE_NAME: keycloak
31+
KEYCLOAK_DATABASE_USER: program
32+
KEYCLOAK_DATABASE_PASSWORD: "test"
33+
KEYCLOAK_ENABLE_HEALTH_ENDPOINTS: true
34+
KEYCLOAK_EXTRA_ARGS: "-Dkeycloak.profile.feature.scripts=enabled"
35+
ports:
36+
- "8100:8100"
37+
healthcheck:
38+
test: [ "CMD", "curl", "--silent", "--fail", "http://localhost:9000/health/ready" ]
39+
interval: 10s
40+
timeout: 5s
41+
retries: 10
42+
volumes:
43+
- keycloak:/bitnami/keycloak
44+
- ./keycloak/:/docker-entrypoint-initdb.d/
45+
depends_on:
46+
postgres:
47+
condition: service_healthy
48+
49+
volumes:
50+
keycloak:
51+
postgres:

keycloak/keycloak/init-realm.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
"$KEYCLOAK_BIN_DIR"/kc.sh import --file "$KEYCLOAK_INITSCRIPTS_DIR"/realm.json

0 commit comments

Comments
 (0)