安装/配置gitlab

软件stack

  • ubuntu: 12 64位
  • ruby: 2.1.0 己经编译安装
  • gitlab: https://github.com/gitlabhq/gitlabhq.git tag: v7.1.0
  • gitlab-shell: https://github.com/gitlabhq/gitlab-shell.git tag: v1.9.6
  • git: 2.0.2
  • mysql: MariaDB

检测安装的状态

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

初始化数据库及激活高极特性

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

启动gitlab

sudo -u git -H bundle exec unicorn_rails -c config/unicorn.rb -D

Bug fix


authorized_keys file is out of sync

sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production

Fixing MySQL’s Illegal Mix of Collations
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);

$link = mysql_connect("localhost","root","xxxx")
    or die("unable to connect to msql server: " . msql_error());

mysql_select_db("gitlabhq_production", $link)
    or die("unable to select database 'db': " . msql_error());

$result = mysql_query("show tables");
if (!$result) {
    die('query failed: ');
}

while ($row = mysql_fetch_array($result)){
    $sql = "alter table `gitlabhq_production`.`{$row[0]}` convert to character set utf8 collate utf8_general_ci";
    mysql_query($sql);
    #Command Reference: ALTER TABLE tableName ENGINE=MyISAM
}