zoukankan      html  css  js  c++  java
  • docker部署GitLab

    1. 部署

    #设置一个临时变量docker run 的时候可用,后面的路径可根据自己需要更改
    GITLAB_HOME=/var/git-lab
    #启动容器,需要有一个端口与宿主机一同,不然发送邮件的时候那链接访问不了。
    #--hostname 改成自己主机的IP地址或者是域名,映射的端口根据自己的实际需要更改。其他的配置就就别更改了。
    docker run --detach 
      --hostname 10.228.81.113 
      --publish 10443:443 --publish 18000:18000 --publish 12200:22 
      --name gitlab 
      --restart always 
      --volume $GITLAB_HOME/config:/etc/gitlab 
      --volume $GITLAB_HOME/logs:/var/log/gitlab 
      --volume $GITLAB_HOME/data:/var/opt/gitlab 
      gitlab/gitlab-ce:latest
    

    2. 配置

    运行完毕可以访问后我们需要配置一下邮箱,往 gitlab.rb 配置文件中添加或者修改以下配置,我的是阿里云企业邮箱,用阿里云的可以参考我的,不是阿里云的smtp与我不同自行百度哈。

    ### Request duration
    ###! Tells the rails application how long it has to complete a request
    ###! This value needs to be lower than the worker timeout set in unicorn/puma.
    ###! By default, we'll allow 95% of the the worker timeout
    # gitlab_rails['max_request_duration_seconds'] = 57
    ### GitLab email server settings
    ###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
    ###! **Use smtp instead of sendmail/postfix.**
     #这个要配,不配会影响邮件中的链接地址
     external_url 'http://10.228.81.113:18000'
     gitlab_rails['smtp_enable'] = true
     
    #配置smtp服务器,运营商不同smtp服务器不同
     gitlab_rails['smtp_address'] = "smtp.qiye.aliyun.com"
     #配置smtp端口,这个是smtp默认端口不需要改,改了就访问不了了。
     gitlab_rails['smtp_port'] = 465
     #邮箱账号
     gitlab_rails['smtp_user_name'] = "demo@98records.top"
     #邮箱密码,国内的163、qq等是授权码
     gitlab_rails['smtp_password'] = "Passwdoo"
     #smtp域名,我是阿里云企业邮箱所以填的是@后面的一串
     gitlab_rails['smtp_domain'] = "98records.top"
     gitlab_rails['smtp_authentication'] = "login"
     gitlab_rails['smtp_enable_starttls_auto'] = true
     #建议开启tls,不开启测试的时候会报错
     gitlab_rails['smtp_tls'] = true
    
    

    3. 常用命令

    #重新加载配置文件
    gitlab-ctl reconfigure
    #测试邮箱配置是否成功
    gitlab-rails console
    Notify.test_email('test@demo.com', 'Message Subject test', 'Message Body test').deliver_now
    

    4. 参考链接

    官方文档

    错误参考

    邮箱配置参考一
    邮箱配置参考二

    公众号

  • 相关阅读:
    【Cocos2d-Js基础教学(3)各种基类的定义和使用】
    【Cocos2d-Js基础教学(2)类的使用和面向对象】
    【Cocos2d-x 3.X 资源及脚本解密】
    Django项目中使用Redis
    Django项目中使用Redis
    Django学习笔记二
    Django初识 学习笔记一
    前端之HTML(一)
    mysql(三) 数据表的基本操作操作
    python 词云小demo
  • 原文地址:https://www.cnblogs.com/98record/p/docker-bu-shugitlab.html
Copyright © 2011-2022 走看看