目前,我正在尝试在OpenShift上部署一个应用程序,该应用程序是在Rails 4和Ruby 2上开发的。
部署后,浏览器返回错误503.阅读完日志后...我什么都不懂!
==> app-root/logs/haproxy.log <==
[WARNING] 339/190121 (168232) : Server express/local-gear is DOWN for maintenance.
[ALERT] 339/190121 (168232) : proxy 'express' has no server available!
[WARNING] 339/192303 (85750) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 339/192303 (85750) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 339/192303 (85750) : Server express/local-gear is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 339/192303 (85750) : proxy 'express' has no server available!
[WARNING] 339/192831 (85750) : Server express/local-gear is DOWN for maintenance.
[WARNING] 339/193130 (85750) : Server express/local-gear is UP (leaving maintenance).
[WARNING] 339/193135 (85750) : Server express/local-gear is DOWN, reason: Layer7 wrong status, code: 500, info: "HTTP status check returned code <3C>500<3E>", check duration: 2974ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 339/193135 (85750) : proxy 'express' has no server available!
==> app-root/logs/haproxy_ctld.log <==
I, [2014-12-06T16:33:35.228897 #4943] INFO -- : Starting haproxy_ctld
I, [2014-12-06T19:23:04.155191 #85764] INFO -- : Starting haproxy_ctld
==> app-root/logs/ruby.log <==
[ 2014-12-06 19:32:09.8929 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] vendor/bundle/ruby/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
[ 2014-12-06 19:32:09.8929 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] vendor/bundle/ruby/gems/railties-4.0.4/lib/rails/engine.rb:511:in `call'
[ 2014-12-06 19:32:09.8929 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] vendor/bundle/ruby/gems/railties-4.0.4/lib/rails/application.rb:97:in `call'
[ 2014-12-06 19:32:09.8929 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] /opt/rh/ruby200/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
[ 2014-12-06 19:32:09.8929 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] /opt/rh/ruby200/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
[ 2014-12-06 19:32:09.8930 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] /opt/rh/ruby200/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
[ 2014-12-06 19:32:09.8930 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] /opt/rh/ruby200/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'
[ 2014-12-06 19:32:09.8930 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout]
[ 2014-12-06 19:32:09.8930 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout]
- - - [06/Dec/2014:19:32:09 -0500] "GET / HTTP/1.0" 500 1266 "-" "-"
[ 2014-12-06 19:32:11.8974 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] Started GET "/" for 127.13.18.1 at 2014-12-06 19:32:11 -0500
[ 2014-12-06 19:32:11.9001 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout]
[ 2014-12-06 19:32:11.9001 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] PG::ConnectionBad (could not connect to server: No such file or directory
[ 2014-12-06 19:32:11.9001 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] Is the server running locally and accepting
[ 2014-12-06 19:32:11.9001 142942/7fd5e046b700 Pool2/Implementation.cpp:1274 ]: [App 143063 stdout] connections on Unix domain socket "/tmp/.s.PGSQL.61226"?
这是我的Gemfile
#source 'http://mirror.ops.rhcloud.com/mirror/ruby/'
source 'http://rubygems.org'
ruby '2.0.0'
gem 'rails_12factor', group: :production
gem 'rails_serve_static_assets', group: :production
#gem 'turbo-sprockets-rails3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.4'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.2'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby, group: :production
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Use allorails for Allopass Rails API plugin
gem 'allorails'
gem 'nokogiri'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
#gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem "active_model_serializers"
gem "ember-rails", "~>0.14"
gem "ember-source", "~>1.1"
gem 'foundation-rails'
gem 'devise'
gem 'ember_simple_auth-rails'
#gem "cancan"
# for AWS compatibility, multi_json downgrade
#gem 'multi_json', '1.7.8'
如果您有任何想法,非常感谢您的帮助:)
答案 0 :(得分:2)
成立;)
从互联网上的教程中复制/粘贴是错误的
在database.yml中,它是
adapter: postgresql
encoding: utf8
pool: 5
database: <%=ENV['OPENSHIFT_APP_NAME']%>
host: <%=ENV['$OPENSHIFT_POSTGRESQL_DB_HOST']%>
port: <%=ENV['$OPENSHIFT_POSTGRESQL_DB_PORT']%>
username: <%=ENV['OPENSHIFT_POSTGRESQL_DB_USERNAME']%>
password: <%=ENV['OPENSHIFT_POSTGRESQL_DB_PASSWORD']%>
而不是
adapter: postgresql
encoding: utf8
pool: 5
database: <%=ENV['OPENSHIFT_APP_NAME']%>
host: <%=ENV['OPENSHIFT_POSTGRESQL_DB_HOST']%>
port: <%=ENV['OPENSHIFT_POSTGRESQL_DB_PORT']%>
username: <%=ENV['OPENSHIFT_POSTGRESQL_DB_USERNAME']%>
password: <%=ENV['OPENSHIFT_POSTGRESQL_DB_PASSWORD']%>
答案 1 :(得分:1)
看起来Web和数据库服务器没有运行,或者根据当前配置无法定位。
我会寻找专注于OpenShift的教程或文章(如果不是在他们自己的文档和社区中 - 大多数主机都提供教程等)。