↑日記で日々積み重ねた情報をトップの「わんこのページ」にまとめています。

おのたく日記 [RDF] YouTubeも始めました→


2010-09-23(Thu) バグトラッキングシステムとし(BTS)てRedmineをインストールする [長年日記]

[Debian][Redmine]バグトラッキングシステムとし(BTS)てRedmineをインストールする

ローカルのgitで管理するソースが増えてきたので、BTSとして何か使いたいと思いTracを使おうかと思っていたけど、WindowsだとTrac Ligthingが出てきて設定が簡単そうだったけれど、DebianではTrac設定が面倒そうだったので(事実は不明)、Redmineをインストールすることにした。

実はMySQLがutf8で動いていないとデータがlatanになってデータベースの中に入るロール「管理者」「開発者」「報告者」やトラッカーのステータスなどの情報が文字化けするので、Redmineのはっケージをインストールする前にMySQLがutf8で動くようにしておく

[mysqld]

default-character-set=utf8

[/etc/mysql/my.cnf修正より引用]

あとは、Debian Squeeze(testing)では、debパッケージになっているので簡単。

redmine, redmine-mysql, redmine-plugin-botsfilterのdebパッケージをインストールした。

RedmineをApacheからアクセスできるようにする

まずは、libfcgi-ruby1.8libapache2-mod-fcgidをインストールしてapacheの設定で

<IfModule mod_alias.c>

<IfModule mod_rewrite.c>

<IfModule mod_fcgid.c>

# FcgidInitialEnv for module mod_fcgid

FcgidInitialEnv RAILS_RELATIVE_URL_ROOT "/redmine"

FcgidInitialEnv X_DEBIAN_SITEID "default"

Alias "/redmine/plugin_assets/" /var/cache/redmine/default/plugin_assets/

Alias "/redmine" /usr/share/redmine/public

<Directory "/usr/share/redmine/public">

Options +FollowSymLinks +ExecCGI

Order allow,deny

Allow from all

RewriteEngine On

RewriteBase "/redmine"

RewriteRule ^$ index.html [QSA]

RewriteRule ^([^.]+)$ $1.html [QSA]

RewriteCond %{REQUEST_FILENAME} !-f [OR]

RewriteCond %{REQUEST_FILENAME} dispatch.fcgi$

RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

</Directory>

</IfModule>

</IfModule>

</IfModule>

として、Apacheでアクセスできるようにした。

Redmineの設定

まずは、admin/adminでRedmineに入って、

・adminのバスワードを変える: 「個人設定」→「パスワード変更」

・ユーザが自由にユーザ登録ができないように:「管理」→「設定」→「ユーザは自分で登録できる」を「無効」

・メールの送信の設定: 「管理」→「設定」→「メール通知」で送信元メールアドレスとメールのフッタを修正

・メール受信の設定: 「管理」→「設定」→「受信メール」で受信メール用のWebサービスを有効にして、キーを生成して、それをもとに

rm: "|/usr/share/redmine/extra/mail_handler/rdm-mailhandler.rb --url https://on-o.com/ --key abcdefghi"

[/etc/aliasより引用]

のように設定する。

・普通に使うユーザを登録「設定」→「ユーザ」→「新しいユーザ」で登録

した。

Apacheでユーザ登録できないようにrewriteとかする必要があるかと思ったけど、Scuttleと違ってRedmine自身で設定ができた。

Redmineのメール設定

/usr/share/doc/redmine/examples/email.yml.exampleを参考に

production:

delivery_method: :smtp

smtp_settings:

address: localhost

port: 25

development:

delivery_method: :smtp

smtp_settings:

address: 127.0.0.1

port: 25

[/etc/redmine/default/email.ymlより引用]

を作って、「設定」→「メール通知」でテストメールを送信でテストする。

RedmineとGitの連携

Git側にも設定が必要

Redmine, git and the post-commit / post-receive hook」にしたがい、

echo "running post-receive hook..."

cd /usr/share/redmine

ruby script/runner "Repository.fetch_changesets" -e production

[.git/hooks/post-receiveより引用]

を作った。

早速push

$ git push

Counting objects: 4, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 342 bytes, done.

Total 3 (delta 0), reused 0 (delta 0)

remote: running post-receive hook...

remote: ./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement

remote: Rails Error: Unable to access log file. Please ensure that /var/log/redmine/default/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.

To git@on-o.com:git-test.git

291957c..30d4c69 ssh-access -> ssh-access

! [rejected] office -> office (non-fast-forward)

error: failed to push some refs to 'git@on-o.com:git-test.git'

To prevent you from losing history, non-fast-forward updates were rejected

Merge the remote changes before pushing again. See the 'Note about

fast-forwards' section of 'git push --help' for details.

ありり、「Warning: Gem::Dependency#version_requirements」とか警告が出ている。

"version_requirements is deprecated" への対応」にあるように

# "version_requirements is deprecated" への対応

if Gem::VERSION >= "1.3.6"

module Rails

class GemDependency

def requirement

r = super

(r == Gem::Requirement.default) ? nil : r

end

end

end

end

[/usr/share/redmine/config/environment.rbの20行目あたりに追加より引用]

としたら、とりあえずエラーは出なくなった。(officeブランチのorigin/officeへのrebaseもやったけどね)

と思ったけど、/usr/share/redmine/config/environment.rbしたあとに再起動したら500エラーになってしまったので、このワーニングの表示は出ても無視することにして、このパッチは止めた

Redmineのデータのバックアップとリストア

mysqldump --password=pass --user=redmine --databases redmine_default >Backup

mysql --password=pass --user=redmine

本日のPingbacks(全0件)

Google Web検索 on-o.com内を検索