如何增加 gitlab CE lfs 文件大小限制以避免出现 500 个服务器错误?

How can I increase gitlab CE lfs file size limitation as to not get 500 server errors?

我正在使用出色的 sameersbn/gitlab 为我的工作设置自定义 gitlab 服务器。

所以我有一个荒谬的场景,我使用 git lfs 来存储 10-20 GB 范围内的文件,使用 gitlab ce v8.12.5 ,但我到处都看到 500 个服务器错误,我的上传无法完成。

问题:有人知道如何增加服务器端限制吗?

Note: This is not a 413 nginx issue, I've set the client_max_body_size 500G so it should be forwarding to gitlab just fine.

如果需要更多信息(例如日志文件等),我很乐意提供,请发表评论。

更新.1:

关于同一个问题似乎有一个相关的gitlab issue

更新.2

其他相关资源:

目前我的假设是 docker 容器中的链或代理服务器某处超时。

git bash: error: RPC failed; result = 18, HTP code = 200B | 1KiB/s

https://github.com/gitlabhq/gitlabhq/issues/694

所以我刚刚注意到 docker 映射设备 /dev/dm-7 变为 100% full 几乎在同一时间 gitlab 出错并出现 500.

现在我开始相信这不是 gitlab 的问题,而是 docker 的问题,而 gitlab 只是 运行 out of space.

谢谢你的时间,干杯。

问题 1

第一个主要问题是 ~/log/gitlab-workhorse.log

中的以下错误

error: handleStoreLfsObject: copy body to tempfile: unexpected EOF

此错误与 gitlab 本身无关,而是 docker 在其最新版本中已决定将默认容器大小从 100G/容器缩小到10G / 容器,这意味着每当我尝试上传大于 10GB 的文件时,gitlab 将尝试制作一个 临时文件 的大小为上传文件的大小(在我的例子中为 30GB)和随后由于 docker 容器中缺少 space 而出现上述错误消息。

我遵循了这个关于如何增加容器大小的优秀 guide,但它基本上归结为:

    sudo `which docker-compose` down

停止 运行 容器。

    sudo vim /etc/systemd/system/docker.service

并追加

    --sotrage-opt dm.basesize=100G

作为新基础图像的默认大小。现在,由于 docker 似乎存在当前问题,您必须

   sudo `which docker` rmi gitlab

假设您的图片名为 gitlab,并且

   sudo `which docker-compose` up

重新拉取图像并以适当的大小创建它。

If this still doesn't work try sudo systemctl restart docker.service as this seems to help when docker seems to not do what you asked it to do.

    sudo docker exec -it gitlab df -h

应该产生如下内容:

Filesystem                                                                                        Size  Used Avail Use% Mounted on

/dev/mapper/docker-253:1-927611-353ffe52e1182750efb624c81a3a040d5c054286c6c5b5f709bd587afc92b38f  100G  938M  100G   1% /

我不是 100% 确定所有这些设置都是必要的,但在解决下面的问题 2 时,我最终不得不在 docker-compose.yml

中也设置这些设置
    - GITLAB_WORKHORSE_TIMEOUT=60m0s
    - UNICORN_TIMEOUT=3600
    - GITLAB_TIMEOUT=3600

问题 2

除了将容器的大小从 10GB 调整为 100GB 之外,我还必须将以下内容添加到 运行 实例中:

原因是文件太大 (30GB+) 并且网络速度太慢 (10MB/s),上传时间比默认的 nginx 长,超时 504 Gateway Timeout .

    sudo docker exec -it /bin/bash

的 gitlab 容器的 vim.tiny /etc/nginx/nginx.conf:

    http {
    ...
      client_max_body_size 500G;
      proxy_connect_timeout       3600;
      proxy_send_timeout          3600;
      proxy_read_timeout          3600;
      send_timeout                3600;
    ...
    }

然后我重启了nginx。遗憾的是 service restart nginx 没有工作,我不得不:

    service stop nginx
    service start nginx

Note: I have a reverse proxy running on this server which catches all http requests, so I'm not certain, but I believe that all the settings that I added to the container's nginx config have to be duplicated on the proxy side

如果我已经离开了,或者您想了解如何准确地执行程序的某个部分发表评论并询问。这是一个皇家痛苦,我希望能帮助别人解决这个问题。