siteac
siteac

Reputation: 31

Openshift Error 503 after rails deployment

Currently, I'm trying to deploy an application on Openshift, developed on Rails 4 and Ruby 2.

After deployment, the browser return error 503. After reading the log ... I understand nothing !

==> 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"?

And here it's my 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'

Thank you very much to help me if you have an idea :)

Upvotes: 0

Views: 605

Answers (2)

siteac
siteac

Reputation: 31

Founded ;)

It was a mistake of copy/paste from a tutorial on internet

in database.yml, it was

  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']%>

instead of

  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']%>

Upvotes: 2

TK-421
TK-421

Reputation: 10763

Well it looks like the web and database servers aren't running or are unable to be located based on the current configuration.

I'd look for tutorials or articles focused on OpenShift (if not in their own documentation and community--most hosts have tutorials and the like available).

Upvotes: 1

Related Questions