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. :)

8 comments:

  1. Good helpful blog. The file jetbrains/mps/webr/standalone/runtime/standalone-std.xml is missing in version 4.2.1

    ReplyDelete
    Replies
    1. Thanks! I should update the blog (and also my running YouTrack) to 4.2.1. Have you tested whether my method still works for 4.2.1?

      Delete
    2. Yes, the file standalone-std.xml is missing in 4.2.1 but the method described above still works.
      Many thanks for this tutorial.

      Delete
  2. It also works flawlessly with 4.2.2. Thanks!

    ReplyDelete
  3. It works great also with YouTrack 4.2.4. Thanks for the tutorial! Very straightforward. I had a few problems at first with the start script (note that it is all ONE LINE)

    ALSO, you should all know that Openshift changed all OPENSHIFT_INTERNAL_[whatever] variables to OPENSHIFT_[cartridge-name]_[whatever], which means you should use OPENSHIFT_DIY_IP & OPENSHIFT_DIY_PORT.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Didn't work for youtrack-5.2.2-8792.jar. I tried force stop and restart app but still get error
    Apache/2.2.15 (Red Hat) Server at ....rhcloud.com Port 80

    ReplyDelete