14.1.13

Deploying YouTrack on OpenShift for free

How to install YouTrack on Red Hat's OpenShift PaaS service for free

YouTrack is a great issue tracker by JetBrains. Even though the software is proprietary, they allow you to install YouTrack Stand-Alone on your own servers as long as you have at most 10 users.

I attempted to follow this guide to install YouTrack on OpenShift, but it turned out to be trickier than I expected, as I ran into a mysterious bug related to socket binding in OpenShift servers.

So I came up with an easier alternative installation method. It consists in running the YouTrack jar through the JVM without using the Java Service Wrapper by Tanuki Software. The solution is simple and should allow you to have YouTrack up in a few minutes.


1. Sign up for a OpenShift free account and make a DIY app. You can follow the Code Nibbles guide up until section "The repository".


2. Download YouTrack's jar (for Linux) here, should be name youtrack-5.0.1.jar.


3. Place the jar in your local repository, for instance in the root directory of the repo.


4. SSH to your app's server in OpenShift. Type in
~/myrepo$printenv OPENSHIFT_DIY_IP
to discover the IP address that YouTrack should use. Execute also
~/myrepo$printenv OPENSHIFT_DIY_PORT
for the same purpose. Remember these two values, and log out from SSH.


5. Extract or open the YouTrack jar so that we can modify some files in it.


6. Edit the following XML file jetbrains/mps/webr/standalone/runtime/standalone.xml:

...
   **the internal IP address** 
   **the internal port** 
  180000
...



7. Compress all the files that were in the jar. Make sure that the directories structure is preserved. If you don't know what you're doing, I recommend doing steps 5-7 by simply opening the jar file in a common compression tool like 7zip and modifying the files through it, without extracting the jar.


8. Go to directory .openshift/action_hooks in the repository. Set the contents of files start and stop as follows:
start
#!/bin/bash
nohup /usr/lib/jvm/java-1.7.0/bin/java -Xmx512m -Djetty.home=$OPENSHIFT_DATA_DIR -Ddatabase.location=${OPENSHIFT_DATA_DIR}teamsysdata -Djava.awt.headless=true -jar ${OPENSHIFT_REPO_DIR}youtrack-5.0.1.jar ${OPENSHIFT_DIY_PORT} &

stop
#!/bin/bash
APP_PID=`ps aux | grep -v grep | grep java | awk '{print $2}'`
kill -9 $APP_PID > /dev/null 2>&1
exit 0


9. Commit and push the repo to OpenShift:

$git add .openshift/action_hooks/start
$git add .openshift/action_hooks/stop
$git add youtrack-5.0.1.jar
$git commit -m "Deploying youtrack"
$git push



10. When the upload is completed, OpenShift will automatically launch the start script, which means YouTrack is starting up. It takes a while for the initialization to happen, like 2-5 minutes. Grab a cup of coffee and come back to launch your YouTrack installation at the address http://yourapp-yournamespace.rhcloud.com . You should see YouTrack in your browser.

Let me know if this works for you, and I appreciate also improvement suggestions to this method. Enjoy. :)