Last updated Sep 28, 2021

Configuring a Jira cluster in AMPS

Configuring a Jira cluster in AMPS involves three main steps:

Setting up an external database

Whereas non-Data Center products can run with an embedded H2 or HSQL database, Data Center products require an external database to which all nodes connect. As an AMPS or SDK user, it is up to you to provision that database. See Setting up an external database for more details.

Preparing the home directory

To explain how to configure the home directory for clustered mode, we first need to review how the home directory works in non-clustered mode.

Non-clustered mode

In non-clustered mode, each product by default uses a pre-prepared home directory in which the configuration files specify an embedded H2 or HSQL database. These home directories are shipped as Maven artifacts, with the same version as the product release to which they relate. For example, when running Confluence 7.12.3, AMPS uses version 7.12.3 of the Maven artifact com.atlassian.confluence.plugins:confluence-plugin-test-resources:zip. If we unzip this artifact, we see that it’s a Confluence home directory:

1
2
.
└── confluence-home
├── attachments
├── confluence.cfg.xml
├── database
├── index
└── synchrony-args.properties

If we then open the main configuration file confluence.cfg.xml, we see that Confluence is configured to use an H2 database:

1
2
<?xml version="1.0" encoding="UTF-8"?>
<confluence-configuration>
  <setupStep>complete</setupStep>
  <setupType>install</setupType>
  <buildNumber>8703</buildNumber>
  <properties>
    <property name="hibernate.connection.driver_class">org.h2.Driver</property>
    <property name="hibernate.connection.isolation">2</property>
    <property name="hibernate.connection.password"></property>
    <property name="hibernate.connection.username">sa</property>
    <property name="hibernate.dialect">com.atlassian.confluence.impl.hibernate.dialect.H2V4200Dialect</property>
    ...
  </properties>
</confluence-configuration>

Because this H2 database runs in the same JVM as Confluence, it’s unsuitable for clustered mode.

Clustered mode

In clustered mode, the product requires an external database. You achieve this by providing your own home ZIP (instead of the default one described above), in which the database configuration file (in this example, confluence.cfg.xml) contains the details of that external database:

1
2
<?xml version="1.0" encoding="UTF-8"?>
<confluence-configuration>
  <setupStep>complete</setupStep>
  <setupType>cluster</setupType>
  <buildNumber>8703</buildNumber>
  <properties>
    <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
    <property name="hibernate.connection.password">theProductPassword</property>
    <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/confdb</property>
    <property name="hibernate.connection.username">theProductUser</property>
    <property name="hibernate.dialect">com.atlassian.confluence.impl.hibernate.dialect.PostgreSQLDialect</property>
    <property name="hibernate.setup">true</property>
    ...
  </properties>
</confluence-configuration>

The easiest and most reliable way to generate such a home ZIP (for any product) is as follows:

  1. Open a terminal within your plugin project.
  2. Start the product as normal, then shut it down, to populate the target/home directory.
  3. Make the product run in setup mode, as follows:
    • Bitbucket: clear out the home directory
    • Confluence: move or rename home/confluence.cfg.xml
    • Crowd: move or rename home/crowd.cfg.xml
    • Jira: move or rename home/dbconfig.xml
  4. Start the product as normal, for example using atlas-run, mvn amps:run, or mvn jira:run. For Bitbucket, run mvn amps:run -Datlassian.dev.mode=false to prevent skipping the setup.
  5. Point your browser to the product’s base URL; the product should open in setup mode.
  6. Manually step through the setup wizard in your browser. Note:
    • You do not need to set up for clustered mode. AMPS does this for you later.
    • When you arrive at the page about the database connection, enter the details of your external database.
  7. Once setup is complete, shut down the product. Important: do not clean it.
  8. Still within your plugin project directory, create a home ZIP via either:
    • the plugin SDK, using the atlas-create-home-zip command, or
    • AMPS directly, using mvn <product>:create-home-zip or mvn amps:create-home-zip, depending on which AMPS plugin is configured in your POM.

Once you have your home ZIP:

  1. Move the home ZIP to the version-controlled part of your plugin project; a separate directory in the root called home-zips is a good place, as it avoids the home ZIP being bundled into either your production plugin or your test plugin, if you have one.

  2. Rename the home ZIP from generated-test-resources.zip to something more descriptive, such as postgres-home.zip.

  3. Configure AMPS to load your custom home ZIP instead of the default one, by setting <productDataPath>, either globally, as below, or within the relevant <product> element:

    1
    2
    <configuration>
        <productDataPath>${basedir}/home-zips/postgres-home.zip</productDataPath>
        ...
    

Configuring your POM

To configure your POM, you must do the following:

  • Configure the nodes.
  • Configure the license.

Configuring the nodes

You configure the nodes by adding them to your AMPS configuration. See Configuring the nodes for more details.

Configuring the license

Licenses work differently in Jira than in other products, because Jira has the concept of applications. Jira supports the following applications:

  • Jira Core
  • Jira Service Management (previously Jira Service Desk)
  • Jira Software

All of these applications can be licensed via a single license.

Licensing an application is not the same as installing an application; either can be done without the other. To install an application via AMPS, see Configure AMPS to run JIRA Core with additional applications installed.

To run in a cluster, Atlassian products require a Data Center license. If the default license provided by AMPS is not a Data Center license, or does not suit your purposes for some other reason, AMPS 8.2 and later allows you to replace the default license with one you provide, such as one obtained from My Atlassian or developer.atlassian.com.

To do this, add the desired license to your AMPS configuration, either at the global level, the <product> level, or both:

Global level

1
2
<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>amps-maven-plugin</artifactId>
    <version>8.3.0</version>
    <extensions>true</extensions>
    <configuration>
        <productLicense>
            loremipsumdolorsitametconsecteturadipiscingelitseddoeius
            modtemporincididuntutlaboreetdoloremagnaaliquautenimadmi
            nimveniamquisnostrudexercitationullamcolaborisnisiutaliq
            uipexeacommodoconsequatduisauteiruredolorinreprehenderit
        </productLicense>
        ...
    </configuration>

Product level

1
2
<plugin>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>amps-maven-plugin</artifactId>
    <version>8.3.0</version>
    <extensions>true</extensions>
    <configuration>
        <products>
            <product>
                <license>
                    loremipsumdolorsitametconsecteturadipiscingelitseddoeius
                    modtemporincididuntutlaboreetdoloremagnaaliquautenimadmi
                    nimveniamquisnostrudexercitationullamcolaborisnisiutaliq
                    uipexeacommodoconsequatduisauteiruredolorinreprehenderit
                </license>
                ...
            </product>
        </products>
        ...
    </configuration>

Whitespace characters are allowed in the license; the product ignores such characters at runtime.

If you intend to commit a license to version control, it’s best to use a non-perpetual “timebombed” license. That is, one that expires a certain number of hours or days after the product starts up.

Other settings

Cluster properties file

AMPS will create the required cluster.properties file in each node’s home directory, with the following properties:

PropertyValue
jira.node.idnode0, node1, etc.
jira.shared.homeThe shared home directory, see below.
ehcache.listener.portA random free port
ehcache.object.portA random free port

Home directories

  • The local home of node 0 is at target/jira/home, as for single-node operation.
  • The local homes of the other nodes are at target/jira/home-n, where n is 1, etc.
  • The shared home of the cluster is set as follows:
    • If the <product> contains a <sharedHome>, AMPS uses that, otherwise
    • AMPS uses target/jira/shared-home as the shared home directory.

Rate this page: