Since I spend this summer in Germany, I started a big home improvement project. Well, I’m not Tim Taylor and my tools are not from Binford, but it is really a serious improvement for me. So the plan is to remodel the attic: insulate the roof, replace old single-glass windows by the double glazing, replace the old floor and actually create a big room with light, heating and furniture. In the same time remodeling of the dining room on the second floor seemed reasonable, because the roof was not insulated there either. In doing so I faced the problem of managing many small tasks which depends on each other.

I played with Bugzilla for the site I hosted for TLA+ but I wanted to try something new and installed JIRA on my home server. The nice story about it is: it is written in Java and it costs only 10$. I installed the bundled (which includes Tomcat) version on my old home server and used my MySQL DB for bugs.

Switching the database

After the default installation I changed the following Datasource configuration to switch from HSQL-DB to MySQL in conf/server.xml:

<Resource name="jdbc/JiraDS" 
  auth="Container" 
  type="javax.sql.DataSource"
  driverClassName="com.mysql.jdbc.Driver"
  url="jdbc:mysql://localhost/jira?autoReconnect=true
&amp;useUnicode=true&amp;characterEncoding=UTF8"
  username="user"
  password="secret"
  maxActive="20"
  validationQuery="select 1"
/>

And changed the dialect in atlassian-jira/WEB-INF/classes/entityengine.xml:

<datasource name="defaultDS" field-type-name="mysql"
  helper-class="org.ofbiz.core.entity.GenericHelperDAO"
  check-on-start="true" 
  use-foreign-keys="false" 
  use-foreign-key-indices="false" 
  check-fks-on-start="false"
  check-fk-indices-on-start="false"
  add-missing-on-start="true" check-indices-on-start="true">
    <jndi-jdbc jndi-server-name="default" 
      jndi-name="java:comp/env/jdbc/JiraDS"
    />
</datasource>

Integrating with Apache Webserver

In addition, I don’t like entering ports into the browser, so I activated mod_jk Apache module and shifted the JIRA tomcats ports 50000 upwards:

<Connector port="58080" protocol="HTTP/1.1"
  maxHttpHeaderSize="58192" 
  maxThreads="150" minSpareThreads="25" maxSpareThreads="75" 
  useBodyEncodingForURI="true" enableLookups="false" 
  redirectPort="58443" 
  acceptCount="100" connectionTimeout="20000" 
  disableUploadTimeout="true"/>
    <Context path="/jira/" 
    docBase="${catalina.home}/atlassian-jira" 
    reloadable="false">
    ...
</Connector>
<Connector port="58009" 
  enableLookups="false" 
  redirectPort="58443" 
  protocol="AJP/1.3" />

Please note that also I changed the path to “/jira/”. So in order to access it from the browser, you need to type http://server:58080/jira/
In Apache HTTPD Server configuration, I loaded the mod_jk module and configured a worker for JIRA:

# Where to find rkers.properties
# Update this path to match your conf directory location 
# (put workers.properties next to httpd.conf)
JkWorkersFile /etc/apache2/workers.properties

# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile     /var/lock/apache2/mod_jk.shm

# Where to put jk logs
# Update this path to match your logs directory location 
# (put mod_jk.log next to access_log)
JkLogFile     /var/log/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel    error

# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

#Mounts
JkMount /jira/* jira

The worker.properties file defines a worker using the Tomcat AJP13 connector:

#workers using ajp13
worker.list=jira

# Set properties for jira (ajp13)
worker.jira.type=ajp13
worker.jira.host=localhost
worker.jira.port=58009

Let it mail

For maximum comfort I tried to let my JIRA installation send me mails using my GMail mail account. I followed the instruction on the JIRA page.

<Resource name="mail/GmailSmtpServer"
  auth="Container" 
  type="javax.mail.Session"
  mail.smtp.host="smtp.googlemail.com"
  mail.smtp.port="465"
  mail.smtp.auth="true"
  mail.smtp.user="myusername@gmail.com"
  password="mypass"
  mail.debug="true"
  mail.smtp.starttls.enable="true"
  mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
/>

I finished the setup and got the following error:

com.atlassian.mail.MailException: javax.mail.MessagingException: 
  Exception reading response; nested exception is:
        javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
        at com.atlassian.mail.server.impl.SMTPMailServerImpl.send(SMTPMailServerImpl.java:191)
        at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:47)
        at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:68)
        at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:23)
        at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:67)
        at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:48)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)

The problem results from the fact, that GMail uses TLS certificates which has to be imported as described here. After executing the steps, my JIRA mails me on changes of the Issue states…

After all, I can create my issues and should focus on the home improvement again. But now I’m very well organized.

Tags: , , , ,