JBossAS7.1 Configuration in OpenShift
Posted by starksm64 in Scott Stark's Blog on May 17, 2012 8:46:21 AMThe OpenShift PaaS environment has updated the JBossAS cartridge to use jboss-as-7.1.0.Final as the server version. This post updates how to test the OpenShift JBossAS7 7.1.0.Final based cartridge standalone configuration in your own environment.
The configuration of the JBossAS7 server used by the OpenShift Express JBossAS cartridge is a simple modification of the jboss-as-7.1.0.Final release which my be obtained from http://www.jboss.org/as7.html
The contents of the jboss-as-7.1.0.Final release need to be updated with the attached standalone.xml, standalone.conf, and the database driver modules. The exact steps would be:
- Create a demo directory to contain the files. I use /tmp/as710conf, so if you use the same, no changes need to be made to the following directions or configuration files.
- download http://download.jboss.org/jbossas/7.1/jboss-as-7.1.0.Final/jboss-as-7.1.0.Final.zip
- unzip jboss-as-7.1.0.Final.zip
- Create a link from jbossas-7 to jboss-as-7.1.0.Final, or copy the jboss-as-7.1.0.Final directory to jbossas-7
- ln -s jboss-as-7.1.0.Final jbossas-7
- Download the attachments on this blog
- unzip bin.zip to get the bin/{standalone.conf,standalone.sh} files
- cp bin/* to jbossas-7/bin
- Edit the jbossas-7/bin/standalone.conf file to change any of the
- unzip the modules.zip from within the jbossas-7 directory to add the modules for mysql, mongodb, and switchyard to the server modules. (Note, the attached modules.zip does not contain the switchyard modules as this made the attachment too large. To build the full modules.zip, clone the https://github.com/openshift/jboss-as7-modules repo and do a 'gradle createModuleZip' to build it.)
There are several environment variables referenced in the standalone.xml from the OpenShift JBossAS7 cartridge standalone.xml and standalone.conf files. They are:
# OPENSHIFT_GEAR_NAME is the NAME of the application as passed to the rhc create app -a NAME … command OPENSHIFT_GEAR_NAME # OPENSHIFT_REPO_DIR is the git repository of the application deployment. For reproducing the standalone configuration # it has no meaningful value as it is only used to pickup application specific overrides of the server # configuration files. OPENSHIFT_REPO_DIR = # OPENSHIFT_GEAR_DIR is the root directory of the application. OPENSHIFT_GEAR_DIR = # OPENSHIFT_GEAR_TYPE is jbossas-7 for a jbossas cartridge. This is also used as the root of # the jbossas7 application server associated with the application. In the OpenShift environment, each # application is associated with a user that has a copy of the jboss-as-7.1.0.Final server contents installed to ${OPENSHIFT_GEAR_DIR}${OPENSHIFT_GEAR_TYPE}, e.g., /tmp/demo/jbossas-7. OPENSHIFT_GEAR_TYPE = jbossas-7. # OPENSHIFT_DB_TYPE is the type of the embedded database configured using the rhc-ctl-app command: # rhc-ctl-app -a demo -e add-mysql-5.1 # This will be empty if no database cartridge has been embedded. OPENSHIFT_DB_TYPE = # OPENSHIFT_DB_HOST gives the IP address the embedded database is listening on OPENSHIFT_DB_HOST # OPENSHIFT_DB_PORT gives the port the embedded database is listening on OPENSHIFT_DB_PORT # OPENSHIFT_DB_USERNAME gives the configured username to access the embedded database OPENSHIFT_DB_USERNAME # OPENSHIFT_DB_PASSWORD gives the configured username to access the embedded database OPENSHIFT_DB_PASSWORD # OPENSHIFT_INTERNAL_IP is the local ip address to bind the server's services to. Typically you would use # localhost/127.0.0.1 for your local environment. OPENSHIFT_INTERNAL_IP = # OPENSHIFT_JBOSS_CLUSTER is the ip address[port] for the TCPPING initial_hosts property used by the jgroups # subsystem configuration. This is used when scaling of the application is enabled in OpenShift. For local, single server # testing this will not be used. OPENSHIFT_JBOSS_CLUSTER = # OPENSHIFT_JBOSS_CLUSTER_PROXY_PORT is the port used by the TCP groups protocol bind_port property. OPENSHIFT_JBOSS_CLUSTER_PROXY_PORT = 7600 # OPENSHIFT_GEAR_DNS is the public dns name of the server hosting the application created by rhc app create -a … . # For an application named demo, in a domain named jbossdev, the DNS name would be: demo-jbossdev.rhcloud.com. # This is used by the jgroups subsystem configuration as the ip address/hostname for the external_addr property used to # communicate with other jboss instances. For a local, single server testing this should be the same as the # OPENSHIFT_INTERNAL_IP value. OPENSHIFT_GEAR_DNS = # The node_profile value is derived from the type of node the application is running on. The default is small as that is the free # offering which provide 500Mb of memory to the application. node_profile = small
The relevant values for these in the attached standalone.conf file that I tested with are:
#### Edit this variables for your test environment export OPENSHIFT_GEAR_NAME=as710conf export OPENSHIFT_GEAR_DIR=/tmp/as710conf/ export OPENSHIFT_GEAR_TYPE=jbossas-7 export OPENSHIFT_INTERNAL_IP=127.0.0.1 export OPENSHIFT_GEAR_DNS=127.0.0.1 export node_profile=small ####
Running the OpenShift configuration is realized by executing the standalone.sh from your jbossas-7/bin directory:
[152](ironmaiden:as710conf) > cd /tmp/as710conf/jbossas-7/bin/ [153](ironmaiden:bin) > ./standalone.sh ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /tmp/as710conf/jbossas-7 JAVA: /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java JAVA_OPTS: -d32 -client -Xmx256m -XX:MaxPermSize=128m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Djboss.node.name=127.0.0.1 -Djgroups.bind_addr=127.0.0.1 ========================================================================= 05:47:38,320 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA 05:47:38,490 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA 05:47:38,554 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting 05:47:39,265 INFO [org.xnio] XNIO Version 3.0.3.GA 05:47:39,265 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http) 05:47:39,274 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA 05:47:39,283 INFO [org.jboss.remoting] JBoss Remoting version 3.2.2.GA 05:47:39,294 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers 05:47:39,297 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem 05:47:39,307 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem. 05:47:39,328 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem 05:47:39,333 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem 05:47:39,336 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem 05:47:39,342 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013100: Current PicketBox version=4.0.6.final 05:47:39,359 INFO [org.jboss.as.connector] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final) 05:47:39,372 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension 05:47:39,480 INFO [org.jboss.as.naming] (MSC service thread 1-8) JBAS011802: Starting Naming Service 05:47:39,503 INFO [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default] 05:47:39,518 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) 05:47:39,567 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-7) JBoss Web Services - Stack CXF Server 4.0.1.GA 05:47:39,687 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-7) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080 05:47:39,837 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) JBAS015012: Started FileSystemDeploymentService for directory /tmp/as710conf/jbossas-7/standalone/deployments 05:47:39,853 INFO [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on /127.0.0.1:4447 05:47:39,853 INFO [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /127.0.0.1:9999 05:47:39,941 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS] 05:47:39,950 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 1922ms - Started 134 of 205 services (70 services are passive or on-demand)
Diff of Configuration Files
The full difference from the base standalone.xml configuration you would see in a current jbossas-7 cartridge application on OpenShift vs the standalone.xml seen in the jboss-as-7.1.0.Final/standalone/configuration/standalone.xml is show below.
[260](ironmaiden:tmp) > diff -w /tmp/demo/.openshift/config/standalone.xml /home/git/JBossAS/Downloads/jboss-as-7.1.0.Final/standalone/configuration/standalone.xml 7c7 < <extension module="org.jboss.as.clustering.jgroups"/> --- > <extension module="org.jboss.as.configadmin"/> 18a19 > <extension module="org.jboss.as.osgi"/> 25a27 > <extension module="org.jboss.as.webservices"/> 29c31 < <!--management> --- > <management> 50c52 < </management--> --- > </management> 54c56 < <!--console-handler name="CONSOLE"> --- > <console-handler name="CONSOLE"> 59c61 < </console-handler--> --- > </console-handler> 62c64 < <pattern-formatter pattern="%d{yyyy/MM/dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> --- > <pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/> 86c88 < <!--handler name="CONSOLE"/--> --- > <handler name="CONSOLE"/> 90a93 > <subsystem xmlns="urn:jboss:domain:configadmin:1.0"/> 93,94c96,97 < <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS"> < <connection-url>jdbc:h2:${jboss.server.data.dir}/test;DB_CLOSE_DELAY=-1</connection-url> --- > <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true"> > <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url> 101,116d103 < <datasource jndi-name="java:jboss/datasources/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS"> < <connection-url>jdbc:mysql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_GEAR_NAME}</connection-url> < <driver>mysql</driver> < <security> < <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name> < <password>${env.OPENSHIFT_DB_PASSWORD}</password> < </security> < </datasource> < <datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true"> < <connection-url>jdbc:postgresql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_GEAR_NAME}</connection-url> < <driver>postgresql</driver> < <security> < <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name> < <password>${env.OPENSHIFT_DB_PASSWORD}</password> < </security> < </datasource> 121,126d107 < <driver name="mysql" module="com.mysql.jdbc"> < <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class> < </driver> < <driver name="postgresql" module="org.postgresql.jdbc"> < <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class> < </driver> 139c120 < <stateful default-access-timeout="5000" cache-ref="simple" clustered-cache-ref="clustered"/> --- > <stateful default-access-timeout="5000" cache-ref="simple"/> 142c123 < <!--mdb> --- > <mdb> 145c126 < </mdb--> --- > </mdb> 155d135 < <cache name="clustered" passivation-store-ref="infinispan" aliases="StatefulTreeCache"/> 159d138 < <cluster-passivation-store name="infinispan" cache-container="ejb"/> 172d150 < <!--iiop enable-by-default="false" use-qualified-name="false"/--> 174,204c152 < <subsystem xmlns="urn:jboss:domain:infinispan:1.1" default-cache-container="cluster"> < <cache-container name="cluster" aliases="ha-partition" default-cache="default"> < <transport lock-timeout="60000"/> < <replicated-cache name="default" mode="SYNC" batching="true"> < <locking isolation="REPEATABLE_READ"/> < </replicated-cache> < </cache-container> < <cache-container name="web" aliases="standard-session-cache" default-cache="repl"> < <transport lock-timeout="60000"/> < <replicated-cache name="repl" mode="ASYNC" batching="true"> < <file-store/> < </replicated-cache> < <replicated-cache name="sso" mode="SYNC" batching="true"/> < <distributed-cache name="dist" mode="ASYNC" batching="true"> < <file-store/> < </distributed-cache> < </cache-container> < <cache-container name="ejb" aliases="sfsb sfsb-cache" default-cache="repl"> < <transport lock-timeout="60000"/> < <replicated-cache name="repl" mode="ASYNC" batching="true"> < <eviction strategy="LRU"/> < <file-store/> < </replicated-cache> < <!-- Clustered cache used internally by EJB subsytem for managing the client-mapping(s) of < the socketbinding referenced by the EJB remoting connector --> < <replicated-cache name="remote-connector-client-mappings" mode="SYNC" batching="true"/> < <distributed-cache name="dist" mode="ASYNC" batching="true"> < <eviction strategy="LRU"/> < <file-store/> < </distributed-cache> < </cache-container> --- > <subsystem xmlns="urn:jboss:domain:infinispan:1.1" default-cache-container="hibernate"> 206,208c154,155 < <transport lock-timeout="60000"/> < <local-cache name="local-query"> < <transaction mode="NONE"/> --- > <local-cache name="entity"> > <transaction mode="NON_XA"/> 212,213c159,160 < <invalidation-cache name="entity" mode="SYNC"> < <transaction mode="NON_XA"/> --- > <local-cache name="local-query"> > <transaction mode="NONE"/> 216,217c163,164 < </invalidation-cache> < <replicated-cache name="timestamps" mode="ASYNC"> --- > </local-cache> > <local-cache name="timestamps"> 220c167 < </replicated-cache> --- > </local-cache> 229,231c176,178 < <core-threads count="10"/> < <queue-length count="10" /> < <max-threads count="10" /> --- > <core-threads count="50"/> > <queue-length count="50"/> > <max-threads count="50"/> 235,237c182,184 < <core-threads count="10"/> < <queue-length count="10" /> < <max-threads count="10" /> --- > <core-threads count="50"/> > <queue-length count="50"/> > <max-threads count="50"/> 243,275c190,192 < <subsystem xmlns="urn:jboss:domain:jgroups:1.0" default-stack="tcp"> < <stack name="tcp"> < <transport type="TCP" socket-binding="jgroups-tcp"> < <property name="external_addr">${env.OPENSHIFT_GEAR_DNS}</property> < <property name="external_port">${env.OPENSHIFT_JBOSS_CLUSTER_PROXY_PORT}</property> < <property name="bind_port">7600</property> < <property name="bind_addr">${env.OPENSHIFT_INTERNAL_IP}</property> < </transport> < <protocol type="TCPPING"> < <property name="timeout">3000</property> < <property name="initial_hosts">${env.OPENSHIFT_JBOSS_CLUSTER}</property> < <property name="port_range">0</property> < <property name="num_initial_members">1</property> < </protocol> < <protocol type="MERGE2"/> < <protocol type="FD"/> < <protocol type="VERIFY_SUSPECT"/> < <protocol type="BARRIER"/> < <protocol type="pbcast.NAKACK"/> < <protocol type="UNICAST2"/> < <protocol type="pbcast.STABLE"/> < <protocol type="pbcast.GMS"/> < <protocol type="UFC"/> < <protocol type="MFC"/> < <protocol type="FRAG2"/> < <protocol type="AUTH"> < <property name="auth_class">org.jgroups.auth.MD5Token</property> < <property name="token_hash">SHA</property> < <property name="auth_value">${env.OPENSHIFT_JBOSS_CLUSTER}</property> < </protocol> < <!--protocol type="pbcast.STATE_TRANSFER"/> < <protocol type="pbcast.FLUSH"/--> < </stack> --- > <subsystem xmlns="urn:jboss:domain:jmx:1.1"> > <show-model value="true"/> > <remoting-connector/> 285a203,218 > <subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="lazy"> > <properties> > <!-- Specifies the beginning start level of the framework --> > <property name="org.osgi.framework.startlevel.beginning">1</property> > </properties> > <capabilities> > <!-- modules registered with the OSGi layer on startup --> > <capability name="javax.servlet.api:v25"/> > <capability name="javax.transaction.api"/> > <!-- bundles started in startlevel 1 --> > <capability name="org.apache.felix.log" startlevel="1"/> > <capability name="org.jboss.osgi.logging" startlevel="1"/> > <capability name="org.apache.felix.configadmin" startlevel="1"/> > <capability name="org.jboss.as.osgi.configadmin" startlevel="1"/> > </capabilities> > </subsystem> 288c221 < <connector name="remoting-connector" socket-binding="remoting"/> --- > <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/> 296c229,237 < <login-module code="UsersRoles" flag="required"/> --- > <login-module code="Remoting" flag="optional"> > <module-option name="password-stacking" value="useFirstPass"/> > </login-module> > <login-module code="RealmUsersRoles" flag="required"> > <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/> > <module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/> > <module-option name="realm" value="ApplicationRealm"/> > <module-option name="password-stacking" value="useFirstPass"/> > </login-module> 323c264 < <virtual-server name="default-host" enable-welcome-root="false"> --- > <virtual-server name="default-host" enable-welcome-root="true"> 324a266 > <alias name="example.com"/> 326a269,278 > <subsystem xmlns="urn:jboss:domain:webservices:1.1"> > <modify-wsdl-address>true</modify-wsdl-address> > <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host> > <endpoint-config name="Standard-Endpoint-Config"/> > <endpoint-config name="Recording-Endpoint-Config"> > <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM"> > <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/> > </pre-handler-chain> > </endpoint-config> > </subsystem> 332c284 < <loopback-address value="${env.OPENSHIFT_INTERNAL_IP}"/> --- > <inet-address value="${jboss.bind.address.management:127.0.0.1}"/> 335c287 < <loopback-address value="${env.OPENSHIFT_INTERNAL_IP}"/> --- > <inet-address value="${jboss.bind.address:127.0.0.1}"/> 342,344c294,297 < <socket-binding name="jgroups-tcp" port="7600"/> < <!--socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/> < <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/--> --- > <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/> > <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/> > <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/> > <socket-binding name="osgi-http" interface="management" port="8090"/>
-
jboss-as7-modules.zip 1,008.0 KB
-
bin.zip 3.7 KB
Comments