<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=299788&amp;fmt=gif">
Skip to content

If you want to run your own Synchrony cluster for Confluence Data Center or you are running in a version that does not provide the "Managed by Confluence" option and still automating the creation / spin up process.

Here is a quick bash script you can execute to populate the start-synchrony.sh script:

### Comment out below if Synchrony will be managed by Confluence
GET_IP=$(ifconfig ${NET_IF} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '')
sed -i "s%^SERVER_IP=.*%SERVER_IP=${GET_IP}%" /bin/synchrony/start-synchrony.sh
GET_DB_URL=$(echo 'cat //confluence-configuration/properties/property[@name="hibernate.connection.url"]' | xmllint --shell /confluence.cfg.xml | sed -e 's/<[^>]*>//g' | tail -2 | head -1)
sed -i "s%^DATABASE_URL=.*%DATABASE_URL=${GET_DB_URL}%" /bin/synchrony/start-synchrony.sh
GET_DB_USER=$(echo 'cat //confluence-configuration/properties/property[@name="hibernate.connection.username"]' | xmllint --shell /confluence.cfg.xml | sed -e 's/<[^>]*>//g' | tail -2 | head -1)
sed -i "s%^DATABASE_USER=.*%DATABASE_USER=${GET_DB_USER}%" /bin/synchrony/start-synchrony.sh
GET_DB_PASS=$(echo 'cat //confluence-configuration/properties/property[@name="hibernate.connection.password"]' | xmllint --shell /confluence.cfg.xml | sed -e 's/<[^>]*>//g' | tail -2 | head -1)
sed -i "s%^DATABASE_PASSWORD=.*%DATABASE_PASSWORD=${GET_DB_PASS}%" /bin/synchrony/start-synchrony.sh
GET_AWS_TAG_KEY=$(echo 'cat //confluence-configuration/properties/property[@name="confluence.cluster.aws.tag.key"]' | xmllint --shell /confluence.cfg.xml | sed -e 's/<[^>]*>//g' | tail -2 | head -1)
GET_AWS_TAG_VALUE=$(echo 'cat //confluence-configuration/properties/property[@name="confluence.cluster.aws.tag.value"]' | xmllint --shell /confluence.cfg.xml | sed -e 's/<[^>]*>//g' | tail -2 | head -1)
sed -i "/^# # Uncomment this section if you want to do node discovery in AWS/a CLUSTER_JOIN_PROPERTIES=\"-Dcluster.join.type=aws -Dcluster.join.aws.tag.key=${GET_AWS_TAG_KEY} -Dcluster.join.aws.tag.value=${GET_AWS_TAG_VALUE}\"" /bin/synchrony/start-synchrony.sh
GET_DB_JAR_PATH=$(find / -name postgresql*.jar)
sed -i "s%^DATABASE_DRIVER_PATH=.*%DATABASE_DRIVER_PATH=${GET_DB_JAR_PATH}%" /bin/synchrony/start-synchrony.sh
GET_SYNCHRONY_JAR_PATH=$(find / -name synchrony-standalone.jar)
sed -i "s%^SYNCHRONY_JAR_PATH=.*%SYNCHRONY_JAR_PATH=${GET_SYNCHRONY_JAR_PATH}%" /bin/synchrony/start-synchrony.sh
GET_BASE_URL=$(echo 'cat ///Server/Service/Connector[@port="8090"]/@proxyName' | xmllint --shell /conf/server.xml | sed -e 's/<[^>]*>//g' | tail -2 | head -1 | cut -d'"' -f2)
GET_BASE_URL_SCHEME=$(echo 'cat ///Server/Service/Connector[@port="8090"]/@scheme' | xmllint --shell /conf/server.xml | sed -e 's/<[^>]*>//g' | tail -2 | head -1 | cut -d'"' -f2)
sed -i "s%^SYNCHRONY_URL=.*%SYNCHRONY_URL=${GET_BASE_URL_SCHEME}://${GET_BASE_URL}%" /bin/synchrony/start-synchrony.sh

This script will pull all the relative details from either the confluence.cfg.xml file or the server.xml file.

You may notice that to pull the xml details with xmllint that I chose not to use the xpath option. In many implementations, xpath is not supported in the standard installation. Because of this we use --shell option with the path string passed in. For more details on the path string check out: https://www.w3schools.com/xml/xpath_intro.asp.

Happy Collaborating!

Managing JIRA at Scale White Paper

See More From These Topics