Installing JIRA 4 on a Synology Diskstation

Synjira

prerequisite tools:

  1. Java  Jira comes with it’s own JRE!
  2. bash
  3. Have MySQL active:

    Login on your synology
    Open the Control Panel
    Open WebServices
    Enable the MySQL Service
    (Optional install PHPmyadmin)

UPDATE 07sep11 Read Carful before jumping in.

  • Using the 64b version + Synology default MySQL install on a 1Gb NAS DS1511+ is horrible slow and can be considered not working and blows itself out the 1Gb memory. 
  • Using the 32bits version + HSQL works good BUT is not suitable for production since HSQL is a memory based database.
  • Using the 32bits version + Synology default MySQL install works fine and is describd below.

Conclusion: The 32b is more suitable for the 1Gb NAS, some tweaking of MySQL could improve performance. If anybody has some good settings please post a comment below.

I’ll update my blog the coming days how to tweak MySQL to improve performance with JIRA 32b.

Consider the rest of the article for educational purposes, I am going for the complete  Atlassian Dragon Quest and will make a series of blog posts here about my progres and improvements I’ve learned since my install last week. One of the conclusions is that teh build in MySQL is not easy to tweak in performance as it it totaly integrated into the Synology, so for teh Quest I’m going to use an independed PostgreSQL (yhea!) install.

 

Prepare a new user & directory for the JIRA install. Since the Synology is not a full linux install and has a limited boot partition we rather don’t install software on the boot partition, there for I prefer to install software in a user directory. It’s up to you if you like to try installing it as a root and see what happens. Leave me a note how it goes 🙂

  1. ln -s /opt/bin/bash /bin/bash
    Add this symbolic link after every upgrade on DSM 
  2. Add a new jira user and group in /etc/passwd, /etc/group, /etc/shadow:

    vi /etc/passwd
    jira:x:147:147:JIRA:/opt/jira:/bin/sh

    vi /etc/shadow
    jira:*:10933:0:99999:7:::

    vi /etc/group
    jira:x:147:jira

  3. mkdir /opt/jira
  4. chown jira:jira /opt/jira

 

Let’s create our DataBase

  1. cd /usr/syno/mysql/bin
  2. ./mysql
  3. Enter the following lines in the mysql shell:
    mysql> CREATE DATABASE jiradb CHARACTER SET utf8;
    Query OK, 1 row affected (0.00 sec)

    mysql> CREATE USER ‘jiradbuser’@’localhost’ IDENTIFIED BY ‘your_jira_DB_Password‘;
    Query OK, 0 rows affected (0.06 sec)

    mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP on jiradb.* TO ‘jiradbuser’@’localhost’;
    Query OK, 0 rows affected (0.01 sec)

  4. Check if your jiradbuser can login on your mysql database:
    /usr/syno/mysql/bin/mysql -p –user=jiradbuser jiradb
    Enter password:  your_jira_DB_Password  
    mysql>
  5.  Please note! default the Mysql server has open access! Change the configuration if you want the passwords enforced! ( see MySQL manual ) 

Your database is now setup.

 

JIRA Install

  1. su – jira
  2. cd /opt/jira
  3. Download the linux atlassian-jira-4.4-x32.bin ( wget might not work if https is not compiled in, but I guess you’ll find a way to get the file on your NAS 😉
  4. chmod 700 atlassian-jira-4.4-x32.bin
  5. Try to execute it with:
    ./atlassian-jira-4.4-x32.bin

    If this failes with an error “Sorry, but I could not find gunzip in path. Aborting.“, make sure you have gunzip installed and than fix it by editing the file with vi atlassian-jira-4.4-x32.bin and remove the following lines:

    gunzip -V  > /dev/null 2>&1
    if [ “$?” -ne “0” ]; then
      echo “Sorry, but I could not find gunzip in path. Aborting.”
      exit 1
    fi
    I know it sounds harsh, but the gunzip -V prodces an output the check does not expect. Since we checked it, it’s there 😉
    Retry to install it again:
    ./atlassian-jira-4.4-x32.bin

  6. It will ask: You do not have administrator rights to this machine. This means…. Press Y, 
    Since I have also Jenkins running on my host on HTTP port 8080 and ControlPort 8009, I change the ports of JIRA into 8081/8010
    After some time:
    Setup has finished installing JIRA 4.4 on your computer.
    JIRA 4.4 can be accessed at http://localhost:8081
    Finishing installation …
     Start your internet browser and connect to your NAS on port 8081
    Fill in the fields, and test the DB connection:

    Jiradbsetup

    Then press next to create the db, this can take a couple of minutes, be patient!
    After that fill in the blanks for your license etc and you’re install is ready.

 

BUG Workaround

When you login it could be possible you see the following error on your panel:
 

Jirabug

 

This is a similar bug to this one: JRA-25316. It can be fixed as following:

  1. vi atlassian/jira/bin/setenv.sh 
  2.  Find the line that reads: JVM_SUPPORT_RECOMMENDED_ARGS=”” 
    And add -Duser.timezone= with your time zone in the Canonical ID format.
    For example Amsterdam would be:
    JVM_SUPPORT_RECOMMENDED_ARGS=”-Duser.timezone=Europe/Amsterdam” 
  3. and the error should be gone 🙂

 

Creating a Startup script in /opt/etc/init.d

The next step is to have Jira start on boot, and stop on shutdown.

 

First at your jira user into the file, yes it sais dont edit and we gonne do it anyway!:

vi /opt/jira/atlassian/jira/bin/user.sh

# START INSTALLER MAGIC ! DO NOT EDIT !
JIRA_USER=“jira” ##
# END INSTALLER MAGIC ! DO NOT EDIT !

export JIRA_USER

 


vi /usr/local/etc/rc.d/S95jira.sh
Add the following lines into this new file:

#!/opt/bin/bash

# JIRA Linux service controller script
#cd “.”
cd “/opt/jira/atlassian/jira/bin”

case “$1” in
    start)
        ./start-jira.sh
        ;;
    stop)
        ./stop-jira.sh
        ;;
    *)
        echo “Usage: $0 {start|stop}”
        exit 1
        ;;
