Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

JBoss Setup

Alex Eng edited this page Mar 25, 2015 · 10 revisions

WARNING

The supported app servers are currently WildFly 8.1.0.Final and EAP 6.3. AS 7 is no longer supported.

Warning: This page is somewhat out of date. Please see Working-With-Maven or ask on the zanata-devel mailing list.

JBoss EAP 6.3

You can download JBoss EAP 6.3 to use with Zanata. Extract the archive. This location will be known as JBOSS_HOME for here on. You can start JBoss by typing the following on your command line.

$ cd $JBOSS_HOME
$ ./bin/standalone.sh

For developers on Red Hat Enterprise Linux, you can install JBoss EAP 6.3 by typing the following command on the terminal:

$ yum -y groupinstall "jboss-eap6"
# or:
$ yum -y install jbossas-standalone

This way of installing will place JBoss files under

  • /usr/share/jbossas (JBOSS_HOME)
  • /etc/jbossas
  • /var/lib/jbossas (shortcuts in /usr/share/jbossas)

You can start JBoss EAP by typing the following command on a terminal:

$ service jbossas start

Preparation:

Add JNDI entries for zanata in standalone.xml

Search subsystem xmlns="urn:jboss:domain:naming:1.3" and add bindings as following. Adjust the paths/emails accordingly.

<subsystem xmlns="urn:jboss:domain:naming:1.3">
    <bindings>
        <simple name="java:global/zanata/security/auth-policy-names/internal" value="zanata.internal"/>
        <simple name="java:global/zanata/security/admin-users" value="admin"/>
        <simple name="java:global/zanata/files/document-storage-directory" value="/example/path"/>
        <simple name="java:global/zanata/email/default-from-address" value="[email protected]"/>
    </bindings>
    <remote-naming/>
</subsystem>

Optional entries that can be defined in JNDI please refer to source org.zanata.config.JndiBackedConfig.

Install MySQL driver

$ sudo yum install mysql-connector-java
$ cd $JBOSS_HOME
$ ln -s /usr/share/java/mysql-connector-java.jar standalone/deployments/

Create a datasource for Zanata:

Create the file $JBOSS_HOME/standalone/deployments/zanata-ds.xml (modify to suit):

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd -->
    <!--
    Using this datasource:
    1. create a jboss module for mysql-connector and activate it using jboss-cli.sh
    2. save this datasource as JBOSS_HOME/standalone/deployments/zanata-ds.xml
    See http://jaitechwriteups.blogspot.com/2012/02/jboss-as-710final-thunder-released-java.html
    -->
    <datasources>
      <datasource jndi-name="java:jboss/datasources/zanataDatasource"
        enabled="true" use-java-context="true" pool-name="zanataDatasource">
        <connection-url>jdbc:mysql://localhost:3306/zanata?characterEncoding=UTF-8</connection-url>
        <driver>mysql-connector-java.jar</driver>
        <security>
           <user-name>root</user-name>
<!--
           <password></password>
-->
        </security>
      </datasource>
    </datasources>

Configure zanata properties in standalone.xml

$ $EDITOR standalone/configuration/standalone.xml
...
            <extensions>
...
            </extensions>
            <system-properties>
	         <property name="javamelody.storage-directory" value="${user.home}/stats"/>
    	         <property name="hibernate.search.default.indexBase" value="${user.home}/indexes"/>
            </system-properties>
...

These properties should be set to the location where Zanata will store system statistics, and search indexes respectively.

Configure security domain zanata in standalone.xml

Insert following under element <security-domains>:

<security-domains>
    ...
    <security-domain name="zanata">
        <authentication>
            <login-module code="org.zanata.security.ZanataCentralLoginModule" flag="required"/>
        </authentication>
    </security-domain>
    <security-domain name="zanata.openid">
        <authentication>
            <login-module code="org.zanata.security.OpenIdLoginModule" flag="required"/>
        </authentication>
    </security-domain>
    <security-domain name="zanata.internal">
        <authentication>
            <login-module code="org.jboss.seam.security.jaas.SeamLoginModule" flag="required"/>
        </authentication>
    </security-domain>
    ...
</security-domains>

If jboss is running, tell it to apply the change with:

$ ./jboss-cli.sh -c :reload

The code snippet above is specific to internal authentication.

Running Integration Tests

To run integration tests (mvn integration-test or mvn verify), a fresh instance of JBoss is required. Modify the arquillian.xml file in zanata-server. The jbossHome property should point to the location of this new JBoss instance. The integration tests will deploy all needed files, start and stop the instance. Alternatively, this property may be removed and the JBOSS_HOME environment variable may be used.

Building and deploying:

$ mvn clean install -DskipTests -Pnogwt
$ cp zanata-war/target/zanata-2.2-SNAPSHOT.war $JBOSS_HOME/standalone/deployments/zanata.war
- Start JBoss service. http://localhost:8080/zanata

Other things that might help

In bin/standalone.conf:

  • To increase memory for classes (and multiple redeployments), change -XX:MaxPermSize=256m to -XX:MaxPermSize=512m

  • To enable debugging, uncomment JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

  • To fix the JBoss EAP 6 problem where most of the logging is missing, add this line:

    JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.as.logging.per-deployment=false"

Clone this wiki locally