add keycloak deployment files
This commit is contained in:
parent
479bcf9781
commit
32ee8f6223
5 changed files with 71 additions and 1 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/data
|
||||
/.env
|
12
Containerfile.keycloak
Normal file
12
Containerfile.keycloak
Normal file
|
@ -0,0 +1,12 @@
|
|||
ARG KEYCLOAK_VERSION
|
||||
FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION} as builder
|
||||
|
||||
RUN /opt/keycloak/bin/kc.sh build --features-disabled=impersonation --db=postgres
|
||||
|
||||
FROM quay.io/keycloak/keycloak:${KEYCLOAK_VERSION}
|
||||
WORKDIR /opt/keycloak
|
||||
COPY --from=builder /opt/keycloak/ /opt/keycloak/
|
||||
ENV KC_DB_URL=keycloak_db
|
||||
|
||||
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]
|
||||
CMD ["start", "--optimized"]
|
13
README.md
13
README.md
|
@ -1,2 +1,13 @@
|
|||
# keycloak-deployment
|
||||
# Keycloak Deployment
|
||||
|
||||
This repos contains all files required to deploy the keycloak service using docker-compose.
|
||||
|
||||
The deployment is tailored towards a setup using postgres as the database and running keycloak behind a reverse proxy using HTTP. If you want to use it with any other configuration, you will have to adapt the compose file.
|
||||
|
||||
## Setup
|
||||
|
||||
Copy the `sample.env` file into a `.env` file and choose secure passwords. Then run `docker compose up -d`
|
||||
|
||||
## Updating
|
||||
|
||||
Change the Postgres and Keycloak version in your `.env` file and run `docker compose build` (only required for updating Keycloak). Then run `docker compose up -d` again.
|
||||
|
|
38
compose.yml
Normal file
38
compose.yml
Normal file
|
@ -0,0 +1,38 @@
|
|||
version: '3.9'
|
||||
|
||||
services:
|
||||
keycloak_db:
|
||||
image: postgres:${POSTGRES_VERSION}
|
||||
restart: always
|
||||
environment:
|
||||
- POSTGRES_DB=keycloak
|
||||
- POSTGRES_USER=${KC_DB_USERNAME}
|
||||
- POSTGRES_PASSWORD=${KC_DB_PASSWORD}
|
||||
volumes:
|
||||
- ./data/postgres:/var/lib/postgresql/data
|
||||
|
||||
keycloak:
|
||||
build:
|
||||
dockerfile: Containerfile.keycloak
|
||||
args:
|
||||
KEYCLOAK_VERSION: ${KEYCLOAK_VERSION}
|
||||
depends_on:
|
||||
- keycloak_db
|
||||
environment:
|
||||
- KC_HEALTH_ENABLED=true
|
||||
- KC_DB=postgres
|
||||
- KC_DB_URL=jdbc:postgresql://keycloak_db:5432/keycloak
|
||||
- KC_DB_URL_DATABASE=keycloak
|
||||
- KC_PROXY_ADDRESS_FORWARDING=true
|
||||
- KC_HOSTNAME_STRICT_HTTPS=false
|
||||
- KC_PROXY=edge
|
||||
- KC_HTTP_ENABLED=true
|
||||
- KC_HOSTNAME_STRICT=false
|
||||
- KC_HOSTNAME=${KC_HOSTNAME}
|
||||
- KC_DB_USERNAME=${KC_DB_USERNAME}
|
||||
- KC_DB_PASSWORD=${KC_DB_PASSWORD}
|
||||
- KEYCLOAK_ADMIN=${KEYCLOAK_ADMIN}
|
||||
- KEYCLOAK_ADMIN_PASSWORD=${KEYCLOAK_ADMIN_PASSWORD}
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:8080
|
7
sample.env
Normal file
7
sample.env
Normal file
|
@ -0,0 +1,7 @@
|
|||
KEYCLOAK_VERSION=22.0
|
||||
KEYCLOAK_ADMIN=idpadmin
|
||||
KEYCLOAK_ADMIN_PASSWORD=
|
||||
KC_DB_USERNAME=ctbkidpdb
|
||||
KC_DB_PASSWORD=
|
||||
KC_HOSTNAME=idp.ctbk.de
|
||||
POSTGRES_VERSION=16.0
|
Loading…
Add table
Reference in a new issue