2014-11-14 43 views
2

我与综合安装程序安装GitLab,现在我有我成为一个HTTP 500错误,当我尝试去网站上的问题。我使用nginx的Web服务器作为和gitlab是端口8000GitLab 7.4.3 HTTP码500:无法连接到服务器

这是错误消息我在production.log下可达:

==> ./gitlab/gitlab-rails/production.log <== 
Started GET "/" for 212.227.35.68 at 2014-11-14 10:15:07 -0600 

PG::Error (could not connect to server: No such file or directory 
Is the server running locally and accepting 
connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 
): 

activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:881:in `initialize' 
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:881:in `new' 
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:881:in `connect' 
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:568:in `initialize' 
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new' 
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout' 
/opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection' 
/opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection' 
activerecord (4.1.1) lib/active_record/connection_handling.rb:113:in `retrieve_connection' 
activerecord (4.1.1) lib/active_record/connection_handling.rb:87:in `connection' 
activerecord (4.1.1) lib/active_record/query_cache.rb:51:inn`restore_query_cache_settings' 
activerecord (4.1.1) lib/active_record/query_cache.rb:43:in `rescue in call' 
activerecord (4.1.1) lib/active_record/query_cache.rb:32:in `call' 
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call' 
actionpack (4.1.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' 
activesupport (4.1.1) lib/active_support/callbacks.rb:82:in `run_callbacks' 
actionpack (4.1.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
actionpack (4.1.1) lib/action_dispatch/middleware/remote_ip.rb:76:in `call' 
actionpack (4.1.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' 
actionpack (4.1.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 
railties (4.1.1) lib/rails/rack/logger.rb:38:in `call_app' 
railties (4.1.1) lib/rails/rack/logger.rb:20:in `block in call' 
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `block in tagged' 
activesupport (4.1.1) lib/active_support/tagged_logging.rb:26:in `tagged' 
activesupport (4.1.1) lib/active_support/tagged_logging.rb:68:in `tagged' 
railties (4.1.1) lib/rails/rack/logger.rb:20:in `call' 
actionpack (4.1.1) lib/action_dispatch/middleware/request_id.rb:21:in `call' 
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call' 
rack (1.5.2) lib/rack/runtime.rb:17:in `call' 
rack (1.5.2) lib/rack/lock.rb:17:in `call' 
rack (1.5.2) lib/rack/sendfile.rb:112:in `call' 
railties (4.1.1) lib/rails/engine.rb:514:in `call' 
railties (4.1.1) lib/rails/application.rb:144:in `call' 
railties (4.1.1) lib/rails/railtie.rb:194:in `public_send' 
railties (4.1.1) lib/rails/railtie.rb:194:in `method_missing' 
rack (1.5.2) lib/rack/builder.rb:138:in `call' 
rack (1.5.2) lib/rack/urlmap.rb:65:in `block in call' 
rack (1.5.2) lib/rack/urlmap.rb:50:in `each' 
rack (1.5.2) lib/rack/urlmap.rb:50:in `call' 
unicorn (4.6.3) lib/unicorn/http_server.rb:552:in `process_client' 
unicorn-worker-killer (0.4.2) lib/unicorn/worker_killer.rb:51:in `process_client' 
unicorn (4.6.3) lib/unicorn/http_server.rb:632:in `worker_loop' 
unicorn (4.6.3) lib/unicorn/http_server.rb:500:in `spawn_missing_workers' 
unicorn (4.6.3) lib/unicorn/http_server.rb:142:in `start' 
unicorn (4.6.3) bin/unicorn:126:in `<top (required)>' 
/opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `load' 
/opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/unicorn:23:in `<main>' 

这里我nginx的默认页配置:

server { 
    listen 8000; ## listen for ipv4; this line is default and implied 
    listen [::]:8000 default_server ipv6only=on; ## listen for ipv6 

    root /usr/share/nginx/www; 
    index index.html index.htm; 

    # Make site accessible from http://localhost/ 
    server_name localhost; 

    location/{ 
      # First attempt to serve request as file, then 
      # as directory, then fall back to displaying a 404. 
      try_files $uri $uri/ /index.html; 
      # Uncomment to enable naxsi on this location 
      # include /etc/nginx/naxsi.rules 
    } 

    location /doc/ { 
      alias /usr/share/doc/; 
      autoindex on; 
      allow 127.0.0.1; 
      allow ::1; 
      deny all; 
    } 
} 

而且gitlab.rb配置文件:

# Change the external_url to the address your users will type in their browser 
external_url 'http://gitlab.domain.com:8000' 

# External URL to reach the GitLab CI Coordinator at 
ci_external_url 'http://ci.domain.com:8000' 

一切上Debian的7秒运行erver和我安装了实际的gitlab版本7.4.3。 安装过程后,我修改了gitlab.rb startet重新配置为gitlab gitlab-ctl reconfigure。之后,我用gitlab-ctl start开始了gitlab。

编辑: 我已测试打开CI的网站,但也有相同的错误消息。

+0

也许相关:http://stackoverflow.com/questions/26859660/change-port-gitlab-on-centos-6-not-successfully如果只是发生在一个自定义的端口上,把它添加到标题。 – 2014-11-14 18:29:39

+0

不,这没有帮助我。错误是一样的,防火墙没有问题。 – Rinma 2014-11-14 19:36:25

回答

0

在你的db服务器的问题。 Rails应用程序试图通过Unix域套接字“/tmp/.s.PGSQL.5432”访问?

显示您PG设置和database.yml的 大概PG只监听TCP套接字,但不是UNIX。你应该配置它。

+0

Database.yml: '#这个文件由gitlab-ctl管理。手动更改将 #擦除!要更改下面的内容,请编辑/etc/gitlab/gitlab.rb #并运行'sudo gitlab-ctl reconfigure'。 生产: 适配器:PostgreSQL的 编码:统一 数据库:gitlabhq_production 池:10 用户名: 'gitlab' 密码: 主持人: 端口:5432 插座:' – Rinma 2014-11-15 15:46:09

+0

所以你应该修改你的database.yml,以使用TCP,与主机和端口从Gitlab设置 – 2014-11-15 15:47:34

+0

当我将其设置为tcp postgresql无法启动了。 – Rinma 2014-11-15 16:28:24

2

我已经找到了一个解决这个问题,但我创建了一个新的问题。 首先解决:

的gitlab安装搜索/tmp/.s.PGSQL.5432下的文件,我可以找到/var/run/postgresql/.s.PGSQL.5432下的文件,所以我创建了一个链接与ln -s /var/run/postgresql/.s.PGSQL.5432 /tmp/.s.PGSQL.5432现在的错误不会再出现。

下一个错误说有对PostgreSQL没有gitlab用户,但我已经创建了一个。看看这篇文章: Gitlab 7.4.3: PG::Error Peer-Authentifizierung fehlgeschlagen

0

我有同样的问题,发现为我工作更激进的方法:

sudo gitlab-ctl stop 

mv /var/opt/gitlab/postgresql /var/opt/gitlab/postgresql.bak 

sudo gitlab-ctl reconfigure 
sudo gitlab-ctl start 

由于PostgreSQL的文件是“腐败”在某些方面,Gitlab只是他们再生。我所有的旧数据(设置,用户,存储库和评论)仍然存在。