TiMa

  • Gitlab Docker部署gitaly启动失败问题

    在NAS上部署docker版gitlab,发现其他都正常,创建群组也正常,但是创建项目就会报500错误,

    Request ID: 01JXKP6NTCNM201KEGMSDHFJ2J

    查运行状态,gitaly未运行,有大量的gitaly错误日志,错误信息大致如下:

    {"error":"open /var/opt/gitlab/gitaly/gitaly.pid: permission denied","level":"fatal","msg":"find process","pid":3499,"time":"2025-06-13T14:56:03.048Z","wrapper":3499}
    
    unclean Gitaly shutdown: creating Git command factory: setting up Git execution environment: constructing Git environment: Checking bundled Git binary "gitaly-git-v2.49": permission denied
    {“level”:“warning”,“msg”:“The current configurations will cause Gitaly to fail to start up in future versions. Please run ‘gitaly configuration validate \u003c /var/opt/gitlab/gitaly/config.toml’ and fix the errors that are printed.”,“pid”:46135,“time”:“2025-06-13T14:59:34.981Z”}
    FAIL: 14:connections to all backends failing; last error: UNKNOWN: unix:/var/opt/gitlab/gitaly/gitaly.socket: No such file or directory

    换了好几个版本都是如此,经过大量查询和AI解释,都只解释了一半,主要与 GitLab 容器内 gitaly-git 二进制文件的权限或配置异常有关,也没有给准确的建议。这个问题的原因在于/var是一个受noexec保护的路径,禁止运行gitaly服务程序,而gitaly的运行目录正好位于:/var/opt/gitlab/gitaly/

    即便做了目录持久化挂载,给了读写权限,给了git用户/组权限,也会受目录保护影响,解决方案有两个:

    (更多…)

  • Centos常用命令1

    开发工具安装 yum groupinstall “Development tools”

     
     

    查看文件夹占用空间:

    du -h –max-depth=1

     
     

    apt-get install ubuntu-developer-tools-center

    yum install bash-completion 命令补全

     
     

    更新时间

    timedatectl

    设置时区

    timedatectl set-timezone Asia/Shanghai

    是否NTP服务器同步

    timedatectl set-ntp yes

    yum -y install ntp ntpdate

    设置系统时间与网络时间同步

    ntpdate cn.pool.ntp.org

     
     

    删除30天以前的log文件

    find /opt/soft/log/ -mtime +30 -name “*.log” -exec rm -rf {} \;

     
     

    shell脚本测试:

    测试脚本: sh -n ***.sh 

    检验脚本: sh -vx ***.sh


  • Gitlab 相关命令

    # 重新应用gitlab的配置

    gitlab-ctl reconfigure

     

    # 重启gitlab服务

    gitlab-ctl restart

     

    # 查看gitlab运行状态

    gitlab-ctl status

     

    #停止gitlab服务

    gitlab-ctl stop

     

    # 查看gitlab运行日志

    gitlab-ctl tail

     

    # 停止相关数据连接服务

    gitlab-ctl stop unicorn

    gitlab-ctl stop sideki

     

    创建备份:gitlab-rake gitlab:backup:create

     
     

    现在我们要从1522918586_2018_04_05_10.6.2这个备份编号中,恢复数据,命令如下:

    gitlab-rake gitlab:backup:restore BACKUP=1522918586_2018_04_05_10.6.2