Forum: Radiant CMS Cache 404 responses or serve more static response?

Posted by Jordon Bedwell (envygeeks)
on 2010-11-04 19:29
(Received via mailing list)
Is there a way I can force Radiant to cache error responses?
Posted by Jim Gay (Guest)
on 2010-11-04 20:26
(Received via mailing list)
On Thu, Nov 4, 2010 at 2:29 PM, Jordon Bedwell <jordon@envygeeks.com> 
wrote:
> Is there a way I can force Radiant to cache error responses?
>

Override this 
https://github.com/radiant/radiant/blob/master/app...
Posted by Obi (Guest)
on 2010-11-04 20:28
(Received via mailing list)
Hi,

I suddenly got this message on all my site pages today, can anyone 
please explain what's causing it?:

Ruby on Rails application could not be started

   These are the possible causes:
There may be a syntax error in the application's code. Please check for 
such errors and fix them.
A required library may not installed. Please install all libraries that 
this application requires.
The application may not be properly configured. Please check whether all 
configuration files are written correctly, fix any incorrect 
configurations, and restart this application.
A service that the application relies on (such as the database server or 
the Ferret search engine server) may not have been started. Please start 
that service.
Further information about the error may have been written to the 
application's log file. Please check it in order to analyse the problem.
Error message:
uncaught throw `Custom Fields Extension must be loaded before Stereotype 
Extension'
Exception class:
NameError
Application root:
/var/www/radiant
Backtrace:
#  File  Line  Location
0  /var/www/radiant/vendor/extensions/stereotype/stereotype_extension.rb 
9  in `throw'
1  /var/www/radiant/vendor/extensions/stereotype/stereotype_extension.rb 
9  in `activate'
2  /usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/lib/radiant/extension.rb 
86  in `activate'
3 
/usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/vendor/rails/activesupport/lib/active_support/dependencies.rb 
147  in `to_proc'
4 
/usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/lib/radiant/extension_loader.rb 
106  in `each'
5 
/usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/lib/radiant/extension_loader.rb 
106  in `activate_extensions'
6  /usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/lib/radiant/initializer.rb 
201  in `after_initialize'
7 
/usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/vendor/rails/railties/lib/initializer.rb 
179  in `process'
8 
/usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/vendor/rails/railties/lib/initializer.rb 
113  in `send'
9 
/usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/vendor/rails/railties/lib/initializer.rb 
113  in `run'
10  /usr/lib/ruby/gems/1.8/gems/radiant-0.9.1/lib/radiant/initializer.rb 
157  in `run'
11  /var/www/radiant/config/environment.rb  12
12  /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb  31  in 
`gem_original_require'
13  /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb  31  in 
`require'
14 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 
318  in `preload_application'
15 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 
267  in `initialize_server'
16 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/utils.rb 
323  in `report_app_init_status'
17 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 
246  in `initialize_server'
18 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 
194  in `start_synchronously'
19 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 
163  in `start'
20 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 
222  in `start'
21 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 
253  in `spawn_rails_application'
22 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb 
126  in `lookup_or_add'
23 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 
247  in `spawn_rails_application'
24 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb 
80  in `synchronize'
25 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb 
79  in `synchronize'
26 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 
246  in `spawn_rails_application'
27 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 
145  in `spawn_application'
28 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 
278  in `handle_spawn_application'
29 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 
352  in `__send__'
30 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 
352  in `main_loop'
31 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 
196  in `start_synchronously'
32 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/bin/passenger-spawn-server 
61
Posted by John Muhl (johnmuhl)
on 2010-11-04 21:00
(Received via mailing list)
On Thu, Nov 4, 2010 at 2:25 PM, Jim Gay <jim@saturnflyer.com> wrote:
> On Thu, Nov 4, 2010 at 2:29 PM, Jordon Bedwell <jordon@envygeeks.com> wrote:
>> Is there a way I can force Radiant to cache error responses?
>>
>
> Override this 
https://github.com/radiant/radiant/blob/master/app...

if you're using nginx maybe you can use proxy_cache_valid. wouldn't
nginx win out (at least if you had a page not found page)?

