标签:sid 常用 console 依赖包 where open contact nis ruby
GitLab是一个自托管的Git项目仓库,可以自己搭建个人代码管理的仓库,功能与github类似。
sudo yum install curl-devel sudo yum install expat-devel sudo yum install gettext-devel sudo yum install openssl-devel sudo yum install zlib-devel sudo yum install perl-devel sudo yum install curl sudo yum install openssh-server sudo yum install openssh-clients sudo yum install postfix sudo yum install cronie
Ubuntu系统使用apt-get方式安装依赖包。
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
sudo gitlab-ctl stop
sudo gitlab-ctl restart
# 检查redis的日志 sudo gitlab-ctl tail redis # 检查postgresql的日志 sudo gitlab-ctl tail postgresql # 检查gitlab-workhorse的日志 sudo gitlab-ctl tail gitlab-workhorse # 检查logrotate的日志 sudo gitlab-ctl tail logrotate # 检查nginx的日志 sudo gitlab-ctl tail nginx # 检查sidekiq的日志 sudo gitlab-ctl tail sidekiq # 检查unicorn的日志 sudo gitlab-ctl tail unicorn
sudo gitlab-ctl status
一般服务状态显示信息
显示格式:
状态 : 进程名称:(进程ID)运行时间(秒);进程的日志服务进程和运行时间
run: gitlab-workhorse: (pid 11892) 281s; run: log: (pid 8630) 4742472s run: logrotate: (pid 11904) 280s; run: log: (pid 8631) 4742472s run: nginx: (pid 11911) 280s; run: log: (pid 8796) 4742455s run: postgresql: (pid 12866) 18s; run: log: (pid 8627) 4742472s run: redis: (pid 11989) 249s; run: log: (pid 8638) 4742472s run: sidekiq: (pid 12850) 20s; run: log: (pid 8634) 4742472s run: unicorn: (pid 12022) 247s; run: log: (pid 8629) 4742472s
状态 | 说明 |
run | 运行状态 |
down | 服务停止 |
500 Whoops, something went wrong on our end. Try refreshing the page, or going back and attempting the action again. Please contact your GitLab administrator if this problem persists.
如何检查和定位问题?
使用命令检查所有服务的状态
sudo gitlab-ctl status
检查服务状态如下
run: gitlab-workhorse: (pid 11892) 91s; run: log: (pid 8630) 4742282s run: logrotate: (pid 11904) 90s; run: log: (pid 8631) 4742282s run: nginx: (pid 11911) 90s; run: log: (pid 8796) 4742265s down: postgresql: 1s, normally up, want up; run: log: (pid 8627) 4742282s run: redis: (pid 11989) 59s; run: log: (pid 8638) 4742282s run: sidekiq: (pid 12201) 2s; run: log: (pid 8634) 4742282s run: unicorn: (pid 12022) 57s; run: log: (pid 8629) 4742282s
定位问题
从服务状态信息中显示数据库postgresql的状态是down,即服务停止。
检查数据库postgresql的运行日志,检查出现什么错误?
$ sudo gitlab-ctl tail postgresql ==> /var/log/gitlab/postgresql/state <== ==> /var/log/gitlab/postgresql/current <== 2016-12-24_01:39:39.00188 FATAL: data directory "/var/opt/gitlab/postgresql/data" has group or world access 2016-12-24_01:39:39.00190 DETAIL: Permissions should be u=rwx (0700). 2016-12-24_01:39:40.00698 FATAL: data directory "/var/opt/gitlab/postgresql/data" has group or world access 2016-12-24_01:39:40.00700 DETAIL: Permissions should be u=rwx (0700).
日志显示,数据库的访问权限应该是只有用户本身有读写执行的权限,用户组和其他用户不能有权限。
修改数据库数据的权限后,检查服务运行正常。
了解了问题的定位和解决方式,其他问题也很容易在日志中发现和解决,问题可能是磁盘空间少,用户权限错误或者其他原因。
Gitlab 修改root用户密码
使用rails工具打开终端
sudo gitlab-rails console production
查询用户的email,用户名,密码等信息,id:1 表示root账号
user = User.where(id: 1).first
重新设置密码
user.password = ‘新密码‘ user.password_confirmation = ‘新密码‘
保存密码
user.save!
完整的操作ruby脚本
user = User.where(id: 1).first user.password = ‘新密码‘ user.password_confirmation = ‘新密码‘ user.save!
然后使用重置过的密码重新登录。
Done.
标签:sid 常用 console 依赖包 where open contact nis ruby
原文地址:http://www.cnblogs.com/voipman/p/gitlab.html