search cancel

Is it possible to modify Wildfly standalone XML configuration in vApp?

book

Article ID: 133305

calendar_today

Updated On:

Products

CA Identity Suite

Issue/Introduction

The intension is to change the log rotation of Wildfly sever.log, e.g. /opt/CA/wildfly-idm/standalone/log/server.log from periodic rotation to size based rotation in a vApp (CA Identity Suite Virtual Appliance). In a non-vApp Identity Manager environment, it is able to modify Wildfly standalone XML file directly using text editor as the following

From:

            <periodic-rotating-file-handler autoflush="true" name="FILE">
                <formatter>
                    <named-formatter name="PATTERN"/>
                </formatter>
                <file path="server.log" relative-to="jboss.server.log.dir"/>
                <suffix value=".yyyy-MM-dd"/>
                <append value="true"/>
            </periodic-rotating-file-handler>

To:

            <size-rotating-file-handler autoflush="true" name="FILE">
               <formatter> 
                   <named-formatter name="PATTERN"/> 
               </formatter>
               <file relative-to="jboss.server.log.dir" path="server.log"/>
               <rotate-size value="10m"/>
               <max-backup-index value="5"/>
               <append value="true"/> 
            </size-rotating-file-handler>

However, in vApp login is limited to config user only and the /opt/CA/wildfly-idm/standalone/configuration/ca-standalone-full-ha.xml file's ownership and write privilege only available to wildfly user. Modifying the XML file directly using a text editor is not allowed. Is there a way to modify Wildfly standalone XML configuration in vApp?

Environment

Release: CA Identity Suite 14.x

Component: Wildfly

Resolution

We may utilize Wildfly's jboss-cli (e.g. /opt/CA/wildfly-idm/bin/jboss-cli.sh) to achieve this objective.

Please consider this modification as customization and customer is responsible for backup and testing before deploying this to production environment. Please document the changes and inform this customization when raising call ticket with Broadcom Technical Support.

This article takes above-mentioned Wildfly's server.log log rotation modification as an example. Here are the steps.

1. Backup vApp by creating VM snapshot

     Important: If you have mistakenly modified the configuration and fallen into situation where Wildfly won't start then restoring VM snapshot is the easiest and proper way to recover. In vApp you cannot run Wildfly in Admin-Only mode that enables configuration repair through jboss-cli again. Please make sure you have a good VM snapshot before proceeding. Another workaround is to run reconfigure_im command that regenerates the original standalone XML file. 

2. Create a local management account for JBoss/Wildfly

    a. Run
         sudo /opt/CA/wildfly-idm/bin/add-user.sh

    b. Answer with: a (Management User)

    c. Answer with a username and password: for example jboss-admin, Password01!

    d.  Answer with the following group:  IAMAdmin  (you shouldn't specify any other group)

    e.  Answer yes to confirm this configuration:   yes

    f.   Answer no, not to use this credential for remote connection:   no

3. Take a backup of ca-standalone-full-ha.xml

     /opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=:take-snapshot

   The copy of ca-standalone-full-ha.xml will be created under /opt/CA/wildfly-idm/standalone/configuration/standalone_xml_history/snapshot directory

4. Create a text file, /home/config/size-rotating-file-handler.cli with the following contents

/subsystem=logging/periodic-rotating-file-handler=FILE:remove
/subsystem=logging/size-rotating-file-handler=FILE:add(file={"path"=>"server.log", "relative-to"=>"jboss.server.log.dir"})
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="autoflush", value="true")
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="named-formatter", value="PATTERN")
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="rotate-size", value="10m")
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="max-backup-index", value="5")
/subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name="append", value="true")

    This file contains jboss-cli commands that will remove default periodic-rotating-file-handler and add size-rotating-file-handler.

5. Use jboss-cli.sh to run the above cli file

/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --file=size-rotating-file-handler.cli

6. Now you need to restart IM

restart_im

Notes: You need to run this on each vApp node if you wish to have the same configuration.

Additional Information

https://docs.jboss.org/author/display/WFLY/Command+Line+Interface


Attachments