views:

46

answers:

5

I have a Ruby on Rails site that was only needed for a short period of time during which users added various objects to a mySQL database, commenting on them, associating themselves with them, etc. etc. etc.

The question is this: the site is no longer needed until a week next year around this time when I will clear the database and use it again (starting from scratch). What's the best way to archive the current site so that the existing content is still viewable but no new content can be added? By best way, I mean the method by which the least system resources will be used, the server will be the safest, etc.

Any suggestions?

+1  A: 

Use a web crawler and leave it as static html.

Jakub Hampl
If the site uses authentication, access rights etc., the static version will not support them, so e.g. restricted resources will be accessible to anyone (or not accessible at all).
szeryf
+2  A: 

If you wrote the app in the standard way, i.e. all the modifications are done via create, update or destroy actions in your controllers, add a before_filter to your ApplicationController that will prohibit accessing those methods (and probably new and edit, too).

You might also want to check your routes.rb to see if you don't have any other actions that modify your resources and add them to your filter too.

szeryf
A: 

It depends how complicated are associations in your db. If it's very simple, you can write simple php site that only shows contents of your db (or maybe there is something that does it). It is cheapest solution (by mean of memory and cpu resources), but may need some work to achive.

If you don't want to work on your application, then possibly the fastest way (by mean of your time) is to use @szeryf approach. Just add in all routes :only => [:show, :index].

klew
A: 

If the views are not common for editing and viewing the data, you could separate them with different controllers, one for just viewing, other for CRUD operations. Then it's matter of enabling and disabling the second one, possibly using routing.

Mladen Jablanović
A: 

Why not just remove create,insert and delete privileges from the database user?

DanSingerman