WildFly instances can be easily started in OpenShift. Tech Tip #7 shows how to spin up an instance of WildFly in OpenShift. Tech Tip #21 explained how to get started using JBoss Tools.
Now this WildFly instance is started with the stock configuration.xml. However some times you may want to configure the containers or specify additional configuration information in this file. This Tech Tip will show you how to do that.
Let’s go!
- Start a WildFly instance as explained in Tech Tip #7.
- On the application page, clone the workspace associated with this application. The command will look something like:
123git clone ssh://XXXXXXXXXX@test-milestogo.rhcloud.com/~/git/test.git/ - This workspace has
.openshift/standalone.xml
file. Edit this file to meet your need. For example, if you want to use Infinispan as a persistency solution in standalone mode, then you’ll add the following code fragment:
12345<cache-container name="myCache" default-cache="cachedb"><local-cache name="cachedb"/></cache-container><subsystem xmlns="urn:jboss:domain:infinispan:2.0">
section. - Commit and push the change:
123456config> <strong>git commit standalone.xml -m"additional configuration elements"</strong>[master cef567d] additional configuration elements1 file changed, 1 deletion(-)config> <strong>git push</strong>
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374Counting objects: 9, done.Delta compression using up to 8 threads.Compressing objects: 100% (5/5), done.Writing objects: 100% (5/5), 656 bytes | 0 bytes/s, done.Total 5 (delta 1), reused 0 (delta 0)remote: Stopping wildfly cartremote: Repairing links for 1 deploymentsremote: Building git ref 'master', commit cef567dremote: Found pom.xml... attempting to build with 'mvn -e clean package -Popenshift -DskipTests'remote: Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)remote: Maven home: /usr/share/java/apache-maven-3.0.4remote: Java version: 1.8.0_05, vendor: Oracle Corporationremote: Java home: /var/lib/openshift/XXXXXXXXXX/wildfly/usr/lib/jvm/jdk1.8.0_05/jreremote: Default locale: en_US, platform encoding: ANSI_X3.4-1968remote: OS name: "linux", version: "2.6.32-431.23.3.el6.x86_64", arch: "i386", family: "unix"remote: [INFO] Scanning for projects...remote: [INFO]remote: [INFO] ------------------------------------------------------------------------remote: [INFO] Building test 1.0remote: [INFO] ------------------------------------------------------------------------remote: [INFO]remote: [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ test ---remote: [INFO]remote: [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ test ---remote: [debug] execute contextualizeremote: [INFO] Using 'UTF-8' encoding to copy filtered resources.remote: [INFO] Copying 1 resourceremote: [INFO]remote: [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ test ---remote: [INFO] Nothing to compile - all classes are up to dateremote: [INFO]remote: [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ test ---remote: [debug] execute contextualizeremote: [INFO] Using 'UTF-8' encoding to copy filtered resources.remote: [INFO] skip non existing resourceDirectory /var/lib/openshift/XXXXXXXXXX/app-root/runtime/repo/src/test/resourcesremote: [INFO]remote: [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ test ---remote: [INFO] No sources to compileremote: [INFO]remote: [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ test ---remote: [INFO] Tests are skipped.remote: [INFO]remote: [INFO] --- maven-war-plugin:2.3:war (default-war) @ test ---remote: [INFO] Packaging webappremote: [INFO] Assembling webapp [test] in [/var/lib/openshift/XXXXXXXXXX/app-root/runtime/repo/target/test]remote: [INFO] Processing war projectremote: [INFO] Copying webapp resources [/var/lib/openshift/XXXXXXXXXX/app-root/runtime/repo/src/main/webapp]remote: [INFO] Webapp assembled in [341 msecs]remote: [INFO] Building war: /var/lib/openshift/XXXXXXXXXX/app-root/runtime/repo/deployments/ROOT.warremote: [INFO] ------------------------------------------------------------------------remote: [INFO] BUILD SUCCESSremote: [INFO] ------------------------------------------------------------------------remote: [INFO] Total time: 8.365sremote: [INFO] Finished at: Tue Aug 26 18:01:19 EDT 2014remote: [INFO] Final Memory: 9M/113Mremote: [INFO] ------------------------------------------------------------------------remote: Preparing build for deploymentremote: Deployment id is 336d5b75remote: Activating deploymentremote: Deploying WildFlyremote: Starting wildfly cartremote: Found 127.12.40.129:8080 listening portremote: Found 127.12.40.129:9990 listening portremote: /var/lib/openshift/XXXXXXXXXX/wildfly/standalone/deployments /var/lib/openshift/XXXXXXXXXX/wildflyremote: /var/lib/openshift/XXXXXXXXXX/wildflyremote: CLIENT_MESSAGE: Artifacts deployed: ./ROOT.warremote: -------------------------remote: Git Post-Receive Result: successremote: Activation status: successremote: Deployment completed with status: successTo ssh://XXXXXXXXXX@test-milestogo.rhcloud.com/~/git/test.git/b08ebff..cef567d master -> master
Now the WildFly instance in OpenShift will use the updated configuration file.
You can even verify this by logging into your application as:
1
2
3
|
ssh XXXXXXXXXX@test-milestogo.rhcloud.com
|
And checking for the updated elements in wildfly/standalone/configuration/standalone.xml
file.
Alternatively, you can ssh into your instance and use the JBoss CLI to make updates to your standalone.xml file.
Enjoy!
Nice to see the best and positive feedback from the online game lovers for my post,i known that you all like Free cell and after played it share the information too.