Rails website is down after a server reboot

Hello everyone

I am desperately in need of help because a website created by Ruby on Rails has gone down after remotely rebooting a VPS server.

The site is this: http://offeriland.com/

I could not let update reflect in the site, so I rebooted the site using the web host’s remote VPS control system. The site now only displays ’ We’re sorry, but something went wrong.’

I have searched across the web for a solution with no luck.

Please someone do help me.

Best regards,

Ead

This isn’t solvable without more information. The first step would for you to take a look at the logfiles for the application (by default this will be in log/production.log in the folder where the rails app is checked out). This should have more information about the error. For example perhaps one of the services on the server didn’t start up when you restarted the server.

Fred

Thank you so much for the reply. The below is the top portion of the production.log.
It shows 500 Internal Server Error at the 5th line from the top. I don’t understand the cause of the error because

hardly anything has changed since the time before the boot. I would be every so grateful if you would could suggest any potential solutions.

Connecting to database specified by database.yml

Connecting to database specified by database.yml

Started GET “/teaser” for 153.120.196.200 at 2013-07-11 17:26:20 +0900

Processing by StaticPagesController#register as HTML

Completed 500 Internal Server Error in 109ms

ActiveRecord::StatementInvalid (PG::Error: ERROR: relation “registers” does not exist

LINE 5: WHERE a.attrelid = ‘“registers”’::regclass

^

: SELECT a.attname, format_type(a.atttypid, a.atttypmod),

pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod

FROM pg_attribute a LEFT JOIN pg_attrdef d

ON a.attrelid = d.adrelid AND a.attnum = d.adnum

WHERE a.attrelid = ‘“registers”’::regclass

AND a.attnum > 0 AND NOT a.attisdropped

ORDER BY a.attnum

):

app/controllers/static_pages_controller.rb:16:in `new’

app/controllers/static_pages_controller.rb:16:in `register’

Started GET “/teaser” for 153.120.196.200 at 2013-07-11 17:26:22 +0900

Processing by StaticPagesController#register as HTML

Completed 500 Internal Server Error in 113ms

ActiveRecord::StatementInvalid (PG::Error: ERROR: relation “registers” does not exist

LINE 5: WHERE a.attrelid = ‘“registers”’::regclass

^

: SELECT a.attname, format_type(a.atttypid, a.atttypmod),

pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod

FROM pg_attribute a LEFT JOIN pg_attrdef d

ON a.attrelid = d.adrelid AND a.attnum = d.adnum

WHERE a.attrelid = ‘“registers”’::regclass

AND a.attnum > 0 AND NOT a.attisdropped

ORDER BY a.attnum

):

app/controllers/static_pages_controller.rb:16:in `new’

app/controllers/static_pages_controller.rb:16:in `register’

Started GET “/teaser” for 153.120.196.200 at 2013-07-11 17:26:23 +0900

Processing by StaticPagesController#register as HTML

Completed 500 Internal Server Error in 1ms

ActiveRecord::StatementInvalid (PG::Error: ERROR: relation “registers” does not exist

LINE 5: WHERE a.attrelid = ‘“registers”’::regclass

^

: SELECT a.attname, format_type(a.atttypid, a.atttypmod),

pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod

FROM pg_attribute a LEFT JOIN pg_attrdef d

ON a.attrelid = d.adrelid AND a.attnum = d.adnum

WHERE a.attrelid = ‘“registers”’::regclass

AND a.attnum > 0 AND NOT a.attisdropped

ORDER BY a.attnum

):

app/controllers/static_pages_controller.rb:16:in `new’

app/controllers/static_pages_controller.rb:16:in `register’

New migration? Check with the last engineer who checked in code. Might need to update ur database rake db:migrate. Someone who is familiar with or db should do that. Check with ur db admin first too

Thank you for the reply. Running rake db:migrate returns the message below:

rake aborted!

No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)

/home/tadashi-toyokura/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval’

/home/tadashi-toyokura/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `’

(See full trace by running task with --trace)

The other engineer has not done anything with the databases and I’m completely stuck. Some more advice would be deeply appreciated.

Best regards,

Ead

are you sure the app works outside the server (e.g. in your development machine)?

I could only run the website from the development and production branches of the VPS server as my local machine did not have an environment that could run Ruby files.
Before the reboot, the site ran perfectly from the server, so I just cannot start thinking how I could go about debugging this.

Check line 16 in app/controllers/static_pages_
controller.rb, that line produces the query which causes the error.

hardly anything has changed since the time before the boot.

Uh, "hardly anything"? Then you should go through each one of the
"hardly anythings" to be sure they're not causing this.

ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "registers" does
not exist

Are you connecting to the correct database instance?

Does your development instance run (and if so are you sure that it's
identical to the current production deployment)?

Do your tests run?

Were you in the correct folder when you run that. You should be in the
top level folder of the rails application (the folder with app,
config, db and so on).

Colin

Thank you, I appreciate the suggestion. I have checked the file under question and here’s the code up to the 16th line:

class StaticPagesController < ApplicationController

before_filter :hide_nav, only: [:forgots_password, :send_new_password, :client_forgots_password, :client_send_new_password]

before_filter :get_contents, only: [:home, :about_timeline, :user_about_timeline]

def about_timeline

if mobile_device?

render “static_pages/mobile/about_timeline”, layout: “application-mobile”

end

end

def user_about_timeline

if signed_in?

@user = current_user

@user_info = @user.user_info

@user_posts = @user.user_posts.includes(:user)

The line 16 says @user_posts = @user.user_posts.includes(:user) but I cannot figure what is incorrect with this no matter how.

Please help me understand what of the line could induce the error.

Thank you,

Ead

The only change made to the production environment was an addition of a CSS class to correct the layout of a breadcrumb list,
and I’m finding no difference between static_pages_controller.rb and other files. The test server is http://dev.offeriland.com:81/ being hosted in the same VPS server

and does not run likewise.

I don’t have a good knowledge of databases at all, so some more advice would be grateful.

Best regards,

Ead

I don't have a good knowledge of databases at all, so some more advice would
be grateful.

First piece of advice: stop top-posting, and answer the questions
already asked.

I’ve tried checked the database instance with Putty by running “psql mydb” in its terminal, but the message below was returned where xyz-abcde is the ID I entered to authenticate to the Linux server:

psql: FATAL: role “xyz-abcde” does not exist

The other engineer told me the server runs Postgres but I’m not familiar with database administration and advice on how to verify what database instance you’re connected to would be really appreciated.

Best regards,

Ead

Thank you. I’ve just changed the directory to ‘db’, run ‘rake db:migrate’ to find no error, then run ‘rake db:migrate RAILS_ENV=production’ to reflect any possible changes to the live server,
but the same error message ‘We’re sorry, but something went wrong’ still appears…

Regards,

Ead

Apologies, the code from static_pages_controller.rb below only shows up to line 15. Line 16 reads as follows:

@ordered_industries_name_hash = @user.ordered_industries_name_hash

I can’t understand what production.log is saying about this line…

It turns out that the server reboot had terminated Unicorn which failed to restart. Deleting unicorn.pid while making sure that this was not included in the processes restored the site.

Best regards,

Ead