Have FishEye+Crucible start at boot on Ubuntu

cruciblefisheyeinit.djira

I asked this question at Atlassian but figured serverfault might be more appropriate as it's more of a sysadmin question than an Atlassian question:

I have been attempting to follow this guide to have FishEye+Crucible start at boot. JIRA is already installed and running as it's own user (jira) on Ubuntu at boot, but I cannot get Fisheye+Crucible (aka fecru) to do the same.

I followed the instructions there (and Ubuntu related note in the comments of the page) and rebooted, JIRA started on it's own as usual but fecru did not. Does it have something to do with the RUN_AS variable, which I set to 'jira'? Will that command run at boot without prompting for a password for the user 'jira'? I figured it would not prompt because the program JIRA starts at boot fine as that user…

Using:

Ubuntu 10.04 Lucid

Jira 5.0

Crucible+Fisheye 2.7.11

Best Answer

As this question popped up again and the answers are now outdated since the switch to systemd by the major distributions I'll add my systemd service definition for JIRA:

/etc/systemd/system/jira.service

[Unit]
Description=Atlassian JIRA
After=syslog.target network.target

[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/jira
ExecStart=/path/to/jira/bin/startup.sh
ExecStop=/path/to/jira/bin/shutdown.sh
PIDFile=/path/to/jira/work/catalina.pid
SuccessExitStatus=143
User=jira
Group=jira
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

/etc/sysconfig/jira

# Name of the user to run as
USER=jira
# Location of application's bin directory
CATALINA_HOME=/path/to/jira
# Location of Java JDK
export JAVA_HOME=/usr/lib/jvm/java-8-oracle

Replace /path/to/jira with your application directory.

For the other Atlassian tools it's basically the same, just the startup scripts and the PID file location differ slightly:

  • Confluence

    • $appdir/bin/startup.sh
    • $appdir/bin/shutdown.sh
    • $appdir/work/catalina.pid
  • FishEye

    • $appdir/bin/start.sh
    • $appdir/bin/stop.sh
  • Bamboo

    • $appdir/bin/start-bamboo.sh
    • $appdir/bin/stop-bamboo.sh
  • Crowd

    • $appdir/bin/startup.sh
    • $appdir/bin/shutdown.sh
    • $appdir/apache-tomcat/work/catalina.pid

FishEye doesn't have support for a PID file yet, so currently it is necessary to use the workaround from that issue and add this line to fisheyectl.sh after the nohop command:

echo $! > $FISHEYE_INST/var/fisheye.pid

For Bamboo the PID file has to be explicitly defined via the CATALINA_PID variable (see $appdir/bin/catalina.sh). I haven't tested it yet, but it should be possible to set this variable in the EnvironmentFile file.

After the service definitions are created:

# start JIRA
sudo systemctl start jira
# enable automatic start on boot
sudo systemctl enable jira
Related Topic