Ubuntu 14.10集成redmine和gitlab(bitnami stacks)

为了利用redmine的项目管理功能,和gitlab的git仓库,需要集成这两个工具。

1. 准备工作

 首先下载 bitnami的一键安装包:

bitnami-gitlab-8.5.7-0-linux-x64-installer.run

bitnami-redmine-3.2.1-0-linux-x64-installer.run

两个安装包同时下载的目的,是要确保他们使用的ruby, rails环境一致。


2. 安装

首先安装gitlab, 然后安装redmine.  详细步骤省略.

安装后的目录结构:

cd /opt
#  ls -1 |awk '{print i$0}' i=`pwd`'/'
/opt/gitlab-8.5.7-0
/opt/redmine-3.2.1-0


3. 配置redmine和gitlab协同工作

3.1 配置gitlab, 使用redmine的issus和project

 管理员登录后,admin area-->Service Template, 选择redmine进行设置。具体方法参考gitlab的有关说明。

 经过这一步配置后,以后创建的project, 就已经把跳转redmine功能初步设定了。但是还需要进入

              project的settings页面,进一步修改projectid等。(参考gitlab文档)

3.2 把redmine并入gitlab一起启动。

redmine启动需要的环境,除了mysql和subversion, 其他的gitlab安装目录下都有了。

而且,bitnami的这个安装包,gitlab必须启动后以web根目录访问,把redmine并入gitlab启动相对简单些。


在配置修改前,分别在两个安装目录下执行下面命令,停止两个服务:

./ctlscript.sh stop



3.2.1 在gitlab目录下,创建redmine和subversion的符号链接(如果不需要subversion,第二个ln命令就不要了)

# pwd
/opt/gitlab-8.5.7-0
# ln -s /opt/redmine-3.2.1-0/mysql/ .
# ln -s /opt/redmine-3.2.1-0/subversion/ .


3.2.2 修改gitlab目录下的bitnami apache配置文件,启动redmine:

vi /opt/gitlab-8.5.7-0/apps/gitlab/conf/httpd-prefix.conf

修改后文件内容如下:

DocumentRoot "/opt/gitlab-8.5.7-0/apps/gitlab/htdocs/public"
Include "/opt/gitlab-8.5.7-0/apps/gitlab/conf/httpd-app.conf"
Alias /redmine/ "/opt/redmine-3.2.1-0/apps/redmine/htdocs/public/"
Alias /redmine "/opt/redmine-3.2.1-0/apps/redmine/htdocs/public"
Include "/opt/redmine-3.2.1-0/apps/redmine/conf/httpd-app.conf"

3.2.3 修改apache配置文件

# vi /opt/gitlab-8.5.7-0/apache2/conf/bitnami/bitnami-apps-prefix.conf

修改后文件内容:

# Bitnami applications installed in a prefix URL
Include "/opt/gitlab-8.5.7-0/apps/phppgadmin/conf/httpd-prefix.conf"
Include "/opt/gitlab-8.5.7-0/apps/gitlab/conf/httpd-prefix.conf"
Include "/opt/redmine-3.2.1-0/apps/phpmyadmin/conf/httpd-prefix.conf"
Include "/opt/redmine-3.2.1-0/apps/redmine/conf/httpd-prefix.conf"
这样修改后,phpmyadmin和phppgadmin都可以使用。

(http://localhost/phpmyadmin, http://localhost/phppgadmin)

3.3 启动确认

# ./ctlscript.sh start
160409 23:34:52 mysqld_safe Logging to '/opt/redmine-3.2.1-0/mysql/data/mysqld.log'.
160409 23:34:53 mysqld_safe Starting mysqld.bin daemon with databases from /opt/redmine-3.2.1-0/mysql/data
/opt/gitlab-8.5.7-0/mysql/scripts/ctl.sh : mysql  started at port 3306
waiting for server to start.... done
server started
/opt/gitlab-8.5.7-0/postgresql/scripts/ctl.sh : postgresql  started at port 5432
/opt/gitlab-8.5.7-0/redis/scripts/ctl.sh : redis started
/opt/gitlab-8.5.7-0/apps/gitlab/scripts/sidekiq.sh : gitlab_sidekiq started
/opt/gitlab-8.5.7-0/apps/gitlab-workhorse/scripts/ctl.sh : gitlab-workhorse started
/opt/gitlab-8.5.7-0/apps/gitlabci/gitlabci-multirunner/scripts/ctl.sh : gitlabci_multirunner started
Syntax OK
/opt/gitlab-8.5.7-0/apache2/scripts/ctl.sh : httpd started at port 80
/opt/gitlab-8.5.7-0/subversion/scripts/ctl.sh : subversion started at port 3690
# 

这样,可以分别从http://localhost访问gitlab, 以及通过http://localhost/redmine访问redmine了。


4. 在gitlab页面上增加redmine的链接:

# pwd
/opt/gitlab-8.5.7-0/apps/gitlab/htdocs/app/views/layouts/nav
# gedit  _profile.html.haml (或者vi)

在文件最前面追加下列代码:

%ul.nav.nav-sidebar
  = nav_link(path: ['root#index'], html_options: {class: 'home'}) do
    = link_to "http://192.168.100.135/redmine", title: 'Redmine' ,  :target=> "_blank" do
      = icon('home fw')
      %span
        Redmine
注意: 用你配置的地址,代替上面的"192.168.100.135"

保存后重新启动apache确认:

# /opt/gitlab-8.5.7-0/ctlscript.sh restart apache
Syntax OK
/opt/gitlab-8.5.7-0/apache2/scripts/ctl.sh : httpd stopped
Syntax OK
/opt/gitlab-8.5.7-0/apache2/scripts/ctl.sh : httpd started at port 80
# 



5. 在redmine的欢迎页,增加gitlab的跳转

利用管理员账号,在欢迎页编辑的地方,直接输入URL就可以了,不再赘述。



6. TODO:

    利用gitlab的钩子程序,限制代码提交和project创建,必须和redmine中的issues关联。

  (网上有相关参考资料,时间所限没来得及验证)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值