RhodeCode(ロードコード)のインストール

RhodeCodeはいわゆる「GitHubクローン」と呼ばれる主に社内などのプライベートな領域に「GitHubのようなもの」を作りたいひとのためのシステム。

RhodeCode自体はPythonで開発されており、バックエンドにはGitおよびMercurialを利用できる。
(データベースとしては、SQLite/PostgreSQL/MySQLから選べる)


公式サイト
https://rhodecode.com/


以下の環境へインストールする。
CentOS 6.4/64bit


ユーザを追加

# /usr/sbin/useradd -s/sbin/nologin rhodecode


インストーラを入手する。

# cd /home/rhodecode
# curl -O https://rhodecode.com/dl/rhodecode-installer.py

インストール。

# python rhodecode-installer.py

RhodeCode Installer 0.4.1

Firstly, I need to store some basic settings in a file called .
rhodecode_config in the current folder. Please do not touch that file. I 
will do that for you. Now I need to ask you for the some configuration 
details. You can, as always, quit by typing 'q'.

Do you need to connect through a proxy server with the Internet?
[y]es
[n]o
> n

Do you already have RhodeCode or RhodeCode Enterprise installed on this 
server?
[y]es
[n]o
> n

Under which Linux user do you want to install RhodeCode Enterprise?
> rhodecode

Please select an option:
[1] Install RhodeCode Enterprise
[2] Show the start command
[3] Check for new RhodeCode Enterprise version
[4] Change the settings
[5] Perform advanced actions
[0] Check for new Installer version
[q] Quit installer
> 1


Can I start the installation?
[y]es, please start the installation
[n]o, I don’t want to install RhodeCode Enterprise anymore
> y

Please wait, I am downloading & installing the dependencies. This may take up to 5 minutes ...
... running command: sudo yum install make automake gcc gcc-c++ kernel-devel git-core -y
... running command: sudo yum install python-devel -y
... running command: sudo yum install mysql-devel postgresql-devel -y
... running command: sudo yum install openldap-devel -y
... running command: sudo curl -k -o /tmp/ez_setup.py https://sources.rhodecode.com/setuptools/raw/bootstrap/ez_setup.py
... running command: sudo /usr/bin/python /tmp/ez_setup.py
... running command: sudo /usr/bin/easy_install pip
... running command: sudo rm setuptools-*.tar.gz
... running command: sudo pip install -I -i https://pypi.rhodecode.com/ pip
... running command: sudo pip install -I virtualenv
I installed the dependencies.

Please wait, I am creating the application sandbox ...
... running command: su rhodecode -s /bin/sh -c 'virtualenv --no-site-packages /home/rhodecode/rhodecode-venv'
I created the virtualenv sandbox '/home/rhodecode/rhodecode-venv'.

Please wait, I am creating the basic folder structure ...
... running command: su rhodecode -s /bin/sh -c 'mkdir /home/rhodecode/rhodecode'
I created the folder /home/rhodecode/rhodecode for RhodeCode Enterprise itself.
... running command: su rhodecode -s /bin/sh -c 'mkdir /home/rhodecode/rhodecode/repos'
I created the folder /home/rhodecode/rhodecode/repos for your source code repositories.

Please wait, I am downloading & installing RhodeCode Enterprise. This may take up to 15 minutes ...

Please wait, I am downloading & installing more dependencies. This may take up to 5 minutes ...
... running command: cd /usr/local/bin && sudo ln -s /home/rhodecode/rhodecode-venv/bin/rhodecode-api
... running command: cd /usr/local/bin && sudo ln -s /home/rhodecode/rhodecode-venv/bin/rhodecode-config
... running command: cd /usr/local/bin && sudo ln -s /home/rhodecode/rhodecode-venv/bin/rhodecode-gist
... running command: cd /usr/local/bin && sudo ln -s /home/rhodecode/rhodecode-venv/bin/rhodecode-extensions
... running command: su rhodecode -s /bin/sh -c 'cd /home/rhodecode/rhodecode && /home/rhodecode/rhodecode-venv/bin/rhodecode-config --raw --filename=template.ini.mako && /home/rhodecode/rhodecode-venv/bin/rhodecode-config --template=template.ini.mako --filename=production.ini host='0.0.0.0',port=5000'
I successfully installed RhodeCode Enterprise for you. Starting setup now ...


Now I want to run the initial setup and create the first RhodeCode Enterprise user. The user will get administrator rights. For that I need to ask you the email, username and password for that user account. Please do not enter spaces to avoid issues.

Please enter the email address:
> root@sample.com

Please enter the username:
> admin_name

Please enter a password for the user:
>

Please enter the same password again:
>

I need to store that admin user in a database. Important: For MySQL and 
PostgreSQL the database must already exist! For SQLite everything is 
automatically created.

What database do you use? Leave empty for sqlite.
[s]qlite (built-in, no server needed)
[m]ysql
[p]ostgresql
> s

The service for RhodeCode Enterprise was successfully installed!

You can start, stop, restart and get the status of the service with:
sudo /etc/init.d/rhodecode {start|stop|restart|status}


サービスの開始

# /etc/init.d/rhodecode start
Starting RhodeCode Enterprise: Changing user to rhodecode:rhodecode (510:511)
Entering daemon mode
                                                           [  OK  ]


5000番ポートへブラウザでアクセスする。iptablesなどの許可が必要。

80番ポートでアクセスしたい場合は、ProxyPassを設定する。


RhodeCodeのメニューを日本語化するには、production.iniの[app:main]セクション内のキーlangの値をjaに変更し、サービスを再起動する。

lang = ja


なお、CentOS-6のGitのバージョンは1.7.1であり、このバージョンではRhodeCodeでGitを使用した場合に「 -c オプション」が認識できず構文エラーとなる。

Gitでコミットしようとすると404エラーとなり、syslogには以下のように出力される。

2013-11-23 17:23:54.066 ERROR [rhodecode.lib.vcs.backends.git.repository] Couldn't run git command (git -c core.quotepath=false rev-list --branches --tags --reverse --date-order).
Original error was:Subprocess exited due to an error:
Unknown option: -c
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
           [-p|--paginate|--no-pager] [--no-replace-objects]
           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
           [--help] COMMAND [ARGS]


新しいバージョンのGitをインストールして解決する。

既存のGitを削除

# yum remove git


新しいGitを入手してインストール。

# wget http://git-core.googlecode.com/files/git-1.8.4.3.tar.gz
# tar zxf git-1.8.4.3.tar.gz
# cd git-1.8.4.3
# ./configure
# make
# make install
# make install-man

コマンドのパスをシンボリックリンクで作成。

# ln -s /usr/local/bin/git /usr/bin/git

確認。

# git --version
git version 1.8.4.3

ログは「/var/log/rhodecode/rhodecode.log」へ出力されるが、ローテーションするような設定になっていないので、logrotateなどを設定しておくとよい。