http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache_valid
Posted by John Muhl (johnmuhl)
on 2010-11-04 21:04
(Received via mailing list)
On Thu, Nov 4, 2010 at 2:27 PM, Obi <ezirim@gmail.com> wrote:
> I suddenly got this message on all my site pages today, can anyone please 
explain what's causing it?:
>
> Error message: uncaught throw `Custom Fields Extension must be loaded before 
Stereotype Extension'

looks like you need to install the custom_fields extension or track
down why it's suddenly gone missing if you had it installed previously
Posted by Obi (Guest)
on 2010-11-04 21:06
(Received via mailing list)
Yep, finally worked it out, so crisis averted.

Thanks for the quick response!
Posted by Obi (Guest)
on 2010-11-05 01:02
(Received via mailing list)
Hi Guys,

For some reason I can no longer log into my Radiant admin Panel, when I 
try I get the following message:

Application error

Change this error message for exceptions thrown outside of an action 
(like in Dispatcher setups or broken Ruby code) in public/500.html


I have no idea what caused this and would appreciate any help. If there 
is anymore info you need that would help you help me, then just ask.

Thanks
Posted by Joel Oliveira (Guest)
on 2010-11-05 01:50
(Received via mailing list)
Have you looked in your error log(s)? That will tell you more than any 
of us could
Posted by Jim Gay (Guest)
on 2010-11-05 03:36
(Received via mailing list)
On Thu, Nov 4, 2010 at 8:00 PM, Obi <ezirim@gmail.com> wrote:
> I have no idea what caused this and would appreciate any help. If there is
> anymore info you need that would help you help me, then just ask.
> Thanks

You'll need to login to your server and get details from the log.

tail -900 log/production.log

for the last 900 lines in the log (don't post them all here, please)
Or "tail -400", "tail -999999", etc
Posted by Obi (Guest)
on 2010-11-05 04:27
(Received via mailing list)
Thanks for the tip, I ran the error log (just for last 20 results) and I 
got the following message which I do not understand:

passenger (2.2.15) lib/phusion_passenger/utils.rb:252:in `safe_fork'
    passenger (2.2.15) 
lib/phusion_passenger/railz/application_spawner.rb:377:in 
`handle_spawn_application'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in 
`__send__'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in 
`main_loop'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in 
`start_synchronously'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:163:in 
`start'
    passenger (2.2.15) 
lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:253:in 
`spawn_rails_application'
    passenger (2.2.15) 
lib/phusion_passenger/abstract_server_collection.rb:126:in 
`lookup_or_add'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:247:in 
`spawn_rails_application'
    passenger (2.2.15) 
lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    passenger (2.2.15) 
lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:246:in 
`spawn_rails_application'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:145:in 
`spawn_application'
    passenger (2.2.15) lib/phusion_passenger/spawn_manager.rb:278:in 
`handle_spawn_application'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in 
`__send__'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:352:in 
`main_loop'
    passenger (2.2.15) lib/phusion_passenger/abstract_server.rb:196:in 
`start_synchronously'

Rendering /var/www/orgnot/public/500.html (500 Internal Server Error)

Does this tell you guys anything?

