centos7部署gitlab遇到的坑
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7部署gitlab遇到的坑相关的知识,希望对你有一定的参考价值。
####################################################################################~~~~ 填坑之路 - 开始 ~~~~~~~~
问题一:安装GitLab出现ruby_block[supervise_redis_sleep] action run
参考地址:https://www.cnblogs.com/springwind2006/p/6872773.html
注:在卸载gitlab然后再次安装执行sudo gitlab-ctl reconfigure的时候往往会出现:ruby_block[supervise_redis_sleep] action run,会一直卡无法往下进行!
解决方案:
1、按住CTRL+C强制结束
2、运行:sudo systemctl restart gitlab-runsvdir
3、再次执行:sudo gitlab-ctl reconfigure
解决方案参考来源:https://gitlab.com/gitlab-org/omnibus-gitlab/issues/160
自己爬的坑:
1、通过企业邮箱发送邮件配置
/etc/gitlab/gitlab.rb
[[email protected] gitlab]# egrep -v ‘^$|^#‘ gitlab.rb
external_url ‘http://47.xx.xx.xx‘
gitlab_rails[‘gitlab_email_enabled‘] = true
gitlab_rails[‘gitlab_email_from‘] = ‘[email protected]‘
gitlab_rails[‘gitlab_email_display_name‘] = ‘Example‘
gitlab_rails[‘gitlab_email_reply_to‘] = ‘[email protected]‘
gitlab_rails[‘gitlab_email_subject_suffix‘] = ‘‘
gitlab_rails[‘gitlab_username_changing_enabled‘] = true
gitlab_rails[‘gitlab_default_theme‘] = 2
gitlab_rails[‘gitlab_default_projects_features_issues‘] = true
gitlab_rails[‘gitlab_default_projects_features_merge_requests‘] = true
gitlab_rails[‘gitlab_default_projects_features_wiki‘] = true
gitlab_rails[‘gitlab_default_projects_features_snippets‘] = true
gitlab_rails[‘gitlab_default_projects_features_builds‘] = true
gitlab_rails[‘gitlab_default_projects_features_container_registry‘] = true
gitlab_rails[‘gravatar_plain_url‘] = ‘http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon‘
gitlab_rails[‘gravatar_ssl_url‘] = ‘https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon‘
gitlab_rails[‘smtp_enable‘] = true
gitlab_rails[‘smtp_address‘] = "smtp.xxchina.com"
gitlab_rails[‘smtp_port‘] = 465
gitlab_rails[‘smtp_user_name‘] = "[email protected]"
gitlab_rails[‘smtp_password‘] = "*****"
gitlab_rails[‘smtp_domain‘] = "xxgroup.com"
gitlab_rails[‘smtp_authentication‘] = "login"
gitlab_rails[‘smtp_enable_starttls_auto‘] = true
gitlab_rails[‘smtp_tls‘] = truenginx[‘listen_port‘] = 6868 #这个是因为有其他应用占用了80端口了,顾调整了一下
。
[[email protected] gitlab]#
调整完之后发现并不能发送邮件。通过百度,阿里云帮助文档等等。做了以下调整。
1、通过postfix发送邮件,但是阿里云服务器默认将25号端口禁止了,按照常用配置会使用25号端口发送,这样会导致发不出邮件。
调整方法:
一、使用smtp 的465 端口来发送邮件。
1、修改配置文件:vim /etc/services (直接在25端口下增加即可)
smtp 25/tcp mail
smtp 25/udp mail
smtp2 465/tcp mail2
smtp2 465/udp mail2
二、调整postfix的配置文件
/etc/postfix/master.cf (增加一行)
smtp inet n - n - - smtpd
smtp2 inet n - n - - smtpd
调整完后重启postfix:systemctl restart postfix
三、虽然可以发送邮件了
但是,你点击设置密码时跳转的url
如下图所示:
调整策略:
修改gitlab.yml文件
cd /opt/gitlab/embedded/service/gitlab-rails/config
vim gitlab.yml
修改gitlab
host:要修改的IP
port:要修改的端口 默认是80,调整为你的6868端口。
然后重启gitlab ,记住是重启,不是gitlab-ctl reconfigure ,如果使用reconfigure将会使gitlab回到最初的状态。
gitlab-ctl restart
重启之后,在发送邮件就可以使用了。
问题三:gitlab迁移遇到问题:
You will lose any data stored in authorized_keys file.
Do you want to continue (yes/no)? yes
导入时的坑 提示导入的时候不存在文件。
[[email protected] gitlab]# cd backups/
[[email protected] backups]# ls
1534319495_2018_08_15_10.1.3_gitlab_backup.tar
[[email protected] repositories]# gitlab-ctl restart
ok: run: gitaly: (pid 25131) 1s
ok: run: gitlab-monitor: (pid 25142) 0s
ok: run: gitlab-workhorse: (pid 25149) 1s
ok: run: logrotate: (pid 25173) 0s
ok: run: nginx: (pid 25198) 0s
ok: run: node-exporter: (pid 25206) 1s
ok: run: postgres-exporter: (pid 25212) 0s
ok: run: postgresql: (pid 25218) 1s
ok: run: prometheus: (pid 25226) 0s
ok: run: redis: (pid 25236) 1s
ok: run: redis-exporter: (pid 25240) 0s
ok: run: sidekiq: (pid 25247) 0s
ok: run: unicorn: (pid 25254) 1s
[[email protected] repositories]# gitlab-ctl stop unicorn
ok: down: unicorn: 1s, normally up
[[email protected] repositories]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up
[[email protected] git-data]# gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1534319495
The backup file 1534319495_gitlab_backup.tar does not exist!注意:必须要写上_gitlab_backup.tar前面所有的字符
[[email protected] git-data]# gitlab-rake gitlab:backup:restore RAILS_ENV=production BACKUP=1534319495_2018_08_15_10.1.3
You will lose any data stored in authorized_keys file.
Do you want to continue (yes/no)? yes
~~~~ 填坑之路- 结束 ~~~~~~~~
####################################################################################
以上是关于centos7部署gitlab遇到的坑的主要内容,如果未能解决你的问题,请参考以下文章