• GitLab配置


    安装方式

    推荐宝塔 -> 软件商店 -> GitLab最新社区版

    修改域名/IP

    修改域名或者内网IP(可加端口号)
    sudo vi /etc/gitlab/gitlab.rb

    ## GitLab URL
    ##! URL on which GitLab will be reachable.
    ##! For more details on configuring external_url see:
    ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
    ##!
    ##! Note: During installation/upgrades, the value of the environment variable
    ##! EXTERNAL_URL will be used to populate/replace this value.
    ##! On AWS EC2 instances, we also attempt to fetch the public hostname/IP
    ##! address from AWS. For more details, see:
    ##! https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
    external_url 'http://xxx.xxx.xxx.xxx'
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    自动备份

    1、Gitlab备份配置修改。设定备份路径,备份权限以及备份保留时间。
    sudo vi /etc/gitlab/gitlab.rb

    gitlab_rails['manage_backup_path'] = true
    gitlab_rails['backup_path'] = "/home/gitlab/backups" 	//gitlab备份目录
    gitlab_rails['backup_archive_permissions'] = 0644 		//生成的备份文件权限
    gitlab_rails['backup_keep_time'] = 7776000 				//备份保留时间,秒计算 7776000 = 3600*24*30*3 = 90天
    
    • 1
    • 2
    • 3
    • 4

    2、启动定时任务,每天凌晨2点进行备份。
    sudo vi /etc/crontab

    # .---------------- minute (0 - 59)
    # |  .------------- hour (0 - 23)
    # |  |  .---------- day of month (1 - 31)
    # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
    # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
    # |  |  |  |  |
    # *  *  *  *  * user-name   command to be executed
      0  2  *  *  * root        /opt/gitlab/bin/gitlab-rake gitlab:backup:create
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    3、Ubuntu 系统启动定时任务,systemctl restart cron

    Nginx冲突

    1、修改启动脚本sudo vi /opt/gitlab/sv/nginx/run

    #!/bin/sh
    exec 2>&1
    
    cd /var/opt/gitlab/nginx
    exec chpst -P /opt/gitlab/embedded/sbin/gitlab-web -p /var/opt/gitlab/nginx
    
    • 1
    • 2
    • 3
    • 4
    • 5

    2、重新启动gitlab-ctl restart

    常用命令

    指令作用
    sudo gitlab-ctl reconfigure重新加载配置,每次修改/etc/gitlab/gitlab.rb文件之后执行
    sudo gitlab-ctl status查看 GitLab 状态
    sudo gitlab-ctl start启动 GitLab
    sudo gitlab-ctl stop停止 GitLab
    sudo gitlab-ctl restart重启 GitLab
    sudo gitlab-ctl tail查看所有日志
    sudo gitlab-ctl tail nginx/gitlab_acces.log查看 nginx 访问日志
    sudo gitlab-ctl tail postgresql查看 postgresql 日志
  • 相关阅读:
    波奇学C++:AVL树
    Vue高级--前后端分离
    jquery中的ajax请求方式的写法 & 重要且常用参数的释义 & ajax返回值,return获取不到数据值
    深入理解JVM虚拟机——Java内存模型结构之搞懂方法区
    QGraphicsItem图元坐标和在场景中的坐标(六)
    一个超经典 WinForm 卡死问题的再反思
    origin软件怎么找某条曲线斜率最大值处?
    WPF中使用LibVLCSharp.WPF 播放rtsp
    数组进阶提高
    React封装自定义表单校验方法
  • 原文地址:https://blog.csdn.net/u013564470/article/details/125514323