Cheers
Posted by Jim Gay (Guest)
on 2010-11-05 04:38
(Received via mailing list)
On Thu, Nov 4, 2010 at 11:24 PM, Obi <ezirim@gmail.com> wrote:
>  passenger (2.2.15) lib/phusion_passenger/abstract_server_collection.rb:126:in 
`lookup_or_add'
> Rendering /var/www/orgnot/public/500.html (500 Internal Server Error)
>
> Does this tell you guys anything?

You need more than 20. Look through the errors to find something that
came from your application and that's how you can start tracking it
down.
There might be a line in there similar to this:

/export/home/obi/radiant_app/vendor/extensions/something/something_extension.rb:13

That will point you to a file and a line number where the error
occurred. But you need to look further up the log. Try the last 200
lines.
Posted by Obi (Guest)
on 2010-11-05 04:48
(Received via mailing list)
ah, I see...

Could this section be the problem? Or should I look further up?

Rendering /var/www/orgnot/public/500.html (500 Internal Server Error)


Processing Admin::PagesController#index (for 98.143.144.89 at 2010-11-05 
03:16:47) [GET]
  Parameters: {"action"=>"index", "controller"=>"admin/pages"}
Rendering template within layouts/application
Rendering admin/pages/index

ActionView::TemplateError (PGError: ERROR:  relation "custom_fields" 
does not exist
LINE 1: SELECT * FROM "custom_fields" WHERE ("custom_fields".page_id...
                      ^
: SELECT * FROM "custom_fields" WHERE ("custom_fields".page_id = 1 AND 
(name = 'stereotype'))  LIMIT 1) on line #1 of 
vendor/extensions/stereotype/app/views/admin/_stereotype_td.html.haml:
1: - stereotype = page.custom_fields.find(:first, :conditions => ["name 
= ?", "stereotype"])
2: %td.published_status.status
3:   = stereotype.value if stereotype

    vendor/extensions/stereotype/app/views/admin/_stereotype_td.html.haml:1:in 
`_run_haml_vendor47extensions47stereotype47app47views47admin47_stereotype_td46html46haml_locals_defaults_level_object_page_simple_stereotype_td'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:11:in 
`render'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/haml/helpers.rb:90:in `non_haml'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:11:in 
`render'
    radiant (0.9.1) app/helpers/admin/regions_helper.rb:11:in 
`render_region'
    radiant (0.9.1) app/helpers/admin/regions_helper.rb:9:in `map'
    radiant (0.9.1) app/helpers/admin/regions_helper.rb:9:in 
`render_region'
    radiant (0.9.1) app/views/admin/pages/_node.html.haml:2:in 
`_run_haml_47usr47lib47ruby47gems47146847gems47radiant45046946147app47views47admin47pages47_node46html46haml_locals_level_node_object_page_simple'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:11:in 
`render'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/haml/helpers.rb:90:in `non_haml'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:11:in 
`render'
    radiant (0.9.1) app/helpers/admin/node_helper.rb:6:in `render_node'
    radiant (0.9.1) app/views/admin/pages/index.html.haml:17:in 
`_run_haml_47usr47lib47ruby47gems47146847gems47radiant45046946147app47views47admin47pages47index46html46haml'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:13:in 
`render'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/haml/helpers/action_view_mods.rb:13:in 
`render'
    radiant (0.9.1) lib/radiant/resource_responses.rb:18:in 
`response_for'
    radiant (0.9.1) app/controllers/admin/pages_controller.rb:16:in 
`index'
    radiant (0.9.1) 
vendor/plugins/haml/rails/./lib/sass/plugin/rails.rb:20:in `process'
Posted by Jim Gay (Guest)
on 2010-11-05 04:52
(Received via mailing list)
You got it!
It's telling you that the application is looking in the database for a
table that isn't there:

 ActionView::TemplateError (PGError: ERROR: relation "custom_fields"
does not exist

Do you need to migrate the database?

rake db:migrate:extensions
Posted by Obi (Guest)
on 2010-11-05 04:52
(Received via mailing list)
Also this section seems relevant where it refers to specific page action 
but I can't figure out exactly what the problem is...:

Processing Admin::WelcomeController#login (for 98.143.144.89 at 
2010-11-05 03:16:43) [GET]
  Parameters: {"action"=>"login", "controller"=>"admin/welcome"}
Redirected to http://orgnot.com/admin/welcome
Completed in 19ms (DB: 1) | 302 Found [http://orgnot.com/admin/login]


Processing Admin::WelcomeController#login (for 98.143.144.89 at 
2010-11-05 03:16:44) [GET]
  Parameters: {"action"=>"login", "controller"=>"admin/welcome"}
Redirected to http://orgnot.com/admin/welcome
Completed in 6ms (DB: 1) | 302 Found [http://orgnot.com/admin/login]


Processing Admin::WelcomeController#index (for 98.143.144.89 at 
2010-11-05 03:16:44) [GET]
  Parameters: {"action"=>"index", "controller"=>"admin/welcome"}
Redirected to http://orgnot.com/admin/pages
Completed in 6ms (DB: 1) | 302 Found [http://orgnot.com/admin/welcome]


Processing Admin::PagesController#index (for 98.143.144.89 at 2010-11-05 
03:16:45) [GET]
  Parameters: {"action"=>"index", "controller"=>"admin/pages"}
