NGINX Unit

Jira§

To run Atlassian Jira in Unit, follow these steps.

Note

Command samples below assume you’re using Jira Core 7.13.0.

  1. Install Unit with Java support.

  2. Create an installation directory, adding a lib subdirectory to download third-party dependencies:

    $ cd /path/to/jira
    $ mkdir -p lib
    $ cd lib
    $ curl http://central.maven.org/maven2/com/atomikos/atomikos-util/3.9.1/atomikos-util-3.9.1.jar -O -C -
    $ curl http://central.maven.org/maven2/org/eclipse/jetty/jetty-jndi/9.4.12.v20180830/jetty-jndi-9.4.12.v20180830.jar -O -C -
    $ curl http://central.maven.org/maven2/org/eclipse/jetty/jetty-plus/9.4.12.v20180830/jetty-plus-9.4.12.v20180830.jar -O -C -
    $ curl http://central.maven.org/maven2/org/eclipse/jetty/jetty-util/9.4.12.v20180830/jetty-util-9.4.12.v20180830.jar -O -C -
    $ curl http://central.maven.org/maven2/javax/transaction/jta/1.1/jta-1.1.jar -O -C -
    $ curl http://central.maven.org/maven2/com/atomikos/transactions/3.9.1/transactions-3.9.1.jar -O -C -
    $ curl http://central.maven.org/maven2/com/atomikos/transactions-api/3.9.1/transactions-api-3.9.1.jar -O -C -
    $ curl http://central.maven.org/maven2/com/atomikos/transactions-jdbc/3.9.1/transactions-jdbc-3.9.1.jar -O -C -
    $ curl http://central.maven.org/maven2/com/atomikos/transactions-jta/3.9.1/transactions-jta-3.9.1.jar -O -C -
    $ curl https://github.com/mar0x/unit-transaction-init/releases/download/1.0/transaction-init-1.0.jar -O -C - -L
    
  3. Download and extract Jira files:

    $ cd /path/to/jira
    $ tar xzf atlassian-jira-core-7.13.0.tar.gz
    
  4. Patch your Jira configuration, dropping env from the comp/env/UserTransaction object path. This ensures the UserTransaction object will be found by your installation:

    $ sed -i 's#comp/env/UserTransaction#comp/UserTransaction#g' \
          atlassian-jira-core-7.13.0-standalone/atlassian-jira/WEB-INF/classes/entityengine.xml
    
  5. Prepare Unit configuration for your update. To obtain an initial template, query the control API:

    # curl --unix-socket /path/to/control.unit.sock \
           http://localhost/config/ > config.json
    

    Note

    Control socket path may vary; run unitd --help or see Startup for details.

    This creates a JSON file with Unit’s current settings. Add a listener in listeners and point it to your installation directory in applications. Also, add the following options and dependencies:

    {
        "listeners": {
            "*:8080": {
                "pass": "applications/jira"
            }
        },
    
        "applications": {
            "jira": {
                "working_directory": "/path/to/jira/",
                "processes": 1,
                "type": "java",
                "webapp": "atlassian-jira-core-7.13.0-standalone/atlassian-jira",
                "options": [
                    "-Djava.awt.headless=true",
                    "-Djavax.accessibility.assistive_technologies= ",
                    "-Djira.home=/path/to/jira/home",
                    "-Dnginx.unit.context.listener=nginx.unit.TransactionInit",
                    "-Xms1024m",
                    "-Xmx1024m"
                ],
                "classpath": [
                    "lib/transaction-init-1.0.jar",
                    "lib/atomikos-util-3.9.1.jar",
                    "lib/jta-1.1.jar",
                    "lib/transactions-3.9.1.jar",
                    "lib/transactions-api-3.9.1.jar",
                    "lib/transactions-jdbc-3.9.1.jar",
                    "lib/transactions-jta-3.9.1.jar",
                    "lib/jetty-jndi-9.4.12.v20180830.jar",
                    "lib/jetty-util-9.4.12.v20180830.jar",
                    "lib/jetty-plus-9.4.12.v20180830.jar",
                    "atlassian-jira-core-7.13.0-standalone/lib/hsqldb-1.8.0.5.jar",
                    "atlassian-jira-core-7.13.0-standalone/lib/slf4j-api-1.7.9.jar",
                    "atlassian-jira-core-7.13.0-standalone/lib/slf4j-log4j12-1.7.9.jar",
                    "atlassian-jira-core-7.13.0-standalone/lib/log4j-1.2.16.jar",
                    "atlassian-jira-core-7.13.0-standalone/lib/jcl-over-slf4j-1.7.9.jar"
                 ]
             }
         }
     }
    

    See Java application options for details.

    Note

    You can’t update Jira configuration in Unit after application startup due to Jira’s own restrictions.

  6. Upload the updated configuration:

    # curl -X PUT --data-binary @config.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config
    

    After a successful update, Jira should be available on the listener’s IP address and port. Navigate to Jira’s URI path (http://IP address:port/jira) to continue the setup in your browser:

    Jira in Unit - Setup Screen