Bootstrapp keycloak

This commit is contained in:
Luke Murphy 2020-03-15 13:28:35 +01:00
parent 38999c57c4
commit ee5e0ae84c
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
5 changed files with 40 additions and 7 deletions

5
CHECKS Normal file
View File

@ -0,0 +1,5 @@
WAIT=3
TIMEOUT=3
ATTEMPTS=5
/auth Welcome to Keycloak

View File

@ -1,3 +1,9 @@
FROM jboss/keycloak:9.0.0 FROM jboss/keycloak:9.0.0
EXPOSE 80:8080 EXPOSE 8080
COPY . ${WORKDIR}
COPY sbin/* /sbin/
ENTRYPOINT ["/sbin/dokku-entrypoint.sh"]

View File

@ -1,3 +1,3 @@
# keycloak-dokku # keycloak-dokku
See [gitea-experiment repository](https://gitlab.com/autonomic-cooperative/gitea-experiment) for deploy instructions. See [gitea-experiment repository](https://gitlab.com/autonomic-cooperative/gitea-experiment) for more.

View File

@ -1,9 +1,5 @@
{ {
"name": "keycloak", "name": "keycloak",
"description": "Open Source Identity and Access Management", "description": "Open Source Identity and Access Management",
"repository": "https://gitlab.com/autonomic-cooperative/keycloak-dokku", "repository": "https://gitlab.com/autonomic-cooperative/keycloak-dokku"
"success_url": "/",
"dokku": {
"plugins": []
}
} }

26
sbin/dokku-entrypoint.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -eu -o pipefail
setup_root_user() {
set -eu
if ! grep -q "$ADMIN_USER" /opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json; then
if /opt/jboss/keycloak/bin/add-user-keycloak.sh -r master -u "$ADMIN_USER" -p "$ADMIN_PASS"; then
echo "=====> root user added"
else
echo "=====> Failed to add root user"
exit 1
fi
fi
}
main() {
set -eu
setup_root_user
}
main
/usr/bin/entrypoint "$@"