GitLab CE安装配置

进入gitlab官方网站,选择对应的操作系统, 下载需要的安装包

#安装依赖
sudo apt-get install curl openssh-server ca-certificates postfix
#选择需要的二进制包https://packages.gitlab.com/gitlab/gitlab-ce
sudo dpkg -i gitlab-ce_8.3.4-ce.0_amd64.deb

Configure and start GitLab

#修改配置文件
sudo vi /etc/gitlab/gitlab.rb
#根据配置生成运行环境
sudo gitlab-ctl reconfigure

#启动gitlab
sudo gitlab-ctl start

#查看gitlab各个服务的状态
sudo gitlab-ctl status

Browse to the hostname and login

Username: root 
Password: 5iveL!fe

查看gitlab各个服务之间的关系

Sidekiq  #Rails3消息队列系统 
Unicorn  #Unicorn 是一个为运行 Rack 应用的HTTP服务器。是一个利用Unix的高级特性开发的,只为具备低延迟,高带宽的连接的客户服务的HTTP服务器软件
rack     #Ruby web 应用的简单的模块化的接口. 它封装 HTTP 请求与响应, 并提供大量的实用工具. 

GitLab CE安装配置_第1张图片

gitlab架构图,来自GitLab搭建与维护

GitLab CE安装配置_第2张图片

前端:Nginx,用于页面及Git tool走http或https协议
后端:Gitlab服务,采用Ruby on Rails框架,通过unicorn实现后台服务及多进程
SSHD:开启sshd服务,用于用户上传ssh key进行版本克隆及上传。注:用户上传的ssh key是保存到git账户中
数据库:目前仅支持MySQL和PostgreSQL
Redis:用于存储用户session和任务,任务包括新建仓库、发送邮件等等
Sidekiq:Rails框架自带的,订阅redis中的任务并执行

配置

修改代理服务器地址

external_url 'http://localhost'

修改git仓库路径

git_data_dir "/var/opt/gitlab/git-data"
# If you already have existing Git repositories in /var/opt/gitlab/git-data you can move them to the new location as follows:
# Prevent users from writing to the repositories while you move them.
sudo gitlab-ctl stop

# Note there is _no_ slash behind 'repositories', but there _is_ a
# slash behind 'git-data'.
sudo rsync -av /var/opt/gitlab/git-data/repositories /mnt/nas/git-data/

# Fix permissions if necessary
sudo gitlab-ctl reconfigure

# Double-check directory layout in /mnt/nas/git-data. Expected output:
# gitlab-satellites  repositories
sudo ls /mnt/nas/git-data/

# Done! Start GitLab and verify that you can browse through the repositories in
# the web interface.
sudo gitlab-ctl start

配置smtp服务器

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.server"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'

# If your SMTP server does not like the default 'From: gitlab@localhost' you
# can change the 'From' with this setting.
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
gitlab_rails['gitlab_email_display_name'] = 'gitlab'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com'

配置Unicorn

unicorn['worker_processes'] = 3
unicorn['worker_timeout'] = 60

配置使用外部postgresql数据库

# Disable the built-in Postgres
postgresql['enable'] = false

############################
# GitLab database settings #
############################
## see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/doc/settings/database.md#database-settings
## Only needed if you use an external database.

gitlab_rails['db_adapter'] = "postgresql"
gitlab_rails['db_encoding'] = "unicode"
gitlab_rails['db_collation'] = nil
gitlab_rails['db_database'] = "gitlabhq_production"
gitlab_rails['db_pool'] = 10
gitlab_rails['db_username'] = "gitlab"
gitlab_rails['db_password'] = nil
gitlab_rails['db_host'] = nil
gitlab_rails['db_port'] = 5432
gitlab_rails['db_socket'] = nil
gitlab_rails['db_sslmode'] = nil
gitlab_rails['db_sslrootcert'] = nil


# For GitLab CI, you can use the same parameters:
gitlab_ci['db_host'] = '127.0.0.1'

使配置修改生效

sudo /opt/gitlab/bin/gitlab-ctl reconfigure
sudo /opt/gitlab/bin/gitlab-ctl restart

Gitlab 的集群解决方案

GitLab CE安装配置_第3张图片

参照

  • http://doc.gitlab.com/omnibus/
  • GitLab 的高可用性
  • GitLab搭建与维护(基于docker镜像sameersbn/docker-gitlab)
  • http://www.oschina.net/p/unicorn
  • https://github.com/mperham/sidekiq

你可能感兴趣的:(git/svn)