3

只需备份并重新安装即可。基本信息:

System information
System:     Ubuntu 12.04
Current User:   git
Using RVM:  no
Ruby Version:   2.0.0p247
Gem Version:    2.0.3
Bundler Version:1.3.5
Rake Version:   10.1.0

GitLab information
Version:    6.2.3
Revision:   b490fde
Directory:  /home/git/gitlab
DB Adapter: mysql2
URL:        https://git.XXXX.org
HTTP Clone URL: https://git.XXXX.org/some-project.git
SSH Clone URL:  git@git.XXXX.org:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    1.7.6
Repositories:   /home/git/repositories/
Hooks:      /home/git/gitlab-shell/hooks/
Git:        /usr/local/bin/git

如果我使用此命令检查状态:

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

一切正常,绿色。

Nginx 日志中没有发现错误。

在 gitlab/log/production.log 中找到错误日志(每次刷新网页时都会创建此错误):

Started GET "/" for 127.0.0.1 at 2013-11-12 22:23:24 -0800
Processing by DashboardController#show as HTML
Completed 401 Unauthorized in 5ms

Redis::ProtocolError ( Got 'H' as initial reply byte. If you're in a forking environment, such as Unicorn, you need to connect to Redis after forking. ):
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/connection/ruby.rb:257:in `format_reply'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/connection/ruby.rb:244:in `read'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:215:in `block in read'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:206:in `io'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:214:in `read'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:84:in `block in call'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:187:in `block (2 levels) in process'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:295:in `ensure_connected'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:177:in `block in process'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:256:in `logging'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:176:in `process'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis/client.rb:84:in `call'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis.rb:630:in `block in set'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis.rb:36:in `block in synchronize'
  /usr/local/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis.rb:36:in `synchronize'
  vendor/bundle/ruby/2.0.0/gems/redis-3.0.4/lib/redis.rb:629:in `set'
  vendor/bundle/ruby/2.0.0/gems/redis-store-1.1.4/lib/redis/store/interface.rb:9:in `set'
  vendor/bundle/ruby/2.0.0/gems/redis-store-1.1.4/lib/redis/store/ttl.rb:8:in `set'
  vendor/bundle/ruby/2.0.0/gems/redis-store-1.1.4/lib/redis/store/marshalling.rb:5:in `block in set'
  vendor/bundle/ruby/2.0.0/gems/redis-store-1.1.4/lib/redis/store/marshalling.rb:29:in `_marshal'
  vendor/bundle/ruby/2.0.0/gems/redis-store-1.1.4/lib/redis/store/marshalling.rb:5:in `set'
  vendor/bundle/ruby/2.0.0/gems/redis-rack-1.4.4/lib/rack/session/redis.rb:31:in `block in get_session'
  vendor/bundle/ruby/2.0.0/gems/redis-rack-1.4.4/lib/rack/session/redis.rb:55:in `with_lock'
  vendor/bundle/ruby/2.0.0/gems/redis-rack-1.4.4/lib/rack/session/redis.rb:28:in `get_session'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:251:in `load_session'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/session/abstract_store.rb:49:in `block in load_session'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/session/abstract_store.rb:57:in `stale_session_check!'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/session/abstract_store.rb:49:in `load_session'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:135:in `load!'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:131:in `load_for_write!'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:71:in `[]='
  vendor/bundle/ruby/2.0.0/gems/devise-2.2.5/lib/devise/failure_app.rb:176:in `store_location!'
  vendor/bundle/ruby/2.0.0/gems/devise-2.2.5/lib/devise/failure_app.rb:55:in `redirect'
  vendor/bundle/ruby/2.0.0/gems/devise-2.2.5/lib/devise/failure_app.rb:37:in `respond'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
  vendor/bundle/ruby/2.0.0/gems/devise-2.2.5/lib/devise/failure_app.rb:20:in `call'
  vendor/bundle/ruby/2.0.0/gems/devise-2.2.5/lib/devise/failure_app.rb:20:in `call'
  vendor/bundle/ruby/2.0.0/gems/devise-2.2.5/lib/devise/delegator.rb:5:in `call'
  vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:130:in `call_failure_app'
  vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:116:in `process_unauthenticated'
  vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:47:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
  vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
  vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__1837039011266915719__call__1965958118966391004__callbacks'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
  vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in `pass'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:172:in `rescue in lookup'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:168:in `lookup'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
  vendor/bundle/ruby/2.0.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
  vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each'
  vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:552:in `process_client'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:632:in `worker_loop'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:142:in `start'
  vendor/bundle/ruby/2.0.0/gems/unicorn-4.6.3/bin/unicorn_rails:209:in `<top (required)>'
  vendor/bundle/ruby/2.0.0/bin/unicorn_rails:23:in `load'
  vendor/bundle/ruby/2.0.0/bin/unicorn_rails:23:in `<main>'

/gitlab-shell/config.yml 的转储:

# GitLab user. git by default
user: git

# Url to gitlab instance. Used for api calls. Should end with a slash.
gitlab_url: "http://git.XXXX.org/"

http_settings:
#  user: someone
#  password: somepass
#   ca_file: /etc/ssl/certs
#   ca_path: /etc/ssl/localcerts
  self_signed_cert: false

# Repositories path
# Give the canonicalized absolute pathname,
# REPOS_PATH MUST NOT CONTAIN ANY SYMLINK!!!
# Check twice that none of the components is a symlink, including "/home".
repos_path: "/home/git/repositories"

# File used as authorized_keys for gitlab user
auth_file: "/home/git/.ssh/authorized_keys"

# Redis settings used for pushing commit notices to gitlab
redis:
  bin: /usr/bin/redis-cli
  host: 127.0.0.1
  port: 6379
  # socket: /tmp/redis.socket # Only define this if you want to use sockets
  namespace: resque:gitlab
  # rest of this file remain unchanged.

Nginx 配置文件:

upstream gitlab {
  server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
    listen 173.230.1.2:80;
    server_name git.XXXX.org;
    server_tokens off;
    root /nowhere; # this doesn't have to be a valid path since we are redirecting, you don't have to change it.
    rewrite ^ https://$server_name$request_uri permanent;
}
server {
  listen 173.230.1.2:443 ssl;         # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
  server_name git.XXXX.org;     # e.g., server_name source.example.com;
  server_tokens off;     # don't show the version number, a security best practice
  root /home/git/gitlab/public;

  ssl on;
  ssl_certificate /etc/ssl/localcerts/git.XXXX.org.crt;
  ssl_certificate_key /etc/ssl/localcerts/git.XXXX.org.key;
  ssl_ciphers RC4:HIGH:!aNULL:!MD5:!kEDH;
  ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers   on;

  # individual nginx logs for this gitlab vhost
  access_log  /var/log/nginx/gitlab_access.log;
  error_log   /var/log/nginx/gitlab_error.log;
  #rest of this file remain unchanges

Unicorn 配置文件的一部分:

working_directory "/home/git/gitlab" # available in 0.94.0+

# listen on both a Unix domain socket and a TCP port,
# we use a shorter backlog for quicker failover when busy
listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64
listen "127.0.0.1:6379", :tcp_nopush => true

根据日志,似乎独角兽抛出了 401 错误。任何熟悉 Gitlab 的人请帮助我。

顺便说一句,这是我第四次重新安装 Gitlab。

4

0 回答 0