Forum: Ruby on Rails Moving my site into production mode - general questions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Szymon N. (Guest)
on 2006-04-08 22:31
Hi!

I've just finished my ror site and i'd like to move it into production
mode.
Now it runs on linux/apache 1.3/cgi.

1. Can i use fcgi in development mode? I've read somewhere that because
of caching it causes memory leaks and fcgi shouldn't generally be used
in development. Does plain cgi also causes memory leaks in development
mode?

2. Does rails automatically delete its session files? If not how to set
up cron to automatically delete session files that are i.e. 24h old?
Does rails app with fcgi create any other temporary files that i should
take care of?

3. Is there good tutorial about caching in rails? What it is, how to use
it, what can/should be cached, when to use it etc.

4. Where to set RAILS_ENV to production mode? Is it ok if i set it in
enviroment.rb or should i set it in .htaccess or httpd.conf? I've read
that it's not 'clean' way to set it inside enviroment.rb. Why?

5. What are standard error pages in rails in production mode? How to
modify them?

6. Is there anything else that i should watch out for while moving my
app into production?

Thanks in advance
Charlie B. (Guest)
on 2006-04-08 22:55
szymek  wrote:
> Hi!
>
> I've just finished my ror site and i'd like to move it into production
> mode.
> Now it runs on linux/apache 1.3/cgi.
>
> 1. Can i use fcgi in development mode? I've read somewhere that because
> of caching it causes memory leaks and fcgi shouldn't generally be used
> in development. Does plain cgi also causes memory leaks in development
> mode?

You shouldn't have any problems with cgi in development mode because
your process die after each request.  You can use fcgi in development
mode if you want.  Just restart your processes often.
>
> 2. Does rails automatically delete its session files? If not how to set
> up cron to automatically delete session files that are i.e. 24h old?
> Does rails app with fcgi create any other temporary files that i should
> take care of?

Rails does not automatically delete any temp/session files.
>
> 3. Is there good tutorial about caching in rails? What it is, how to use
> it, what can/should be cached, when to use it etc.

The best tutorial I've seen is in the agile web devleopment book

>
> 4. Where to set RAILS_ENV to production mode? Is it ok if i set it in
> enviroment.rb or should i set it in .htaccess or httpd.conf? I've read
> that it's not 'clean' way to set it inside enviroment.rb. Why?

I set mine in envrioment.rb

>
> 5. What are standard error pages in rails in production mode? How to
> modify them?

You can modify them in your .htaccess or you can actuall modify the
error pages in public

>
> 6. Is there anything else that i should watch out for while moving my
> app into production?
>
Make sure you freeze your version of rails into your vendor folder if
you are on shared hosting

> Thanks in advance


charlie
recentrambles.com
Szymon N. (Guest)
on 2006-04-09 03:10
Thanks!

Regarding session files: if i don't use sessions in my site, can i
somehow turn if off, so the files won't be created or rails uses them
for something?

And what about log file? Should i also delete it or truncate it, if it
grows to big, or just leave it? Does it by default log only errors or
everything?
Charlie B. (Guest)
on 2006-04-09 03:24
szymek  wrote:
> Thanks!
>
> Regarding session files: if i don't use sessions in my site, can i
> somehow turn if off, so the files won't be created or rails uses them
> for something?
>
> And what about log file? Should i also delete it or truncate it, if it
> grows to big, or just leave it? Does it by default log only errors or
> everything?

If you don't explicitly create a session then there won't be to worry
about.  there is a shell script that comes with rails that will clean
out your logs.  If you freeze rails into your vendor directory, you can
find it at vendor/rails/cleanlogs.sh

Charlie B.
www.recentrambles.com
Ezra Z. (Guest)
on 2006-04-09 03:40
(Received via mailing list)
On Apr 8, 2006, at 4:24 PM, charlie bowman wrote:

>> everything?
>
> If you don't explicitly create a session then there won't be to worry
> about.  there is a shell script that comes with rails that will clean
> out your logs.  If you freeze rails into your vendor directory, you
> can
> find it at vendor/rails/cleanlogs.sh
>
> Charlie B.
> www.recentrambles.com


Actually even if your app doesnt ever store anything in the sessions,
session files will still be created for every user. To turn off
sessions put the following in your application.rb inside the class
definition:

session :off

You can also do conditional sessions like this:

session :off,  :except => %w{foo bar}
OR
session :off, :only => %w{foo bar}

Cheers-
-Ezra
Charlie B. (Guest)
on 2006-04-09 04:00
> You can also do conditional sessions like this:
>
> session :off,  :except => %w{foo bar}
> OR
> session :off, :only => %w{foo bar}
>
> Cheers-
> -Ezra

I'm assuming that foo and bar are controlers and that if you had
contollers in directorys that your could do

session :off, :except => 'admin/private_stuff'

is that correct?
This topic is locked and can not be replied to.