Create systemd services for Atlassian Apps

While working with the Atlassian products over the years, a pattern emerges. Even though there are distinct differences in their setup and configurations, the installation process can be generalized. One of the post-installation considerations to make is in the manual creation of a service.  The benefit of a service is that it will automate the running of the application, rather than manual intervention. Earlier versions of CentOS 6.x and below would rely on a service created in /etc/init.d/servicename.  In CentOS 7.x, this is still possible, but it would be more beneficial in the long term to write systemd scripts. By the way, this process is not limited to Atlassian applications.  This directly applies to many Tomcat installations as well as many other applications.

I'm not going to display all of the services, just a couple.  They can easily be tailored to the other applications.

Atlassian JIRA

cat > /usr/lib/systemd/system/jira.service << EOF
[Unit]
Description=Starts and stops Atlassian JIRA Server
After=syslog.target network.target
  
[Service]
User=jira
Group=jira
Type=forking
ExecStart=/opt/jira/bin/catalina.sh start
Restart=on-failure
RestartSec=10
  
[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable jira

Atlassian Fisheye

The difference between this service and the one above is the addition of the Environment directives to handle the FISHEYE_HOME and FISHEYE_INST variables.  This is easier to do than hack up the the Fisheye installation.

cat > /usr/lib/systemd/system/fisheye.service << EOF
[Unit]
Description=Starts and stops Atlassian Fisheye Server
After=syslog.target network.target

[Service]
User=fisheye
Group=fisheye
Environment='FISHEYE_HOME=/opt/fisheye'
Environment='FISHEYE_INST=/opt/data/fisheye'
Type=forking
ExecStart=/opt/fisheye/bin/fisheyectl.sh start
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl enable fisheye

 

 

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *