# Dedicated Server: Lighty, Rails, MySQL...Maintenance?

**URL:** <https://www.ruby-forum.com/t/dedicated-server-lighty-rails-mysql-maintenance/48981>\
**Category:** Rails\
**Created:** [November 28, 2005, 4:21am UTC](https://www.ruby-forum.com/t/dedicated-server-lighty-rails-mysql-maintenance/48981 "2005-11-28T04:21:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brad\_DSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/858c86/32.png) [@Brad\_DSSS](https://www.ruby-forum.com/u/Brad_DSSS)\
**Post date:** [November 28, 2005, 4:21am UTC](https://www.ruby-forum.com/t/dedicated-server-lighty-rails-mysql-maintenance/48981/1 "2005-11-28T04:21:35Z")

</div>

Slightly OT, but wanted some specific advice from other railers…

We have just set up a dedicated Debian box, with a lean installation of  
Lighttpd, MySQL and Rails (with the obvious Ruby libraries underneath).  
We have our first app up and running, with lighttpd set up for one fcgi  
proc (for now). This is an internal, authenticated app with relatively  
low traffic, but we plan to add additional rails apps to this server in  
the future.

Now to my question: I am looking to set up some cron jobs to maintain  
everything. Any suggestions, particularly with regard to lighttpd and  
cleaning up after FCGI? Should I be gracefully restarting the server  
every once and again?

The setup is a dual 800 Xeon with 1.25 GB of RAM. Everything is stored  
on an a ~70GB SCSI array.

---

<div class="post-metadata">

**Author:** ![Brad\_DSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/858c86/32.png) [@Brad\_DSSS](https://www.ruby-forum.com/u/Brad_DSSS)\
**Post date:** [November 29, 2005, 1:02am UTC](https://www.ruby-forum.com/t/dedicated-server-lighty-rails-mysql-maintenance/48981/2 "2005-11-29T01:02:11Z")

</div>

Just a self update, here are a few things that are already making my  
life a bit easier. Still open for suggestions…

1. SCGI - So simple to setup and no more fretting about FCGI processes.  
This took me literally 5 minutes to install, change the lighttpd config,  
and start a process…

2. Added the following line to a daily cron job to clean up session  
files in /tmp  
find /tmp/ -name “ruby\_sess\*” -cmin +600 -exec rm {} ;

Brad D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Slightly OT, but wanted some specific advice from other railers…
> 
> We have just set up a dedicated Debian box, with a lean installation of  
> Lighttpd, MySQL and Rails (with the obvious Ruby libraries underneath).  
> We have our first app up and running, with lighttpd set up for one fcgi  
> proc (for now). This is an internal, authenticated app with relatively  
> low traffic, but we plan to add additional rails apps to this server in  
> the future.
> 
> Now to my question: I am looking to set up some cron jobs to maintain  
> everything. Any suggestions, particularly with regard to lighttpd and  
> cleaning up after FCGI? Should I be gracefully restarting the server  
> every once and again?
> 
> The setup is a dual 800 Xeon with 1.25 GB of RAM. Everything is stored  
> on an a ~70GB SCSI array.

---

<div class="post-metadata">

**Author:** ![Brad\_DSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/858c86/32.png) [@Brad\_DSSS](https://www.ruby-forum.com/u/Brad_DSSS)\
**Post date:** [November 29, 2005, 3:57am UTC](https://www.ruby-forum.com/t/dedicated-server-lighty-rails-mysql-maintenance/48981/3 "2005-11-29T03:57:22Z")

</div>

On Nov 27, 2005, at 7:21 PM, Brad D. wrote:

> server in  
> the future.
> 
> Now to my question: I am looking to set up some cron jobs to maintain  
> everything. Any suggestions, particularly with regard to lighttpd and  
> cleaning up after FCGI? Should I be gracefully restarting the server  
> every once and again?
> 
> The setup is a dual 800 Xeon with 1.25 GB of RAM. Everything is stored  
> on an a ~70GB SCSI array.

Brad-

```
I run a largish site on lighttpd/fcgi on a dedicated server. The

```

things to keep your eye on are mostly the /tmp/ruby-sess\* files and  
the lighttpd\_access.log. The lighttpd\_access.log gets to be around 1  
gig in about 5 days if I don’t rotate it. So I have cron jobs to  
rotate that log file and also to erase the session files in /tmp that  
are older than 12 hours every twelve hours. Now there might be a  
difference in how long you need to keep your sessions so adjust  
accordingly, but those things pile up quick.

```
As far as restarting the fcgi's or lighttpd goes, I don't have to do

```

that at all. They run great without problems for months now. The only  
time I need to restart the lighty server/fcgi’s is when I push a new  
production version of my app to go live. Then I restart just because  
I need a restart to get production mode to pick up the new code.  
Other than that the lighttpd/fcgi p[latform is awesome and I heartily  
recommend it.

Cheers-

-Ezra Z.  
WebMaster  
Yakima Herald-Republic Newspaper  
removed\_email\_address@domain.invalid  
509-577-7732

---

<div class="post-metadata">

**Author:** ![Brad\_DSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/858c86/32.png) [@Brad\_DSSS](https://www.ruby-forum.com/u/Brad_DSSS)\
**Post date:** [November 29, 2005, 5:17am UTC](https://www.ruby-forum.com/t/dedicated-server-lighty-rails-mysql-maintenance/48981/4 "2005-11-29T05:17:54Z")

</div>

Thanks a lot Ezra. I found a nice log rotator called cronolog  
([http://cronolog.org](http://cronolog.org)) and now logs are rotating, tmp is being cleared  
and everything seems to be running great. The switch to SCGI also seems  
to have really stabilized memory usage, I was seeing some bleed in FCGI  
processes.

ezra wrote:

> Brad-
> 
> I run a largish site on lighttpd/fcgi on a dedicated server. The  
> things to keep your eye on are mostly the /tmp/ruby-sess\* files and  
> the lighttpd\_access.log. The lighttpd\_access.log gets to be around 1  
> gig in about 5 days if I don’t rotate it. So I have cron jobs to  
> rotate that log file and also to erase the session files in /tmp that  
> are older than 12 hours every twelve hours. Now there might be a  
> difference in how long you need to keep your sessions so adjust  
> accordingly, but those things pile up quick.
> 
> As far as restarting the fcgi’s or lighttpd goes, I don’t have to do  
> that at all. They run great without problems for months now. The only  
> time I need to restart the lighty server/fcgi’s is when I push a new  
> production version of my app to go live. Then I restart just because  
> I need a restart to get production mode to pick up the new code.  
> Other than that the lighttpd/fcgi p[latform is awesome and I heartily  
> recommend it.
> 
> Cheers-
> 
> -Ezra Z.  
> WebMaster  
> Yakima Herald-Republic Newspaper  
> removed\_email\_address@domain.invalid  
> 509-577-7732
