Free / Open Source Web Based Project Management / Bug Tracker Softwares

I have a lot of projects going all the time. Whether they are SQL projects, projects with my web servers, bugs on sites or web apps, every day is pretty busy. So… how do I keep track of it? Some people use something like Google Calendar or Outlook. This works fine for some people, but I wanted something I could use no matter which computer I was on (I use a fairly diverse set of computers in a day, some Linux based, some Mac based, and some Windows based). Furthermore I just so happen to have a web server.

So why not use something web based I thought?

After a little looking around, I found two that I use on a pretty regular basis. One is called Feng Office (formerly known as “OpenGoo”). I like this one because you can actually set up email alerts to yourself if you have upcoming tasks that you want done. It also can have several users (well, actually as many users as you want to put on there), so for collaboration, this one is awesome. It’s especially nice because of all the levels of administration you can give each user. You can read more on it here.

Of course, I already have a dedicated server for hosting this on, so I only needed the Community Edition. They also have hosted versions that you pay a fee for.

Second is the bug tracker I use for my day to day progress. For that I use WebIssues.

They used to only have a platform specific client, though they have since ventured in to the realm of a web based client that I particularly enjoy. This is awesome for when I am working on code and a bug report comes in or some of my code is a little screwy – it also helps if I am working a large SQL query to keep my query straight – because I just stick where I want the query to go in there.

In any event, both of these are highly recommended by me.

Optimizing Apache for Best Memory Usage

Recently I have been running in to a lot of issues with Apache performance on both CentOS installs and Debian installs. This is most likely due to a ton of Apache Modules and such, but there are some ways to tweak your httpd.conf so that you have the best performance for your traffic – this varies among different sites and hosts, so for this I will be writing more or less how to optimize it for a 512MB Virtual Private Server (VPS).

If you want to do some quick modifications to make your Apache server run a little bit better, I would suggest doing this:

Find your httpd.conf file (in Debian / Ubuntu based distros, it’s /etc/apache2/apache2.conf, and for RPM based distros its /etc/httpd/conf/httpd.conf). In that file you will find, if you scroll down, a place that says:

# prefork MPM

Straight from Apache, – “This Multi-Processing Module (MPM) implements a non-threaded, pre-forking web server that handles requests in a manner similar to Apache 1.3. It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries. It is also the best MPM for isolating each request, so that a problem with a single request will not affect any other.”

This is what most (modern) web servers are running. If you want to be sure it is what you are running, you can run this on RPM based distros:

# /usr/sbin/httpd -l

And on Debian based distros:

# /usr/sbin/apache2 -l

That will list all your modules that your web server is loading. You should get a list back that is something like:

Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c

That will tell you if you are using prefork or worker mpm. In any event, back to the issue at hand.

In your httpd.conf file, you’ll see something underneath prefork mpm that looks something like this:

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          35
    MaxRequestsPerChild   400
</IfModule>

This is what we want to tweak. Let’s start with “StartServers”.

StartServers is basically the number of child server processes created at startup (or at least, when you start the Apache service). For prefork, 5 is pretty standard. If you have some extra RAM hanging around, it may be alright to increase this, but for our little 512MB, it would be prudent to leave this at or below 5.

MinSpareServers is more or less the minimum number of idle child server processes. Straight from Apache again – tuning of this parameter should only be necessary on very busy sites. Setting this parameter to a large number is almost always a bad idea. I’ve seen some people drop it to 2 or 3, and I’ve seen others leave it at 5. I’ve had no problems with it at 5 personally.

MaxSpareServers is the maximum number of idle child server processes. This should usually be at or double your MinSpareServers. On a 512mb server, it should be at 10. If you have a gig or two gigs, you could probably up this to 20 or 25.

MaxClients pretty much sets the limit on the number of simultaneous requests that will be served at any one moment. Any more connections that are over limit will be queued. Once a process is freed at the end of a different request, the queued connection will connect. This is EXTREMELY dependent on how much traffic your server / sites have. If you are receiving 40 or 50 independent hits per minute, it’s probably a good idea to get a better VPS than 512mb of RAM and to crank this up a bit.

MaxRequestsPerChild sets the limit on the number of requests that an individual child server process will handle. After the number of requests reaches the value specified, the child process will die. When this value is set at 0, the process will never expire and just sit in RAM. This and MaxClients are somewhat related. Personally, on a VPS, I would suggest setting it between 150 – 500, though I have seen some people who set it as high as 5000 – 10000.

And here it is in a nutshell. The first thing that happens when you start Apache is that it reads the StartServers and starts that many Apache Processes (if its 10, it starts 10 processes) – the second thing it reads is the MinSpareServers and Max Spare Servers and adds the MinSpareServers to your StartServers (2 + 10). Next if you have 2 as your MinSpareServers and 5 as your MaxSpareServers and if your server is under no load, Apache drops down to 2 – 5 processes. The last thing it reads is MaxClients – Apache will spawn up to this number of processes as the server needs them at a rate of 2^N per second (1, 2, 4, 8, 16) until it reaches your MaxClients. It’s a good idea to make this a value divisible by 2, and honestly, by 16.