Rendering template within layouts/application
Rendering admin/pages/index

ActionView::TemplateError (PGError: ERROR:  relation "custom_fields" 
does not exist
LINE 1: SELECT * FROM "custom_fields" WHERE ("custom_fields".page_id...
                      ^
: SELECT * FROM "custom_fields" WHERE ("custom_fields".page_id = 1 AND 
(name = 'stereotype'))  LIMIT 1) on line #1 of 
vendor/extensions/stereotype/app/views/admin/_stereotype_td.html.haml:
1: - stereotype = page.custom_fields.find(:first, :conditions => ["name 
= ?", "stereotype"])
2: %td.published_status.status
3:   = stereotype.value if stereotype

    vendor/extensions/stereotype/app/views/admin/_stereotype_td.html.haml:1:in 
`_run_haml_vendor47extensions47stereotype47app
Posted by Jim Gay (Guest)
on 2010-11-05 04:58
(Received via mailing list)
On Thu, Nov 4, 2010 at 11:49 PM, Obi <ezirim@gmail.com> wrote:
>           ^
> : SELECT * FROM "custom_fields" WHERE ("custom_fields".page_id = 1 AND (name = 
'stereotype')) LIMIT 1) on line #1 of 
vendor/extensions/stereotype/app/views/admin/_stereotype_td.html.haml:
> 1: - stereotype = page.custom_fields.find(:first, :conditions => ["name = ?", 
"stereotype"])
> 2: %td.published_status.status
> 3:  = stereotype.value if stereotype

You get specific details right here.
It tells you the error (ActionView::TemplateError)
Then it tells you where
 on line #1 of 
vendor/extensions/stereotype/app/views/admin/_stereotype_td.html.haml:
And then shows you the actual code from that line
1: - stereotype = page.custom_fields.find(:first, :conditions =>
["name = ?", "stereotype"])
Posted by Obi (Guest)
on 2010-11-05 05:03
(Received via mailing list)
Ah, yes I remember being told to rake something in a set of 
instructions, every-time I do though I get this message (hadn't realized 
the rake was so important so I just skipped it, oops):

rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, 
Rakefile.rb)
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2377:in 
`raw_load_rakefile'
(See full trace by running task with --trace)

what could this mean? I'm pretty sure I already have rake installed

> You get specific details right here.
> It tells you the error (ActionView::TemplateError)
> Then it tells you where
> on line #1 of 
vendor/extensions/stereotype/app/views/admin/_stereotype_td.html.haml:
> And then shows you the actual code from that line
> 1: - stereotype = page.custom_fields.find(:first, :conditions =>
> ["name = ?", "stereotype"])

- Okay, so your saying it's the stereotype extension causing this 
problem.

I guess the solution will either be figuring out how to do the rake or 
figuring out how to uninstall the extension. For now it's probably 
better that I figure the rake out.

Any idea what causes the rake to abort?

Cheers
Posted by William Ross (spanner)
on 2010-11-05 08:38
(Received via mailing list)
On 5 Nov 2010, at 04:00, Obi wrote:

> Ah, yes I remember being told to rake something in a set of instructions, 
every-time I do though I get this message (hadn't realized the rake was so 
important so I just skipped it, oops):
>
> rake aborted!
> No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
> /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2377:in `raw_load_rakefile'
> (See full trace by running task with --trace)
>
> what could this mean? I'm pretty sure I already have rake installed

Hello Obi,

Are you running rake from the root of your radiant application? Rake is 
installed globally but the tasks are defined locally, so the normal 
sequence would be like this:

  radiant /path/to/website
  cd /path/to/website
  rake db:migrate

... install some extensions, do something else...

  cd /path/to/website
  rake db:migrate:extensions

It must have worked once or your database wouldn't be there at all.

best,

will
Posted by Obi (Guest)
on 2010-11-05 15:51
(Received via mailing list)
Thank you Jim; Thanks Will.

Finally got everything sorted, just had to restart the server to see the 
effect of the advice you guys gave me.

Cheers!
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.