All posts by rbowen

Apache::VhostDB, sort of

I wanted to write a mod_perl handler that would read vhost configurations out of a database. However, it made more sense, at least to get something working quickly, do to this as a <Perl> section in the configuration file

I guess this could be done as a mod_perl handler instead, and I hope to eventually do it that way (mostly as an exercise, actually) but here it is the way I have it working:

#
#
# create table vhosts
#   (ID  int(11) not null auto_increment,
#    servername  varchar(255),
#    serveralias  varchar(255),
#    docroot      varchar(255),
#    scriptalias  varchar(255),
#    primary key (ID)
#   )
#
#  Note: serveralias can be a space-separated list. Change the field to
#  a text field if you have more than 255 characters of aliases.
#        scriptalas should have a trailing slash
#

<Perl>

use DBI;

my $db       = 'DBI:mysql:vhosts';
my $login    = 'www';
my $password = 'www';

my $dbh = DBI->connect( $db, $login, $password );
my $sth = $dbh->prepare( "SELECT servername, serveralias,
                                 docroot, scriptalias
                            FROM vhosts " );
$sth->execute;
$sth->bind_columns( my ( $servername, $serveralias, 
                          $docroot, $scriptalias ) );
while ( $sth->fetch ) {
    push @{$VirtualHost{'*'}},  {
        ServerName   => $servername,
        ServerAlias  => $serveralias,
        DocumentRoot => $docroot,
        ScriptAlias  => "/cgi-bin/ $scriptalias",
    };
}
$sth->finish;
$dbh->disconnect;

</Perl>

This goes in httpd.conf, and requires mod_perl. And, of course, you can add additional fields if you need them, like ErrorLog and CustomLog.

Christmas wines

Well, I seem to have neglected my duty, and now I seem to be forgetting what I should have taken good notes on.

In summary, the J Pinot Noir was disappointing. When I pay that much for a wine, I expect it to thrill. However, it was clear from the first taste that this was not a wine to chug, but one to squirrel away and have next Christmas, or the one after that. Shame.

The Sauvignon, on the other hand, was thrilling. Anise. Lots and lots of anise. This was very very weird. But fascinating. It was fruity, too, but it was unrecognizable, like strange tropical berries and currants, but not quite. I did not know a sauvignon could be that interesting.

I need to make sure to tell the folks at the T.C. about it, and give them my compliments on their assistance in picking.

Choosing a distro, chapter 4

OK, last chapter for today.

BSD did not like me. The X configuration thingy hung every time. Why? I have no idea. But I did not really feel like wasting any more time on it.

And so, I seem to have settled on (I cringe to admit it) Red Hat. The installation (8.0) was the easiest OS I have ever installed. I was very very impressed. It detected hardware without a hitch, installed quickly, and required a bare minimum of hand-holding.

Now, I have never been a big fan of Red Hat, but, wow, this was impressive. If you’re looking for something that Just Works, this very well may be it. I have been growing gradually more frustrated with Linux, because of how hard it is to install stuff. Well, this is not that.

Please understand that these systems are training systems, intended to be easy to use for beginners, and, most importantly, easy to rebuild. I don’t know that I’ll be converting my main development machines to Red Hat any time soon. But, you never know.

We both appear to be misunderstood

Hacking Log 2.0

Well, Andy, I seem to have been just as misunderstood as you, and I humbly apologize for appearing to take pot-shots at you. I really did not mean to offend, either by my comments here, or my comments on the mailing list.

You have good ideas, and people are probably overly anxious to criticize, when they could spend that time making constructive contributions. And, without any sarcasm, I admire your passion, your drive, and your obvious desire to get stuff done. It seems that too many of us have lost that over the years.

What I, personally, took umbrage at, was the implication that the processes put in place were there purely to slow down the wheels of progress. You say that you did not intend that implication, and I accept that, and withdraw my comments, with apologies for accusing you of those ideas.

I cannot take up on your offer to fill in those documents and processes, because, clearly, I understand them even less than you do. HTTPd is a world apart from the exciting bleeding-edge projects that go on in the rest of the ASF, and many of us are just as happy it is that way. If nothing else, it makes the books sell better.

I’m sorry I came across as being critical of you personally, or of your obvious passion for the projects that you are part of. As I tried to express on the mailing list, when I ask “why the heck are things the way they are”, I am usually genuinely asking that question, not saying “you are a bad and evil person for making things that way.”

And, just so I’m not disingenuosly hiding behind an alias, I am the guy in the picture there.

Choosing a Distro, chapter 3

Gentoo was a complete joke. Of course, perhaps I had the wrong ISO. It was not at all clear from the web site what I wanted. The iso, while it claimed to be a gentoo distro, was also a Unreal Tournament CD that would let you boot and play on any PC. Why is this useful? I’m not sure. But it appears that in order to install Gentoo, you have to know as much about your system as used to be the case in the RedHat 4 days. That’s for the birds.

Choosing a distro, chapter 2

Even though I’ve ben using Slackware for some time, I can’t claim to like it. It has taught me a lot, but there are days when this is a bad thing. I want stuff to Just Work.

Well, it gave it a shot as my distro, but it failed too. Primarily because I could not get X working right. I’ve worked on this before, and just can’t get it higher than 800×600. This may seem like a small deal, but this is a classroom, and people expect a certain amount of usability from the machines.

So, on to BSD and Gentoo.

Chosing a distro, chapter 1

Debian, which held out so much promise, has rather fallen down. I downloaded ISOs. (Oh, you should instead download debian-installer. It is much cooler, but only alpha.) I booted from the CD, and was asked a series of cryptic questions with non-obvious options. After going through that process, it put me back at the beginning of the process, giving me the same options. What do I do now?

Now, I’m sure that if I had a Debian guru here with me, this install would have gone smoothly, but my point is sort of that I should not need to have a distribution-specific guru in order to do an installation.

So, Debian lost out this time.

You know, I have some freebsd CDs somewhere …

Choosing a distro, chapter 0

I told Bert I’d journal this, so here it is.

I’m trying to choose a distro for my training machines, so that I can do a rebuild periodicaly. With the following requirements:

* The distro is usable by people not completely familiar with Unix

* The install does not require baby-sitting

* The install does not install a horribly broken Apache distro, as so many of them seem to these days

Personally, I have been using Slackware for some time, and I used BSD before that, so my personal requirements are a little different. But I can’t assume that my students know anything about Unix (although, so far, most have) or know how to use Enlightenment. Plus, I want something I can rebuilt in a few minutes of baby-sitting.

More about spam

I’ve noticed that my personal email volume has plunged over the last week. Apparently the spammers took the week off as well as the folks that contribute to the various email lists I’m on. I rather expected that spam volume would skyrocket during the Christmas holidays. I really wish I had spam stats from before last week. It would be interesting to compare my perceptions with reality. We’ll see what happens in the new year when things get cranked back up.

Final results in

Presidential Results – Latest

The ECK (Election Commission of Kenya) has officially announced the results, and Mwai Kibaki is the 3rd president if Kenya. The inauguration will be tomorrow.

There’s a lot of celebration going on. The losing candidates conceeded very gracefully, and violence has been almost completely avoided. This is a very promising start to things.

President-elect Kibaki has stated that he has no interest in forming a coalition government with Kanu, because he wants a strong opposition to keep him on his toes. I think I am starting to really like this guy.