new: [add] new charm keycloak
This commit is contained in:
32
keycloak-elabore/README.rst
Normal file
32
keycloak-elabore/README.rst
Normal file
@@ -0,0 +1,32 @@
|
||||
Description
|
||||
===========
|
||||
|
||||
Using ``keycloak`` version 17.0
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To start with ``keycloak``, just put this service in your
|
||||
``compose.yml``::
|
||||
|
||||
keycloak:
|
||||
options:
|
||||
admin-password: CHANGEME
|
||||
relations:
|
||||
web-proxy:
|
||||
frontend:
|
||||
domain: id.mydomain.fr
|
||||
|
||||
Customize theme
|
||||
===============
|
||||
|
||||
You can customize theme by putting your theme in
|
||||
``/srv/datastore/data/keycloak/opt/keycloak/themes``
|
||||
|
||||
For example copy the material folder from
|
||||
https://github.com/MAXIMUS-DeltaWare/material-keycloak-theme and
|
||||
restart ``keycloak``.
|
||||
|
||||
Then go to your admin console, log in and go to the realm/themes part
|
||||
to choose you new theme
|
16
keycloak-elabore/build/Dockerfile
Normal file
16
keycloak-elabore/build/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM keycloak/keycloak:24.0.4 as builder
|
||||
|
||||
ENV KC_METRICS_ENABLED=true
|
||||
ENV KC_FEATURES=token-exchange
|
||||
ENV KC_DB=postgres
|
||||
|
||||
WORKDIR /opt/keycloak
|
||||
# for demonstration purposes only, please make sure to use proper certificates in production instead
|
||||
RUN keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -dname "CN=server" -alias server -ext "SAN:c=DNS:localhost,IP:127.0.0.1" -keystore conf/server.keystore
|
||||
RUN /opt/keycloak/bin/kc.sh build
|
||||
|
||||
FROM keycloak/keycloak:24.0.4
|
||||
COPY --from=builder /opt/keycloak/ /opt/keycloak/
|
||||
WORKDIR /opt/keycloak
|
||||
ENV KC_LOG_LEVEL=INFO
|
||||
ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start", "--optimized"]
|
16
keycloak-elabore/build/Dockerfiledebug
Normal file
16
keycloak-elabore/build/Dockerfiledebug
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM docker.0k.io/keycloak:17.0.1 as builder
|
||||
|
||||
ENV KC_METRICS_ENABLED=true
|
||||
ENV KC_FEATURES=token-exchange
|
||||
ENV KC_DB=postgres
|
||||
RUN /opt/keycloak/bin/kc.sh build
|
||||
|
||||
FROM builder as inspector
|
||||
ENTRYPOINT ["ls", "-l", "/opt/keycloak/lib/"]
|
||||
|
||||
|
||||
#FROM docker.0k.io/keycloak:17.0.0
|
||||
#COPY --from=builder /opt/keycloak/lib/quarkus/ /opt/keycloak/lib/quarkus/
|
||||
#WORKDIR /opt/keycloak
|
||||
#ENV KC_LOG_LEVEL=INFO
|
||||
#ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start"]
|
12
keycloak-elabore/hooks/init
Executable file
12
keycloak-elabore/hooks/init
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
admin_password=$(options-get admin-password) || exit 1
|
||||
|
||||
init-config-add "\
|
||||
$MASTER_BASE_SERVICE_NAME:
|
||||
environment:
|
||||
KEYCLOAK_ADMIN: \"admin\"
|
||||
KEYCLOAK_ADMIN_PASSWORD: \"$admin_password\"
|
||||
"
|
17
keycloak-elabore/hooks/postgres_database-relation-joined
Executable file
17
keycloak-elabore/hooks/postgres_database-relation-joined
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
PASSWORD="$(relation-get password)"
|
||||
USER="$(relation-get user)"
|
||||
DBNAME="$(relation-get dbname)"
|
||||
|
||||
config-add "\
|
||||
services:
|
||||
$MASTER_BASE_SERVICE_NAME:
|
||||
environment:
|
||||
KC_DB_URL: \"jdbc:postgresql://$MASTER_TARGET_SERVICE_NAME:5432/$DBNAME\"
|
||||
KC_DB_USERNAME: \"$USER\"
|
||||
KC_DB_PASSWORD: \"$PASSWORD\"
|
||||
KC_DB: \"postgres\"
|
||||
"
|
16
keycloak-elabore/hooks/web_proxy-relation-joined
Executable file
16
keycloak-elabore/hooks/web_proxy-relation-joined
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
DOMAIN=$(relation-get domain) || exit 1
|
||||
|
||||
set -e
|
||||
|
||||
config-add "\
|
||||
services:
|
||||
$MASTER_BASE_SERVICE_NAME:
|
||||
environment:
|
||||
KC_HOSTNAME: \"$DOMAIN\"
|
||||
KC_PROXY: edge
|
||||
KC_HTTP_ENABLED: \"true\"
|
||||
KC_HOSTNAME_STRICT: \"false\"
|
||||
"
|
||||
|
24
keycloak-elabore/metadata.yml
Normal file
24
keycloak-elabore/metadata.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
data-resources:
|
||||
- /opt/keycloak/themes
|
||||
|
||||
default-options:
|
||||
|
||||
uses:
|
||||
web-proxy:
|
||||
#constraint: required | recommended | optional
|
||||
#auto: pair | summon | none ## default: pair
|
||||
constraint: recommended
|
||||
auto: pair
|
||||
solves:
|
||||
proxy: "Public access"
|
||||
default-options:
|
||||
target: !var-expand ${MASTER_BASE_SERVICE_NAME}:8080
|
||||
postgres-database:
|
||||
#constraint: required | recommended | optional
|
||||
#auto: pair | summon | none ## default: pair
|
||||
constraint: required
|
||||
auto: summon
|
||||
solves:
|
||||
database: "main storage"
|
||||
default-options:
|
Reference in New Issue
Block a user