esac

Now adjust the start & stop scripts:

vi /opt/jira/atlassian/jira/bin/start-jira.sh 

#!/opt/bin/bash

# resolve links – $0 may be a softlink – stolen from catalina.sh
PRG=”$0″
while [ -h “$PRG” ]; do
  ls=`ls -ld “$PRG”`
  link=`expr “$ls” : ‘.*-> (.*)$’`
  if expr “$link” : ‘/.*’ > /dev/null; then
    PRG=”$link”
  else
    PRG=`dirname “$PRG”`/”$link”
  fi
done
PRGDIR=`dirname “$PRG”`
PRGBASE=`dirname “$PRGBASE”`
pushd $PRGBASE > /dev/null
PRGBASEABS=`pwd`
popd > /dev/null

PRGRUNMODE=false
if [ “$1” = “-fg” ] || [ “$1” = “run” ]  ; then
        shift
        PRGRUNMODE=true
else
        echo “”
        echo “To run JIRA in the foreground, start the server with start-jira.sh -fg”
fi

echo “”
echo “Server startup logs are located in $PRGBASEABS/logs/catalina.out”

. `dirname $0`/user.sh #readin the username

if [ -z “$JIRA_USER” ] || [ $(id -un) == “$JIRA_USER” ]; then

    echo executing as current user
    if [ “$PRGRUNMODE” == “true” ] ; then
        exec $PRGDIR/catalina.sh run $@
    else
        exec $PRGDIR/startup.sh $@
    fi

elif [ $UID -ne 0 ]; then

    echo JIRA has been installed to run as $JIRA_USER so please sudo run this to enable switching to that user
    exit 1

else

    echo executing using dedicated user: $JIRA_USER
    if [ -x “/sbin/runuser” ]; then
        sucmd=”/sbin/runuser”
    else
        sucmd=”/opt/bin/su”
    fi

    if [ “$PRGRUNMODE” == “true” ] ; then
        $sucmd -m $JIRA_USER -c “$PRGDIR/catalina.sh run $@”
    else
        $sucmd -m $JIRA_USER -c “$PRGDIR/startup.sh $@”
    fi

fi

And the stop script:

 vi /opt/jira/atlassian/jira/bin/stop-jira.sh 
#!/opt/bin/bash

# resolve links – $0 may be a softlink – stolen from catalina.sh
PRG=”$0″
while [ -h “$PRG” ]; do
  ls=`ls -ld “$PRG”`
  link=`expr “$ls” : ‘.*-> (.*)$’`
  if expr “$link” : ‘/.*’ > /dev/null; then
    PRG=”$link”
  else
    PRG=`dirname “$PRG”`/”$link”
  fi
done
PRGDIR=`dirname “$PRG”`

. `dirname $0`/user.sh #readin the username

if [ -z “$JIRA_USER” ] || [ $(id -un) == “$JIRA_USER” ]; then
    echo executing as current user

    exec $PRGDIR/shutdown.sh 20 -force $@

elif [ $UID -ne 0 ]; then

    echo JIRA has been installed to run as $JIRA_USER so please sudo run this to enable switching to that user
    exit 1

else

    echo executing using dedicated user
    if [ -x “/sbin/runuser” ]; then
        sucmd=”/sbin/runuser”
    else
        sucmd=”/opt/bin/su”
    fi
    $sucmd -m $JIRA_USER -c “$PRGDIR/shutdown.sh 20 -force $@”

fi

 

Happy pipping!( for those interested in IT & Trading ) 

http://www.atlassian.com/software/jira/

 

Advertisements

4 thoughts on “Installing JIRA 4 on a Synology Diskstation

  1. jira user

    Hi Thanks for clear instructionsIt seems working fine except for one thing. when I rebooted my DS710+, i found the jira service is not running. I checked /etc/log/messages and there were some error messages as below.Jan 22 10:33:57 s30_synocheckuser: CheckGUserExist(1538): user [jira] not found!Jan 22 10:33:57 s30_synocheckuser: CheckConsistentWithPasswd(1749): user not exist in /etc/passwd, and remove it. szBuf=jira:*:10933:0:99999:7:::and I couldn’t find jira in /etc/shadow. can I have some advise?

    Reply
    1. wesseldr Post author

      I think it will still work on DSM4.2. Just use this as a guide and follow the steps. I think 99% will be still the same.
      Personally I migrated my install to a VPS as more users needed to use my JIRA install. It works great though, and I think the DS1512+ will run even faster with JIRA. Just remember to have enough memory in your DS. Just look it up on the forum which memory modules to use. As the memory modules are just standard SODIM modules.

      Wessel

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s