美文网首页
05-Gitlab部署脚本

05-Gitlab部署脚本

作者: d4peng | 来源:发表于2020-09-15 16:16 被阅读0次
    # 创建交换虚拟内存(如果服务器比较差劲,服务器牛X的就忽略这一步)
    sudo dd if=/dev/zero of=/d4peng/swap bs=1M count=1024
    sudo mkswap /d4peng/swap
    sudo swapon /d4peng/swap
    sudo echo '/d4peng/swap swap swap defaults  0 0' >> /etc/fstab
    
    # gitlab挂载目录
    gitlabdir='/d4peng/docker/gitlab'
    mkdir -p $gitlabdir
    chmod -R 777 $gitlabdir
    
    # 创建gitlab容器镜像
    docker run --detach --publish 443:443 --publish 80:80 --publish 23:22 --name gitlab --restart always -v $gitlabdir/etc:/etc/gitlab -v $gitlabdir/logs:/var/log/gitlab -v $gitlabdir/data:/var/opt/gitlab --privileged=true gitlab/gitlab-ce
    
    # 修改配置
    sudo cat << EOF >> $gitlabdir/etc/gitlab.rb 
    external_url 'http://192.168.0.103'
    gitlab_rails['gitlab_ssh_host'] = '192.168.0.103'
    gitlab_rails['gitlab_shell_ssh_port'] = 23
    gitlab_rails['smtp_enable'] = true
    gitlab_rails['smtp_address'] = "smtp.qq.com"
    gitlab_rails['smtp_port'] = 465
    gitlab_rails['smtp_user_name'] = "977891526@qq.com"
    gitlab_rails['smtp_password'] = "glktygzrqgaxbbee"
    gitlab_rails['smtp_domain'] = "smtp.qq.com"
    gitlab_rails['smtp_authentication'] = "login"
    gitlab_rails['smtp_enable_starttls_auto'] = true
    gitlab_rails['smtp_tls'] = true
    gitlab_rails['gitlab_email_from'] = '977891526@qq.com'
    EOF
    
    
    # 重启Gitlab
    docker exec -it gitlab /bin/bash
    gitlab-ctl reconfigure
    exit
    

    相关文章

      网友评论

          本文标题:05-Gitlab部署脚本

          本文链接:https://www.haomeiwen.com/subject/jhmpektx.html