简体   繁体   中英

Adding Keycloak to an existing OpenShift application

I also submitted this question to the Keycloak mailing list.

Maybe I haven't fully grasped the concepts behind OpenShift. I'd like to run my application in the OpenShift cloud and secure it with Keycloak. My application is already running, using 2 gears. 1 gear has the web-app running in WildFly 10, the 2nd gear hosts the PostgreSQL database.

I tried adding Keycloak by adding a cartridge to my application like this using https://github.com/keycloak/openshift-keycloak-cartridge :

rhc add-cartridge http://cartreflect-claytondev.rhcloud.com/github/keycloak/openshift-keycloak-cartridge

This results in the following error:

The cartridge 'http://cartreflect-claytondev.rhcloud.com/github/keycloak/openshift-keycloak-cartridge' will be downloaded and installed
Adding http://cartreflect-claytondev.rhcloud.com/github/keycloak/openshift-keycloak-cartridge to application ‘my_app' ... jboss-wildfly-10 already exists in your application

It seems logical to me to run my application in WildFly on one gear and Keycloak, also on WildFly, on a second gear. What is best practice to add Keycloak to an existing OpenShift application, also running on WildFly? Should I deploy Keycloak in the same WildFly instance?

If I cannot deploy two cartridges based on the same 'base cartridge' within the same app, how does OpenShift scale up my application? Isn't that the same thing?

On OpenShift, each application that you create can only have one (1) cartridge that satisfies the "web_framework" category, which currently for you is WildFly. When you are trying to install the keycloak cartridge, it is also a web_framework cartridge ( https://github.com/keycloak/openshift-keycloak-cartridge/blob/master/metadata/manifest.yml ) which you can see under "categories".

When an application scales up, it adds more gears, and each gear then gets it's own copy of the web_framework cartridge installed on it.

You can learn more about how cartridges work here: https://docs.openshift.org/origin-m4/oo_cartridge_developers_guide.html

If you want to use Keycloak, you should install it onto it's own gear (just like you setup Wildfly).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM