サーバ

JIRA をバージョン 3.13.1 へアップデート

JIRA はAtlassian社のJava ベースのバグトラッキングシステムで、ApacheJBossでも使われています。
とっつきやすさと高機能をうまく両立しており、また見た目が洗練されている素晴らしい製品です。
オープンソースプロジェクトへは無償ライセンスを提供してくれるので私のプロジェクトでも使っています

日本ではイマヒマ社が代理店をしており日本語版を販売しています。
チームウェア – アトラシアン JIRA(ジラ):画期的な課題トラッキング! Confluence(コンフルエンス):企業向けウィキ
JIRA(ジラ) – 画期的な課題トラッキング!

先日アップデートしたばかりなのですが、3ヶ月のうちにちょこまかとアップデートされましたので、またまた最新版にしました。
README に沿って作業しただけですがメモを残しておきます。
今回はアップデートですが、新規インストールの手順もほとんど同じです。

JIRA のバージョンは 3.12.3 から 3.13.1 になりました。

1. 現行 JIRA のバックアップ、新規インスタンスでインポート
既存 JIRA インスタンスより、
ADMINISTRATION > Import & Export > Backup Data to XML
File name: バックアップ先/jirabackup.xml > "Backup"

2. トラックバックを削除
先日トラックバックスパム攻撃を受けたのでバックアップした xml から TrackbackPing 要素を vi で削除しました。

%s/^ <TrackbackPing.*$//g

1. Atlassian より最新版をダウンロード
http://www.atlassian.com/software/jira/JIRADownloadCenter.jspa
デフォルトではスタンドアロン版のみ表示されています。今回は自前の JBoss にデプロイするので "Show all" をクリックして Enterprise – WAR/EAR 版を表示、ダウンロードしました。

3. MySQL にデータベース作成
既存データベースに接続させることもできるけれども、最適なスキーマを作るには新規にデータベースを用意した方が良いとのことです。

$ ./mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 26441
Server version: 5.0.45 MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database jira313 character set utf8;
Query OK, 1 row affected (0.03 sec)

mysql> Bye

$JBOSS_HOME/server/$MYCONFIG/deploy 以下に以下のファイルを作成してコネクションプール/データソースを作成。
jira313-ds.xml

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>JIRA313DS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/jira313</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<connection-property name="useUnicode">true</connection-property>
<connection-property name="characterEncoding">UTF8</connection-property>
<user-name>yusukey</user-name>
<min-pool-size>10</min-pool-size>
<max-pool-size>10</max-pool-size>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
</local-tx-datasource>
</datasources>

4. JIRA のデータソース設定
atlassian-jira-enterprise-3.13.1/edit-webapp/WEB-INF/classes/entityengine.xml を修正
接続 DB を hsql から mysql に、schema-name を削除。

99:    <datasource name="defaultDS" field-type-name="hsql"
100: schema-name="PUBLIC"

99: <datasource name="defaultDS" field-type-name="mysql"
100: <!--削除-->

atlassian-jira-enterprise-3.13.1/edit-webapp/WEB-INF/jboss-web.xml を作成。

<jboss-web>
<context-root>/jira</context-root>
<virtual-host>yusuke.homeip.net</virtual-host>
<resource-ref>
<res-ref-name>jdbc/JIRADS</res-ref-name>
<jndi-name>java:/JIRA313DS</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>mail/MailSession</res-ref-name>
<res-type>javax.mail.Session</res-type>
<jndi-name>java:/Mail</jndi-name>
</resource-ref>
</jboss-web>

これでローカルJNDI に jdbc:/JIRA313DS としてバインドされているデータソースをアプリケーションローカルの JNDI ツリーにリンクします。

atlassian-jira-enterprise-3.13.1/webapp/WEB-INF/web.xml を編集
以下をアンコメントてデータソースのリンクを有効にします。

    <!-- resource references -->
<!-- Uncomment for WebSphere
<resource-ref>
<description>Database for JIRA</description>
<res-ref-name>jdbc/JIRADS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>SERVLET</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
Uncomment for WebSphere -->

5. メールセッションの設定
atlassian-jira-enterprise-3.13.1/webapp/WEB-INF/web.xml を編集し、以下の行を追加してメールセッションを有効にします。

    <resource-ref>
<res-ref-name>mail/MailSession</res-ref-name>
<res-type>javax.mail.Session</res-type>
<res-auth>Container</res-auth>
</resource-ref>

6. Subversion プラグインの導入
http://confluence.atlassian.com/display/JIRAEXT/JIRA+Subversion+plugin
subversion-jira-plugin.properties を設定し、atlassian-jira-enterprise-3.13.1/edit-webapp/WEB-INF/classes/subversion-jira-plugin.properties に配置
atlassian-jira-enterprise-3.13.1/edit-webapp/WEB-INF/ に lib ディレクトリを作成し、atlassian-jira-subversion-plugin-0.10.4.jar、svnkit-1.1.6.jar を配置
subversion-jira-plugin.properties で編集したのは以下場所。

15c15
< svn.root=http://svn.atlassian.com/svn/public/contrib/jira/subversion-jira-plugin/samplerepo/

> svn.root=file:///Users/yusukey/repos/
25c25
< svn.display.name=Sample Repository

> svn.display.name=Samuraism Repository
95,100c95,100
< linkformat.changeset=http://svn.atlassian.com/fisheye/changelog/public?cs=${rev}
< linkformat.file.added=http://svn.atlassian.com/fisheye/viewrep/public${path}?r=${rev}
< linkformat.file.modified=http://svn.atlassian.com/fisheye/viewrep/public${path}#${rev}
< linkformat.file.replaced=http://svn.atlassian.com/fisheye/viewrep/public${path}#${rev}
< linkformat.file.deleted=http://svn.atlassian.com/fisheye/viewrep/public${path}
< linkformat.copyfrom=http://svn.atlassian.com/fisheye/viewrep/public${path}

> linkformat.changeset=http://yusuke.homeip.net/fisheye/changelog/svn?cs=${rev}
> linkformat.file.added=http://yusuke.homeip.net/fisheye/viewrep/svn${path}?r=${rev}
> linkformat.file.modified=http://yusuke.homeip.net/fisheye/viewrep/svn${path}#${rev}
> linkformat.file.replaced=http://yusuke.homeip.net/fisheye/viewrep/svn${path}#${rev}
> linkformat.file.deleted=http://yusuke.homeip.net/fisheye/viewrep/svn${path}
> linkformat.copyfrom=http://yusuke.homeip.net/fisheye/viewrep/svn${path}

7. Subversion プラグインインデックスの削除

rm -Rf ~/jiraindex/plugins/atlassian-subversion-revisions

これをしないと Subversion プラグインが以下のような例外を吐くことがあります。

15:20:33,896 INFO  [STDOUT] 2008-08-23 15:20:33,887 ajp-0.0.0.0-8009-6 ERROR [ext.subversion.projecttabpanels.SubversionProjectTabPanel] Error retrieving actions for project
java.lang.NumberFormatException: For input string: "117b7e0d-5933-0410-9d29-ab41bb01d86bhttp://localhost/svn"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Long.parseLong(Long.java:412)
at java.lang.Long.parseLong(Long.java:461)
at com.atlassian.jira.plugin.ext.subversion.revisions.RevisionIndexer.getLogEntriesByProject(RevisionIndexer.java:659)
at com.atlassian.jira.plugin.ext.subversion.projecttabpanels.SubversionProjectTabPanel.getRecentCommits(SubversionProjectTabPanel.java:159)
.
.
.

8. warのビルド、デプロイ

atlassian-jira-enterprise-3.13.1$ ./build.sh war
Buildfile: build.xml

init:
.
.
.
————————————————–
Deployable WARs generated:

TOMCAT: /Users/yusukey/Downloads/atlassian-jira-enterprise-3.13.1/dist-tomcat/atlassian-jira-3.13.1.war
GENERIC: /Users/yusukey/Downloads/atlassian-jira-enterprise-3.13.1/dist-generic/atlassian-jira-3.13.1.war

See http://www.atlassian.com/software/jira/docs/latest/servers/ for install instructions
————————————————–

BUILD SUCCESSFUL
Total time: 1 minute 38 seconds
$ mv dist-tomcat/tomcat-6/atlassian-jira-3.13.1.war $JBOSS_HOME/server/default/deploy/jira.war

9. 新規インスタンスでインポート
新規インスタンスにアクセスし、インポート。
Import Existing Data
File name: /Users/yusukey/jirabackup.xml

インポート画面。ここだけなぜか日本語

以上でバージョンアップが完了。

今回はなぜか Subversion プラグインが登録する Quartz タスクが重複しているとかいうエラーがでました。以下のページを見て解決。
JSP-21957 – Multiple services with name 'Subversion Revision Indexing Service' exist – Atlassian KnowledgeBase – Confluence

見かけはほとんど変わりませんでした。

せっかくFishEye を入れたので連携させたいですね。
もちろんプラグインがあります。
FishEye for JIRA – JIRA Extensions – Confluence
05.06 プロジェクトでFishEyeのコミット情報を見る – JIRA オンラインマニュアル (3.12.2版 – 最新) – Atlassian Confluence

関連記事:
JIRA 3.13.1 へ FishEye プラグイン 2.3 をインストール
FishEye 1.6.3 のインストール
JIRA をバージョン 3.12.3 へアップデート