nginx - 带有 nginx 代理的 Gitlab 8 无法下载 zip,将公共(public)仓库克隆为访客,也无法在 CI 中构建

标签 nginx gitlab gitlab-ci gitlab-8

我认为所有 3 个问题都与同一个问题有关,所以我将把它们都放在这里。
Gitlab 本身正在运行,我什至设法将它从 8.2.2 更新到 8.2.3。
当我拥有正确的 ssh key 时,我可以创建项目、推送我的代码、拉取它、重新克隆它等等。
但:

  • 我无法将代码下载为 zip 文件,取而代之的是 JSON:

  • {"RepoPath":"/var/opt/gitlab/git-data/repositories/me/myrepo.git", "ArchivePrefix": "...


  • 人们无法克隆我的公共(public)存储库(空存储库错误)。
  • CI 无法构建我的测试:

  • warning: You have cloned an empty repository. Checking out 12345 as develop... fatal: reference is not a tree : 123456789mycommithash987654321

    ERROR: Build failed with: exit status 1


    注意:我翻译了法语错误信息。
    我想问题出在我的 Nginx 配置中,但是有太多文档我不确定哪一个是好的:那些有主力的,那些当我必须更改 gitlab.rb 的 gitlab_git_http_server 时,等等。
    我的配置如下:
  • Gitlab 8.2.3
  • Ubuntu Trusty (14.04)
  • Nginx 1.8

  • 我的 gitlab 托管在使用 SLL 的子域上,所以我添加了一个 Nginx 代理
    /etc/gitlab/gitlab.rb :
    external_url 'https://gitlab.mydomain.com'
    nginx['listen_addresses'] = ['127.0.0.1', "[::1]"]
    nginx['listen_port'] = 8080 
    nginx['listen_https'] = false 
    
    /etc/nginx/site_enabled/gitlab :
    server {
      listen *:80 default_server;
      listen [::]:80 ipv6only=on default_server;
      server_name gitlab.mydomain.com;
      return 301 https://$server_name$request_uri;
    
      access_log  /var/log/nginx/gitlab_access.log;
      error_log   /var/log/nginx/gitlab_error.log;
    }
    
    server{
      # listen 443 ssl;
      listen 0.0.0.0:443 ssl default_server;
      listen [::]:443 ipv6only=on ssl default_server; 
      server_name gitlab.mydomain.com;
      server_tokens off;
    
      location /{
        proxy_pass http://localhost:8080;
        proxy_redirect off;
        proxy_set_header    Host                $http_host;
        proxy_set_header    X-Real-IP           $remote_addr;
        proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto   $scheme;
      }
    
      location ~ ^/(assets)/ {
        root /opt/gitlab/embedded/service/gitlab-rails/public;
        gzip_static on; # to serve pre-gzipped version
        expires max;
        add_header Cache-Control public;
      }
    
      client_max_body_size 250m;
    
      # ...
      # A lot a of SSL stuff (HSTS, OCSP, dhparam, etc)
      # ...
    
      access_log  /var/log/nginx/gitlab_access.log;
      error_log   /var/log/nginx/gitlab_error.log;
      
      error_page 502 /502.html;
    
    更新:
    刚刚将 Gilab 升级到 8.3.0。
    现在 Git 一个 502。
    申请:https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/8.2-to-8.3.md
    我们拭目以待。
    更新 2:
    毕竟没有完成指令,停止一切并重新启动一切(Gitlab 和 Nginx) 终于设法让事情正常工作。
    CI/Zip/PublicCloning 仍然存在同样的问题。
    更新 3:
    只需更新到 8.2.3apt-get updateapt-get install gitlab-ce502.
    重启 nginx
    gitlab-ctl 重启
    gitlab-rake gitlab:app:check
    Checking GitLab ...
    
    Git configured with autocrlf=input? ... yes
    Database config exists? ... yes
    Database is SQLite ... no
    All migrations up? ... yes
    Database contains orphaned GroupMembers? ... no
    GitLab config exists? ... yes
    GitLab config outdated? ... no
    Log directory writable? ... yes
    Tmp directory writable? ... yes
    Uploads directory setup correctly? ... yes
    Init script exists? ... skipped (omnibus-gitlab has no init script)
    Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
    projects have namespace: ... 
    
    Redis version >= 2.8.0? ... yes
    Ruby version >= 2.1.0 ? ... yes (2.1.7)
    Your git bin path is "/opt/gitlab/embedded/bin/git"
    Git version >= 1.7.10 ? ... yes (2.6.1)
    Active users: 2
    
    Checking GitLab ... Finished
    

    如果有人可以引导我找到正确的文档或进行更改,那就太棒了。

    最佳答案

    看起来 ZIP 文件的下载现在由 gitlab-workhorse 处理。

    为此,在 nginx-configfile 中有一些额外的东西。您可能想看看 https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/support/nginx/gitlab有节的地方

    upstream gitlab-workhorse {
      server unix:/home/git/gitlab/tmp/sockets/gitlab-workhorse.socket fail_timeout=0;
    }
    

    和一个
    proxy_pass http://gitlab-workhorse;
    

    在配置结束时。

    我目前正在研究同样的问题,并会在我解决后报告。

    关于nginx - 带有 nginx 代理的 Gitlab 8 无法下载 zip,将公共(public)仓库克隆为访客,也无法在 CI 中构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34342035/

    相关文章:

    git - 尽管删除了 .gitignore 仍然没有忽略文件

    git - RPC失败; HTTP 400 curl 22 请求的 URL 返回错误 : 400 Bad Request

    gitlab-ci - GitLab CI : reuse the same image in two independent parallel jobs

    docker 注册表和 nginx - 实体太大 - client_max_body_size 无效

    ssl - MyDomain.com 仅提供正向 SSL 证书的可复制文本 : one for cert and one for key. 如何在我的 nginx Web 服务器上安装它?

    ssh - 不要在 GitLab 中使用 ssh

    python - 使用 GitLab CI 和 Python 'onbuild' 镜像,requirements.txt 中的包似乎没有安装

    arrays - 如何将 GitLab CI 变量设置为 gitlab-ci 中的数组?

    Rest api 的 nginx 服务器 block 属性 'root'

    laravel - 使用反向代理Nginx时出现502错误的网关