• Article
  • Sep.6.2018

Boost your Jira System Management with Systemd

  • Sep.6.2018
  • Reading time mins

Although the Jira installer of Atlassian provides a convenient way to get Jira up and running in no time. It is by far not the only way how to run Jira on a server.

Especially with systemd replacing init as the new System Manager on many Linux Distributions, we have been having requests by clients to install Jira or Confluence using systemd.

If you’ve also been wondering how to get Jira working with systemd or you’re just wondering what all that fuss is about, hang on and we’ll walk you through an installation of Jira, without using the installer, and show you how to set it up as a systemd service.

Why systemd?

systemd is a system and service manager for Linux. It has become standard on many Linux Distributions such as CentOS, Debian, Red Hat and Ubuntu. The main purpose of systemd is therefore to initialize the components that must be started after the Linux kernel is booted. But it is also used to manage services and daemons at any point while the system is running.

While the change from init to systemd is not welcomed by everyone, there are some important improvements which make the server administration easier. Some features of systemd are:

  • Parallel start-up of services
  • Listing all the child processes
  • Easy extensible start-up script
  • Dependency-based service control logic
  • Support for snapshotting and restoring

Compared to init, which used to be the standard Service Manager on essentially all Linux Systems beforehand, there is a faster boot-up time with systemd. This is because systemd is able to start multiple services asynchronously instead of the linear approach where one service gets started after another. The start-up scripts have also become easier to define and read, and it has become easier to check and debug the running services.

How it works

The tasks of systemd are organized as units. One commonly used unit is service, which can be recognized with the filename suffix “.service”. Take note – this will be used to define our Jira application later on in the tutorial.

Inside the systemd unit files are sections, and within these sections the directives are simply defined in key-value pairs. Here’s what a simplified Jira unit file could look like:

The first section is usually the [Unit] section, which is mainly used to configure the relationship of the unit to other units. The [unit] directives (which will also be used later on in this tutorial) are:

  • Description: Used to describe the basic functionality of the unit
  • After: Used to define which units have to be started before the current unit.

If the unit is the type service (as it is in this tutorial), the next section would be [Service] where you define everything specific to the service like:

  • Type: Defines the process behavior
  • User: Defines who runs the process
  • ExecStart: Path to the file to execute the process.

The last Section is [Install] which is optional and used to define how the unit should behave if its enabled or disabled.

The main command which is used to inspect and control the services is systemctl. Some examples are:

Showing the system status:

Starting an application:

Setting an application to start automatically on boot:

Checking the status of a services:

Installing Jira

In this tutorial we used CentOS7 as a base System and Jira version 7.11 . However, it would work similarly on RedHat Systems as well. Make sure to have JVM installed, and if you are using an external database check that it is supported. You can check which platforms support Jira.

This part of the installation is the standard procedure to install Jira manually using the tar.gz file. We are choosing the manual installation method, because if you run the installer it will put some scripts in etc/init.d and be managed with the init system.

First, you have to create a Jira user account which will be used to run Jira by running the following command on the server:

Then you will have to create the install directory where Jira will be installed, as well as the home directory which holds the application data. The install directory is usually inside /opt and the home directory is usually inside /var. The option -p is only used to create parent directories if necessary.

As the Jira user, download the tar.gz from the Atlassian website at https://www.atlassian.com/software/jira/download and extract it into /opt/atlassian/jira. Then create a symbolic link to the current installation of Jira. That way, only the link has to be changed when doing upgrades and the configuration files for systemd will stay the same.

Now you have to define in Jira where the home directory is located. This is the place where Jira stores the log files, back-ups and attachments. Add the following line to the file jira-application.properties which is located in {install dir}/atlassian-jira/WEB-INF/classes/ :

Of course if the home directory is not in /var you have to change the path accordingly.

Configuring the start-up options

At this point, depending on your server set-up, you have to do some additional changes to Jira’s start-up options and properties. The default memory parameters for the Jira Java virtual machine are generally too low for production environments. You might want to increase the minimum and maximum memory to at least 1024 megabytes by modifying the setenv.sh file located in {install dir}/bin/:

There are other parameters which can tweaked to get a better performance, but those will not be part of this article.

Create the start-up service

Now we finally come to the part which is specific to systemd. As seen at the beginning of this article, systemd reads unit files to manage the processes. Create the unit file jira.service in the following location /etc/systemd/system/. Put the following lines in that file:

Depending on your configuration, you want to make sure that some services are already running. If you have apache as a reverse proxy and use MySql to store the data, your [Unit] Section would look like this:

Now you have to reload the daemon and enable jira.service so that Jira starts automatically after a reboot:

Now everything is set. Just run the following command to start Jira:

And run the following to check if the service has started properly:

Hopefully you now should have the tools needed to do a fresh install of Jira managed by systemd. Of course, the chapter on systemd and Jira doesn’t end here; please let us know in the comments what your experience is with systemd or if you will stay with init for now.

Need more help?

If you need more help with installing and configuring Jira or any other Atlassian tool, reach out to us and we can provide an Atlassian certified consultant to assist you.

Contact Us

Related resources

View all resources