0 REF
1 环境
1.1 查看系统版本
$ sw_vers -productVersion
10.9.5
$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: OS X 10.9.5 (13F1507)
Kernel Version: Darwin 13.4.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: ...
User Name: ...
Secure Virtual Memory: Enabled
Time since boot: 12:26
创建管理员git/git,分配到git用户组中。
1.2 Ruby环境
使用RVM升级系统自带的Ruby版本:
$ curl -L get.rvm.io | bash -s stable
$ source ~/.rvm/scripts/rvm
$ rvm install 2.3.1
$ rvm use 2.3.1 --default
$ rvm list
$ rvm remove 2.3.1
安装bundle:
$ gem install bundler --no-ri --no-rdoc
2 配置
GitLab版本:8-11-stable, 使用MySQL, 初始化脚本未给默认用户git/git REFERENCES权限,需要加上.
2.1 文件组织
/Users/git
/gitlab
gitlab.default.osx
/config
database.yml
gitlab.yml
resque.yml
secrets.ym
unicorn.rb
/lib/support
/init.d/gitlab
/logrotate/gitlab
/nginx/gitlab
/log # gitlab日志
application.log
gitlab-workhorse.log
production.log
sidekiq.log
unicorn.stderr.log
unicorn.stdout.log
/gitlab-shell
config.yml
/gitlab-workhorse/
/gitlab_repositories/
/usr/local/etc/redis.conf
/etc/init.d/gitlab
/var/log/nginx/ # nginx日志
gitlab_access.log
gitlab_error.log
/usr/local/etc/nginx
nginx.conf
/servers/gitlab
2.2 文件配置
配置文件中用户目录修改为/Users/git/,
/Users/git/gitlab/config/gitlab.yml
port: 8888
/Users/git/gitlab/config/resque.yml
url: unix:/tmp/redis.sock
/Users/git/gitlab/config/unicorn.rb
listen "127.0.0.1:8888", :tcp_nopush => true
/Users/git/gitlab/lib/support/nginx/gitlab
gitlab_workhorse_options="-listenUmask 0 -listenNetwork unix -listenAddr $socket_path/gitlab-workhorse.socket -authBackend http://127.0.0.1:88 -authSocket $rails_socket -documentRoot $app_root/public"
/Users/git/gitlab-shell/config.yml
gitlab_url: http://localhost:8888/
/etc/init.d/gitlab(同/Users/git/gitlab/lib/support/nginx/gitlab)
gitlab_workhorse_options="-listenUmask 0 -listenNetwork unix -listenAddr $socket_path/gitlab-workhorse.socket -authBackend http://127.0.0.1:8888 -authSocket $rails_socket -documentRoot $app_root/public"
/usr/local/etc/nginx/nginx.conf
# 注释掉http.server
/usr/local/etc/nginx/servers/gitlab
listen 0.0.0.0:8888 default_server;
listen [::]:8888 default_server;
3 构建和启停命令
- 构建
涉及gitlab的用git/git用户执行.
# 安装gitlab
$ cd ~/gitlab
$ bundle install --deployment --without development test postgres aws kerberos
# 安装gitlab-shell
$ cd ~/gitlab
$ bundle exec rake gitlab:shell:install[v3.4.0] REDIS_URL=unix:/tmp/redis.sock RAILS_ENV=production
# 安装gitlab-workhorse
$ cd ~/gitlab-workhorse
make
# 初始化gitlab数据库等
$ cd ~/gitlab/
$ bundle exec rake gitlab:setup RAILS_ENV=production
-
检查应用状态
cd ~/gitlab/ bundle exec rake gitlab:env:info RAILS_ENV=production
-
GitLab
$ sudo sh /etc/init.d/gitlab start $ sudo sh /etc/init.d/gitlab stop $ sudo sh /etc/init.d/gitlab restart
-
Redis
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist ## or $ restart: brew services restart redis
-
Nginx
$ sudo nginx $ sudo nginx -s stop $ sudo nginx -t # 验证配置
4 使用
-
GitLab访问
http://localhost:8888/
-
Git clone
$ git clone http://localhost:8888/zhoujiagen/BookApplication.git Cloning into 'BookApplication'... remote: Counting objects: 1329, done. remote: Compressing objects: 100% (703/703), done. remote: Total 1329 (delta 580), reused 1325 (delta 579) Receiving objects: 100% (1329/1329), 3.75 MiB | 0 bytes/s, done. Resolving deltas: 100% (580/580), done. Checking connectivity... done.