王子1986
王子1986

Reputation: 3599

How to deploy keycloak to cloudfoundry

As the title, is there any guide to deploy keycloak to cloud foundry?

Seems like cloudfoundry is only friendly to spring boot applications.

Upvotes: 4

Views: 2732

Answers (2)

kinjelom
kinjelom

Reputation: 6450

Keycloak Single Instance on CF

To deploy single instance try to cf push the docker image using manifest.yml like this (Postgres DB example):

---
applications:
- name: sso
  docker:
    image: jboss/keycloak
  instances: 1
  memory: 2G
  disk_quota: 2G
  env: 
    PROXY_ADDRESS_FORWARDING: true
    DB_VENDOR: postgres
    DB_ADDR: 192.168.1.23
    DB_PORT: 5432
    DB_DATABASE: keycloakdb
    DB_USER: keycloak
    DB_PASSWORD: a-lot-of-asterisks

You can do it also with the following commands without a manifest file:

$ cf push sso --docker-image jboss/keycloak -i 1 -m 2G -k 2G --no-start

$ cf set-env sso PROXY_ADDRESS_FORWARDING true
$ cf set-env sso DB_VENDOR: postgres
$ cf set-env sso DB_ADDR 192.168.1.23 
$ cf set-env sso DB_PORT 5432 
$ cf set-env sso DB_DATABASE keycloakdb 
$ cf set-env sso DB_USER keycloak 
$ cf set-env sso DB_PASSWORD a-lot-of-asterisks

$ cf env sso
$ cf start sso

$ cf logs sso --recent

Keycloak HA Cluster ona CF

Please look at: Keycloak standalone cluster on Cloud Foundry

References


Do you consider using Cloud Foundry's UAA?

CF UAA is the central identity management service for both users and applications, that supports: federated login, LDAP, SAML, SSO and multifactor authentication.

Upvotes: 4

THelper
THelper

Reputation: 15619

In my experience the easiest solution is to wrap Keycloak in a Spring-Boot application (together with the required JBoss parts) and deploy that. This allows you to create a single jar and push that to Cloud Foundry with the standard Java build pack.

This is exactly what someone has done in this Github project. The project injects a basic configuration for Keycloak with the default H2 database. All you need to do is clone the project, run mvn package and push the resulting jar to CF.

Upvotes: 3

Related Questions