MaxRequestsPerChild is the total number of incoming connections to your server. Some pages have a few things to load, some pages have only one (like say, photos, a style sheet, a link, etc…). Some browsers split this up and will call it in more than one connection. Other browsers will only open one connection. This is the max allowed connection per any given time. If this is full, then clients are queued until more connections are available.

Really, my honest suggestion here is to not just copy and paste my settings and hope it works for you, but to change yours slightly and monitor your server. Watch your processes and see what works best for you and your particular situation. If you have a ton of PHP on your server, maybe you should also look in to PHP APC. In my opinion though, each server is a little bit different, just as a lot of web sites are a little different – so play around with it and see what works best for you.

Web Server “Essential Services” Monitoring Script

A while back I wrote a script that I set as a cron (every 5 minutes) to monitor my web server (LAMP with mod_proxy / BIND). I was having trouble, specifically with BIND, with few or no logs (I changed this, but they were so non-descript that I had no idea why it was dying). Thankfully an update came out for it via repo that fixed that issue, but not before I’d written a script to do it for me. So I present, the Web Monitoring Script.

This was written for Debian, but a few easy modifications to your variables will have it working on CentOS / RedHat / Fedora.

Prerequisites – You need root to add this as a cron. You also need to create this folder “/var/log/server_monitor/”.

It would also be a good idea to do set up log rotation on those logs.

To do that, follow this (and use whatever text editor you like, my server doesn’t have a GUI, so I tend to use text based tools):

# cd /etc/logrotate.d
nano server_monitor

And add this to that file and save.

/var/log/server_monitor/*.log {
	weekly
	missingok
	rotate 5
	compress
	notifempty
	create 640 root adm
	sharedscripts
	postrotate
	endscript
}

Now your logs will rotate weekly and will be compressed.

Now on to the actual script:

#!/bin/bash
#
# This is a server monitor that will run every 5 minutes to be sure all services are running, and if they are not, to start them.
#
# Let's set some variables quick
############################################################
RESTARTAPACHE="/etc/init.d/apache2 restart"
RESTARTBIND="/etc/init.d/bind9 restart"
RESTARTMYSQL="/etc/init.d/mysql restart"
RESTARTXINETD="/etc/init.d/xinetd restart"
RESTARTQMAIL="/etc/init.d/qmail restart"
############################################################
############################################ Path to pgrep
PGREP="/usr/bin/pgrep"
############################################################
############################################ Program names
APACHE2="apache2"
BIND9="named"
MYSQL="mysql"
XINETD="xinetd"
QMAIL="qmail"
############################################################
########################################## Set the log file
LOG="/var/log/server_monitor/server_monitor.log"
SUCCESS=" was down and has restarted successfully at $(date)"
###########################################################
############################################### Set date
set $(date)
#
# Apache
#
$PGREP $APACHE2
if
	[ $? -ne 0 ] #This shows that apache is not running since there are no pids
then
	$RESTARTAPACHE
	echo "$APACHE2 $SUCCESS" >> $LOG
else
	echo "$APACHE2 is running fine at $(date)" >> $LOG
fi;
#
# Bind
#
$PGREP $BIND9
if
	[ $? -ne 0 ]
then
	$RESTARTBIND
	echo "$BIND9 $SUCCESS" >> $LOG
else
	echo "$BIND9 is running fine at $(date)" >> $LOG
fi;
#
# MySQL
#
$PGREP $MYSQL
if
	[ $? -ne 0 ]
then
	$RESTARTMYSQL
	echo "$MYSQL $SUCCESS" >> $LOG
else
	echo "$MYSQL is running fine at $(date)" >> $LOG
fi;
#
# Xinetd
#
if
	[ $? -ne 0 ]
then
	$RESTARTXINETD
	echo "$XINETD $SUCCESS" >> $LOG
else
	echo "$XINETD is running fine at $(date)" >> $LOG
fi;
#
# Qmail
#
if
	[ $? -ne 0 ]
then
	$RESTARTQMAIL
	echo "$QMAIL $SUCCESS" >> $LOG
else
	echo "$QMAIL is running fine at $(date)" >> $LOG
fi;

Then if you want it to run every 5 or so minutes (I have mine on every 5 minutes), just add it to crontab. It’s an extremely light script and uses basically zero system resources.

That will keep your server running pretty smooth. If you want to get an email notification when this happens, it’s also fairly easy to set up. It would also be a good idea to check the logs once in a while and make sure you’re not having too many service issues.