Rails website is down after a server reboot

55 views
Skip to first unread message

Ead

unread,
Apr 17, 2014, 10:25:38 AM4/17/14
to rubyonra...@googlegroups.com
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
 

Frederick Cheung

unread,
Apr 17, 2014, 10:28:45 AM4/17/14
to rubyonra...@googlegroups.com
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

Ead

unread,
Apr 17, 2014, 10:45:50 AM4/17/14
to rubyonra...@googlegroups.com
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'

Mike Villa

unread,
Apr 17, 2014, 11:05:03 AM4/17/14
to rubyonra...@googlegroups.com
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

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b7a4f0b6-0b38-44da-9317-1d1109a050fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ead

unread,
Apr 17, 2014, 11:12:33 AM4/17/14
to rubyonra...@googlegroups.com
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 `<main>'
(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

Tommaso Visconti

unread,
Apr 17, 2014, 11:14:23 AM4/17/14
to rubyonra...@googlegroups.com
are you sure the app works outside the server (e.g. in your development machine)?


Ead

unread,
Apr 17, 2014, 11:20:18 AM4/17/14
to rubyonra...@googlegroups.com
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.

Tommaso Visconti

unread,
Apr 17, 2014, 11:27:30 AM4/17/14
to rubyonra...@googlegroups.com
Check line 16 in app/controllers/static_pages_
controller.rb, that line produces the query which causes the error.



Hassan Schroeder

unread,
Apr 17, 2014, 11:36:45 AM4/17/14
to rubyonrails-talk
On Thu, Apr 17, 2014 at 7:45 AM, Ead <dai...@gmail.com> wrote:

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

--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

Ead

unread,
Apr 17, 2014, 11:38:51 AM4/17/14
to rubyonra...@googlegroups.com
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

Colin Law

unread,
Apr 17, 2014, 11:38:48 AM4/17/14
to rubyonra...@googlegroups.com
On 17 April 2014 16:12, Ead <dai...@gmail.com> wrote:
> 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)

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

Dai Nish

unread,
Apr 17, 2014, 11:43:39 AM4/17/14
to rubyonra...@googlegroups.com
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




--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/dlzs7ngycmI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-ta...@googlegroups.com.

To post to this group, send email to rubyonra...@googlegroups.com.

Hassan Schroeder

unread,
Apr 17, 2014, 12:45:17 PM4/17/14
to rubyonrails-talk
On Thu, Apr 17, 2014 at 8:43 AM, Dai Nish <dai...@gmail.com> wrote:

> 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.

>> Are you connecting to the correct database instance?

Ead

unread,
Apr 17, 2014, 5:58:43 PM4/17/14
to rubyonra...@googlegroups.com
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

Ead

unread,
Apr 17, 2014, 6:13:40 PM4/17/14
to rubyonra...@googlegroups.com
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

Ead

unread,
Apr 17, 2014, 7:25:44 PM4/17/14
to rubyonra...@googlegroups.com
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...

Ead

unread,
Apr 17, 2014, 10:03:50 PM4/17/14
to rubyonra...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages