• 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 日志
  • 相关阅读:
    python 脏话处理、特殊词汇过滤!
    计算机网络基础知识(非常详细)
    【csdn第十期竞赛】dp专场
    【C++】函数指针 ① ( 函数三要素 | 函数类型 | 函数指针类型 | 函数类型重命名 )
    RV1126 快速启动
    信息科学与技术导论
    Matlab中MException的使用
    【学习笔记37】BOM基本认识
    记录每天学习的新知识: Room
    谷歌云 | 零售行业的生成式 AI:如何跟上步伐并取得领先
  • 原文地址:https://blog.csdn.net/u013564470/article/details/125514323