How to create a service for Fisheye/Crucible in Linux
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
If a service that starts Fisheye/Crucible is needed on a Linux machine, this resource should help. These steps were tested using Fisheye 4.8.
Solution
RHEL 8 & Ubuntu
- Install Fisheye / Crucible as discussed in our documentation: Installing Fisheye on Linux and Mac
- Create a non-root user named crucible
Create a service and add the following to the service file (in testing the file was located at
/lib/systemd/system/crucible.service
)[Unit] After=syslog.target network.target [Service] Type=forking User=crucible ExecStart=/bin/bash /absolute/path/to/fecru-<version>/bin/start.sh ExecStop=/bin/bash /absolute/path/to/fecru-<version>/bin/stop.sh Environment=FISHEYE_INST=/absolute/path/to/fisheye_inst [Install] WantedBy=multi-user.target
Notes:
*
* the service will be run by root but as the crucible user so that file's in/absolute/path/to/fecru-<version>
should be changed to the actual path
*/absolute/path/to/fisheye_inst
should be changed to the actual pathFISHEYE_INST
andFISHEYE_INSTALLATION
are not owned by root
* Remember thatFISHEYE_INST
is an environment variable that points to the directory used by the Fisheye / Crucible for storing data such as log files, repository caches and configuration file.The service can now be used to start Fisheye / Crucible. In the test running the command
service crucible start
was successful.- After running
systemctl enable crucible
the service should start at boot
Note
If you add, remove or update components within the crucible.service
file, make sure to reload the systemd daemon to ensure that the changes have been picked up.
systemctl daemon-reload
Amazon Linux
- Install Fisheye / Crucible as discussed in our documentation: Installing Fisheye on Linux and Mac
Create a file in
/etc/init.d
(in testing the file was located at/etc/init.d/crucible
):#!/bin/sh ### BEGIN INIT INFO # Provides: fisheye # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Initscript for Atlassian fisheye Server # Description: Automatically start Atlassian fisheye Server when the system starts up. # Provide commands for manually starting and stopping fisheye Server. ### END INIT INFO # Adapt the following lines to your configuration # RUNUSER: The user to run fisheye Server as. RUNUSER=crucible # FISHEYE_INST: The path where the data itself will be stored. FISHEYE_INST="/data/atlassian/fisheye-home" # FISHEYE_HOME: The path to the FishEye & Crucible installation. FISHEYE_HOME="/data/atlassian/fecru-4.8.11" fisheyectl() { if [ "x$USER" != "x$RUNUSER" ]; then # If running without FISHEYE_INST # su - "$RUN_AS" -c "$FISHEYE_HOME/bin/fisheyectl.sh $1" su - "$RUNUSER" -c "export JAVA_HOME=/usr/lib/jvm/adoptopenjdk-8-hotspot; FISHEYE_INST=$FISHEYE_INST $FISHEYE_HOME/bin/fisheyectl.sh $1" else "$FISHEYE_HOME/bin/fisheyectl.sh $1" fi } case "$1" in start) fisheyectl start ;; stop) fisheyectl stop ;; restart) fisheyectl stop sleep 10 fisheyectl start ;; *) echo "Usage: $0 {start|stop|restart}" esac exit 0
Edit the values of the following to match your environment.
- RUNUSER
- JAVA_HOME
- FISHEYE_INST
- FISHEYE_HOME
Use
chkconfig
to add & enable:chkconfig --add crucible && chkconfig --level 2345 crucible on
Use
chkconfig
to check the script (the run levels 2-5 should be on as that is what we specified in the script):chkconfig --list | grep crucible
Confirm the
crucible
file has the right permissions and is executable (it should have the same privilege as other service scripts in/etc/init.d/
)Fisheye / Crucible can now be started using the service:
service crucible start service crucible stop service crucible restart