尝试拉/推时Gitlab错误502

时间:2017-10-12 12:44:42

标签: git nginx debian gitlab

所以这是一个相当长的故事,希望你坚持下去。

Debian 8.一旦我使用非捆绑的nginx服务器(子域)进行了gitlab-ce安装,我使用“gitlab-ctl uninstall”卸载了它。

然后一周前我安装了gitlab-ee而没有再次检查或更改任何配置 - 首先它看起来很好,但仍然可以从子域访问。 然后我想推动一个项目 - 错误502,哦是的我使用cloudflare(端口22被阻止) - 切换到http,再次尝试 - 错误502. F * ck。

2小时谷歌和20个潜在的stackoverflow / gitlab_issue修复后来我有更糟糕的错误,没有任何东西可以工作,我累了。 所以我重新振作起来,希望得到帮助。

Nginx主要的git配置:

upstream gitlab-workhorse {
  server unix://var/opt/gitlab/gitlab-workhorse/socket fail_timeout=0;
}

server {
  listen *:8080;
  server_name [domain].me
  server_tokens off;
  root /opt/gitlab/embedded/service/gitlab-rails/public;

  client_max_body_size 250m;

  access_log  /var/log/gitlab/nginx/gitlab_access.log;
  error_log   /var/log/gitlab/nginx/gitlab_error.log;

  # Ensure Passenger uses the bundled Ruby version
  passenger_ruby /opt/gitlab/embedded/bin/ruby;

  # Correct the $PATH variable to included packaged executables
  passenger_env_var PATH "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/usr/local/bin:/usr/bin:/bin";

  # Make sure Passenger runs as the correct user and group to
  # prevent permission issues
  passenger_user git;
  passenger_group git;

  # Enable Passenger & keep at least one instance running at all times
  passenger_enabled on;
  passenger_min_instances 1;

  location ~ ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ {
    # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
    error_page 418 = @gitlab-workhorse;
    return 418;
  }

  location ~ ^/[\w\.-]+/[\w\.-]+/repository/archive {
    # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
    error_page 418 = @gitlab-workhorse;
    return 418;
  }

  location ~ ^/api/v3/projects/.*/repository/archive {
    # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
    error_page 418 = @gitlab-workhorse;
    return 418;
  }

  # Build artifacts should be submitted to this location
  location ~ ^/[\w\.-]+/[\w\.-]+/builds/download {
      client_max_body_size 0;
      # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
      error_page 418 = @gitlab-workhorse;
      return 418;
  }

  # Build artifacts should be submitted to this location
  location ~ /ci/api/v1/builds/[0-9]+/artifacts {
      client_max_body_size 0;
      # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
      error_page 418 = @gitlab-workhorse;
      return 418;
  }

  # Build artifacts should be submitted to this location
  location ~ /api/v4/jobs/[0-9]+/artifacts {
      client_max_body_size 0;
      # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
      error_page 418 = @gitlab-workhorse;
      return 418;
  }


  # For protocol upgrades from HTTP/1.0 to HTTP/1.1 we need to provide Host header if its missing
  if ($http_host = "") {
  # use one of values defined in server_name
    set $http_host_with_default "git.example.com";
  }

  if ($http_host != "") {
    set $http_host_with_default $http_host;
  }

  location @gitlab-workhorse {

    ## https://github.com/gitlabhq/gitlabhq/issues/694
    ## Some requests take more than 30 seconds.
    proxy_read_timeout      3600;
    proxy_connect_timeout   300;
    proxy_redirect          off;

    # Do not buffer Git HTTP responses
    proxy_buffering off;

    proxy_set_header    Host                $http_host_with_default;
    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;

    proxy_pass http://gitlab-workhorse;

    ## The following settings only work with NGINX 1.7.11 or newer
    #
    ## Pass chunked request bodies to gitlab-workhorse as-is
    # proxy_request_buffering off;
    # proxy_http_version 1.1;
  }

  ## Enable gzip compression as per rails guide:
  ## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
  ## WARNING: If you are using relative urls remove the block below
  ## See config/application.rb under "Relative url support" for the list of
  ## other files that need to be changed for relative url support
  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;
  }

  error_page 502 /502.html;
}

Nginx子域git config:

server {
    listen 80;
    server_name git.[domain].me;

    location / {
        proxy_pass http://localhost:8181;
    } 
}

/etc/gitlab/gitlab.rb修改后的行:

external_url 'http://[domain].me:8080'

web_server['external_users'] = ['www-data']

gitlab_rails['internal_api_url'] = 'http://[domain].me:8080'

unicorn['enable'] = false

nginx['enable'] = false

gitlab-ctl尾部错误:

  

==> / var / log / gitlab / gitlab-workhorse / current< ==       2017-10-12_12:02:05.54645 2017/10/12 14:02:05错误:GET“”:badgateway:0s后失败:拨打unix   /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket:connect:没有这样的   文件或目录

也许有人可以帮助我...我对人性失去信心。 并且不敢告诉我只需重新配置,重新启动,重新加载或重新安装。我至少完成了所有这两次。

编辑*:还有一些gitlab Dev(@ibaum)告诉我:“看起来你正试图使用​​乘客而不是独角兽。而且基于日志,看起来这就是问题的原因。这不是我们支持的配置。“ 我不知道他在说什么,以及这些都做了什么。我只是想让它运转起来。

0 个答案:

没有答案