# Rails website is down after a server reboot

**URL:** <https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510>\
**Category:** Rails\
**Created:** [April 17, 2014, 4:27pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510 "2014-04-17T16:27:47Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [April 17, 2014, 4:27pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/1 "2014-04-17T16:27:47Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 4:30pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/2 "2014-04-17T16:30:09Z")

</div>

On Thursday, April 17, 2014 3:25:38 PM UTC+1, Ead wrote:

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

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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 4:47pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/3 "2014-04-17T16:47:16Z")

</div>

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’

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:13pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/4 "2014-04-17T17:13:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:16pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/5 "2014-04-17T17:16:12Z")

</div>

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

2014-04-17 17:12 GMT+02:00 Ead [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:21pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/6 "2014-04-17T17:21:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:07pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/7 "2014-04-17T17:07:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:29pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/8 "2014-04-17T17:29:10Z")

</div>

Check line 16 in app/controllers/static\_pages\_  
controller.rb, that line produces the query which causes the error.

2014-04-17 17:20 GMT+02:00 Ead [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:38pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/9 "2014-04-17T17:38:01Z")

</div>

On Thu, Apr 17, 2014 at 7:45 AM, Ead [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:39pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/10 "2014-04-17T17:39:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:40pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/11 "2014-04-17T17:40:23Z")

</div>

On 17 April 2014 16:12, Ead [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 5:44pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/12 "2014-04-17T17:44:32Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 11:59pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/13 "2014-04-17T23:59:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 18, 2014, 12:15am UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/14 "2014-04-18T00:15:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 18, 2014, 1:26am UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/15 "2014-04-18T01:26:59Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 18, 2014, 4:05am UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/16 "2014-04-18T04:05:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a6a055/32.png) [@Ead](https://www.ruby-forum.com/u/Ead)\
**Post date:** [April 17, 2014, 6:46pm UTC](https://www.ruby-forum.com/t/rails-website-is-down-after-a-server-reboot/240510/17 "2014-04-17T18:46:28Z")

</div>

On Thu, Apr 17, 2014 at 8:43 AM, Dai N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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?

> > Do your tests run?

–  
Hassan S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
twitter: @hassan
