Bitnami Redmine に Backlogs を入れてみたら意外とハマったのでメモっておく。
環境
- インフラ: Azure
- OS: Ubuntu 14.04 LTS
- Bitnami Redmine Stack: 2.6.0-3
Redmine のインストール
Bitnami からダウンロードして、インストール。ファイルをそのまま実行するだけ。
尚、/opt にインストールするには sudo すれば良いが、以降の gem install 等でも当然ながら root 権限が必要となる。環境変数の引継ぎも必要なので、焦点を絞るためにここでは実行ユーザーは azureuser, インストール先は /home/azureuser 直下とする。
$ chmod 755 bitnami-redmine-2.6.0-3-linux-x64-installer.run
$ ./bitnami-redmine-2.6.0-3-linux-x64-installer.run
ちなみに、メモリが少なすぎると以下のようなエラーが多数出てまともにインストールできない(手動でシンボリックリンクを作っても次から次へと出るのでやってられない)。
Azure の A0 (768MB) ではまった。
Unable to create symbolic link /home/azureuser/redmine-2.6.0-3/php/bin/phar -> phar.phar
必要な Gems をインストール。
本家の手順に従ってやれば良い。
まずは Bitnami Redmine の ruby に PATH を通す。
$ export GEM_HOME=/home/azureuser/redmine-2.6.0-3/ruby/lib/ruby/gems/2.0.0/gems
$ export PATH=/home/azureuser/redmine-2.6.0-3/ruby/bin:$PATH
Redmine のルートディレクトリで bundle install。
$ cd /home/azureuser/redmine-2.6.0-3/apps/redmine/htdocs
$ bundle install --without development test
...
Using request_store 1.0.5
Using rmagick 2.13.2
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
$ gem install holidays --version 1.0.3
$ gem install holidays
先に 1.0.3 を入れなくても問題ないかも。
Backlogs の取得とビルド
Backlogs のソースを取得。
$ cd /home/azureuser/redmine-2.6.0-3/app/redmine/htdocs/plugins
$ git clone git://github.com/backlogs/redmine_backlogs.git
$ cd redmine_backlogs
$ git checkout v1.0.6
Gem のビルドに必要なパッケージをインストールする。
$ sudo apt-get install gcc
$ sudo apt-get install make
$ sudo apt-get install g++
マイグレーション。
$ export RAILS_ENV=production
$ cd /home/azureuser/redmine-2.6.0-3/app/redmine/htdocs
$ bundle exec rake db:migrate
Could not find gem 'cucumber (= 1.1.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
エラー。
言われた通りに bundle install する。
$ bundle install --no-deployment
...
An error occurred while installing nokogiri (1.5.11), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.11'` succeeds before bundling.
すると nokogiri がインストールできないと。
というわけで、nokogiri に必要なライブラリをインストールする。
$ sudo apt-get install libxml2-dev
$ sudo apt-get install libxslt-dev
ライブラリを指定して nokogiri をインストール。
$ gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2
Building native extensions with: '--use-system-libraries=true --with-xml2-include=/usr/include/libxml2 -E'
This could take a while...
Successfully installed nokogiri-1.6.5
Parsing documentation for nokogiri-1.6.5
unable to convert "\x82" from ASCII-8BIT to UTF-8 for lib/nokogiri/nokogiri.so, skipping
Installing ri documentation for nokogiri-1.6.5
1 gem installed
できた。
で、bundle install。
ここで、そのままやると nokogiri のバージョンが新しいとかほざくので、Backlogs プラグインの Gemfile を書き換えてバージョン指定を外す。
もちろん指定されたバージョンをインストールしても良い。
gem "nokogiri"
$ bundle install --no-deployment
...
Your bundle is complete!
Gems in the groups development and test were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
今度こそできた。
で、マイグレーションにもようやく成功する。
本家の手順にしたがって、キャッシュとセッションもクリア。
$ bundle exec rake db:migrate
$ bundle exec rake tmp:cache:clear
$ bundle exec rake tmp:sessions:clear
Backlogs インストール
Redmineに「ストーリー」「タスク」の2つのトラッカーを追加する。こちらが参考になります。
インストールを実行し、ストーリーとタスクに上で作成したトラッカーをそれぞれ割り当てる。
$ cd /home/azureuser/redmine-2.6.0-3/apps/redmine/htdocs
$ bundle exec rake redmine:backlogs:install
...
-----------------------------------------------------
Which trackers do you want to use for your stories?
1. バグ
2. 機能
3. サポート
4. ストーリー
5. タスク
Separate values with a space (e.g. 1 3): 4
You selected the following trackers: ストーリー. Is this correct? (y/n) y
-----------------------------------------------------
Which tracker do you want to use for your tasks?
1. バグ
2. 機能
3. サポート
4. タスク
Choose one from above (or choose none to create a new tracker): 4
You selected タスク. Is this correct? (y/n) y
Story and task trackers are now set.
...
done!
Installation complete. Please restart Redmine.
Thank you for trying out Redmine Backlogs!
おしまい。