Skip to content

Create Multiple Wildfly Services Configuration

Create Multiple Wildfly Services Configuration in Keycloak Operational Issues.

4 min read Updated SS RS

Create Multiple Wildfly Services Configuration#

To manage the load of wildfly, create a second instance of wildfly and keep it behind haproxy.

Follow the below steps to create the wildfly:

  1. Copy the keycloak.nomad as keycloak_new.nomad as below:

    Bash

    cp keycloak.nomad keycloak_new.nomad
    
  2. Edit the below file

    File

    keycloak_new.nomad
    

    And perform the below changes

    • job : "keycloak_new"
    • value : New server ip
    • Volume: Update the existing section as below:

    From:

    Bash

    "/opt/test-
    5.o/appnomic/centeralized_logs/keycloak:/opt/jboss/keycloak/standalo
    ne/log"
    

    Update it as below :

    Bash

    "/opt/test-
    5.o/appnomic/centeralized_logs/keycloak_new:/opt/jboss/keycloak/stan
    dalone/log"
    
    • Change “hostname ” to “ip ” in template section as below:

    From:

    Bash

    KEYCLOAK_IP="{{ key "service/keycloak/hostname" }}"
    

    Update it as below :

    Bash

    KEYCLOAK_IP="{{ key "service/keycloak/ip_new" }}"
    
  3. Save keycloak_new.nomad file.

    Bash

    :wq!
    
  4. Create two consul keys for new keycloak instance.

    Bash

    consul kv put service/keycloak/ip_<new server IP>
    consul kv get service/keycloak/hostname_<new keycloak file name>
    

    For Example:

    Bash

    consul kv put service/keycloak/ip_new "192.0.2.17"
    consul kv get service/keycloak/hostname_new "keycloak_new.example"
    
  5. Add new entry in below directory for respective server ip and

    keycloak_new .hostname_new

    Directory

    cd /etc/hosts
    

    Entries:

    Bash

    <server ip> <keycloak_new.hostname_new>
    

    For Example:

    Bash

    192.0.2.2 keycloak_new.example
    
  6. Open the below file:

    File

    <serv installation path >/Appsone_Service/conf-template/appsone-ui-
    service/conf.properties.tpl
    

    And change “hostname ” to “ip_new ” in new keycloak service running server.

    • Default:

    Bash

    keycloak.ip={{ key "service/keycloak/hostname " }}
    
    • Update it as below:

    Bash

    keycloak.ip={{ key "service/keycloak/ip_new" }}
    
  7. Open the below file:

    File

    <serv installation path >/Appsone_Service/conf-template/appsone-ui-
    service/ keycloak_details.json.tpl
    

    And change “hostname ” to “ip_new ” in new keycloak service running server.

    • Default:

    Bash

    https://{{ key "service/keycloak/hostname" }}
    
    • Update it as below:

    Bash

    https://{{ key "service/keycloak/ip_new" }}
    
  8. Perform the above changes in files listed below:

    • appsone-controlcenter ,
    • appsone-query-api ,
    • advanced-analytics-ds ,
    • analytics-workstation and
    • supervisor-controller .
    • Open the keycloak ports by using below command.

    Bash

    firewall-cmd --add-port=8443/tcp --zone=public --permanent
    firewall-cmd --reload
    
  9. Perform the same steps for existing keycloak service and change the “hostname ” to “ip ”

  10. Restart both keycloak service in each node.

    • Stop nomad

    Bash

    nomad stop keycloak
    
    • Start nomad

    Bash

    nomad run keycloak
    
  11. Add new acl (Access Control List) for "appsone-ui-service "

    • Open the below file

    Bash

    haproxy.cfg
    
    • Edit the file as below:

    Bash

    frontend HTTP2_frontend
     acl url_au path_beg -i /appsone-ui-service
     use_backend dshttp2 if url_au
     backend dshttp2
        balance roundrobin
        cookie SERVERID insert indirect nocache
        server keycloak_http2 192.0.2.17:8444 check cookie
    keycloak_http2 inter 3s rise 2 fall 3 ssl verify none
        server keycloak_new_http2 192.0.2.17:8444 check cookie
    keycloak_new_http2 inter 3s rise 2 fall 3 ssl verify
    
  12. Restart HAProxy

    • Stop nomad

    Bash

    nomad stop haproxy
    
    • Start nomad

    Bash

    nomad run haproxy
    
  13. Try accessing keycloak through haproxy front end port by navigating to below path:

    Path

    https://<HAProxy_IP>:<HAProxy_Port>/path-to-keycloak
    
    • User name: appsoneadmin
    • Password: ******

Account Mapping for Users#

After logging in, no accounts were observed for the user. This was due to upon user creation, accounts are mapped based on the attributes (account name) configured in Keycloak.

To rectify the issue, follow as below:

Ensure that the account name provided in the user attributes matches the name exactly as it appears in the "account " table in Percona.

Note: The mapping is case-sensitive.

Keycloak Issues screenshot (page 29)

Repetition of Application in Appsone UI#

The Application tab displays a duplicate application.

To rectify the issue, follow the below steps:

  • Here id 1 and 7 both are related to application OnlineBanking.
  • Check in tag mapping table service were mapped to which id.
  • Remap all the service to id 7 .
  • Delete the id 1 in controller table.

TimeZone Issues in Keycloak Service#

If the server has a different time zone and not available in the mst_timezone table, the Keycloak service fails to start, and the following error occurs:

Keycloak Issues screenshot (page 30)

To rectify the issue, follow as below:

  1. Update the server TimeZone in the Keycloak Consul JDBC parameter keys as shown below and restart the Keycloak service:

    consul kv put service/keycloak/jdbcparams
    "verifyServerCertificate=false&useSSL=true&requireSSL=true&enabledTL
    SProtocols=TLSv1.2&characterEncoding=UTF-8&serverTimezone=GMT"
    

Service-Specific Instances Absent from Heatmap#

Instances are not appearing in the heatmap for required services, this is due to the missing mapping between the cluster and service in the tag_mapping table.

To rectify the issue, follow as below:

  1. Identify the cluster ID in the comp_instance table.

    For example : If the cluster name is 'Weblogic-Cluster ' and the ID is 6 .

  2. Identify the service ID in the controller table.

    For example: if the service name is 'Weblogic-service ' and the ID is 6 .

  3. Check if there is an entry in the tag_mapping table for the specified object ID and object reference table ('comp_instance ').

    Execute the following query:

    SELECT * FROM tag_mapping WHERE object_id = 6 AND object_ref_table =
    'comp_instance';
    
  4. If the entry is missing, insert it into the tag_mapping table.

    For Example: Execute the following query,

    INSERT INTO tag_mapping VALUES (id, 1, 6, 'comp_instance', 6,
    'Weblogic-Service', utc_timestamp(), 2, '7640123a-
    fbde-4fe5-9812-581cd1e3a9c1');
    
  5. After making the entry, validate the heatmap to ensure instances are now visible.