Run Synchrony-standalone as a service on Linux

Still need help?

The Atlassian Community is here for you.

Ask the community

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

This guide applies to Confluence Data Center 6.5 and later. See Run Synchrony-standalone as a service on Linux for Confluence 6.4 and earlier if you're using an earlier version of Data Center. This guide does not apply if Synchrony is managed by Confluence.

Purpose

This article will guide you through how to run Synchrony as a service on a standalone node or cluster in Linux, for use with Confluence Data Center 6.5 or later. 

Prerequisites

You should already have one Confluence Data Center node set up (see Installing Confluence Data Center), and are working through the steps to Set up a Synchrony cluster

We also assume you already have the latest Java Development Kit (JDK) version installed.

How to check

You must be using one of the supported JDK versions, as seen on the Supported Platforms page.  To check your current Java version:

which java
java -version

If it's not already installed, you can successfully install it by following the steps outlined in the Installing Java for Confluence guide.

Once installed, run the java -version command again to confirm your version.

Solution

How to run Synchrony as a service on a standalone node

In Linux, the best practice is to install, configure and run each service (including Synchrony) as a dedicated user with only the permissions they require.

To run Synchrony automatically on Linux, follow the steps below.  These steps are for Ubuntu 16, so you may need to adjust the syntax of these commands if you're using RHEL or another Linux distribution.  

  1. Create a synchrony user to run Synchrony, using the following command running as root (not using sudo):

    addgroup --gid 1234 synchrony && useradd -m -s /bin/bash -u 1234 -g 1234 synchrony;
  2. Set a password for your synchrony user:

    sudo passwd synchrony

    (warning) Please note that Synchrony will fail to start if the OS synchrony user does not have a password set.

  3. Create your Synchrony home directory. This is where we'll run Synchrony from, and write logs to.  

    sudo mkdir -p /opt/atlassian/synchrony
    
  4. Copy the following files and directories from your Confluence node to your Synchrony home directory:

    • <local-home>/synchrony-standalone.jar
    • <install-directory>/bin/synchrony
    • your database driver from <install-directory>/confluence/WEB-INF/lib (for example postgresql-9.4.1212.jar)
    • for convienience you may also want to copy over your <local-home>/confluence.cfg.xml file, as this contains some of the details you'll need to enter later. 
       
  5. Your Synchrony home directory should now contain the following files:

    • synchrony-standalone.jar
    • start-synchrony.sh
    • stop-synchrony.sh
    • install_synchrony_service.sh
    • your database driver, for example postgresql-9.4.1212.jar
       
  6. Give your synchrony user proper permissions on the directory and files: 

    sudo chown -R synchrony:synchrony /opt/atlassian/synchrony
    
  7. Open start-synchrony.sh in your favourite text editor and enter details for your environment. See Configuring Synchrony for details of each parameter. 
     

  8. We recommend you use an environment variable for your database password. To do this, change to the synchrony user, create a file, for example synchronyenv and make it executable as follows:

    sudo su - synchrony
    touch synchronyenv
    chmod a+x synchronyenv
  9. Edit the file to add the environment variables for your database username and password as follows:

    export SYNCHRONY_DATABASE_USERNAME="your username"
    export SYNCHRONY_DATABASE_PASSWORD="your password"
  10. In your start-synchrony.sh script, uncomment the environment variables section, and provide the path to your environment file. 

    SYNCHRONY_ENV_FILE="<PATH_TO_ENV_FILE>"
  11. As your Synchrony user, run the install_synchrony_service.sh file to install the service: 

    sudo ./install_synchrony_service.sh
  12. To start, stop or restart the service, use:

    service synchrony start
    service synchrony stop
    service synchrony restart
  13. To confirm the synchrony service is running use: 

    service synchrony status
  14. You're now ready to start Confluence and check it can connect to Synchrony. Continue with the installation instructions in Installing Confluence Data Center

Synchrony logs not updated when running as a service

If you setup Synchrony standalone to run as a Linux service and the application log (atlassian-synchrony.log) is either missing or not being updated, then check the following procedure.

  1. Edit the Synchrony service definition and add the following configuration under the [Service] structure.

    WorkingDirectory=<path to Synchrony home>
  2. Reload the Synchrony service configuration.
  3. Restart the Synchrony service.

Running Synchrony using start and stop scripts

If you're using Confluence 6.5 or later, we provide scripts to help you start and stop Synchrony. See Configuring Synchrony to find out how to configure these scripts for your environment. 

If you're using an earlier Confluence version, you can create your own start and stop scripts - see Run Synchrony-standalone as a service on Linux for Confluence 6.4 and earlier


DescriptionThis article will guide you through how to run Synchrony as a service on a standalone node or cluster in Linux, for use with Confluence Data Center 6.5 or later. 
ProductConfluence
PlatformData Center
Last modified on Aug 26, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.