Benjamin W. Smith

Benjamin W. Smith

Benjamin W. Smith  //  Sysadmin by trade, Pythonista by passion. Dad to two boys and a girl. Guitarist. I like my coffee black, just like my metal.

May 13 / 6:29am

I'm spent...and an apology

I just spent the last few hours polishing up my site for maximum awesomeness. It doesn’t look much different, you say, but under the hood is a completely different beast. As I mentioned in a previous post, I spent last night converting the backend of this site to byteflow, which is built on django (python based) and running on top of lighttpd.

Previously (read; years ago) I had built a blogging system based on a LAMP stack, specifically Apache 2.0, MySQL and PHP. Slowly, over time I added to and ‘improved’ the software. Time and time again it felt like an exercise in futility. It seemed to be a never ending battle to keep up with the times and stay exposed. Since I started working for ag interactive I’ve fallen in love with Python. Quickly thereafter I started searching for a good, ”developing” blog package written in python. I longed for something I could extend and something that is portable. I long no longer…(?) The django project has provided many facilities to build a great blog (and cms type thing) and I’m glad someone has finally stepped up to take advantage of them. I’m sure I’ll be submitting patches to this project as I discover things to tweak or improve.

To the byteflow crew: Great Job so far!

Now onto some of the details about what I did.

I love lighttpd, all of my recent development has taken advantage of it. It’s configuration is intuitive, it’s feature rich for it’s size, and it’s performance is hard to match. Converting the config for this was relatively simple. This is, of course, coming from a sysadmin who deals with hundreds of web servers daily :). Anywho, here’s the config with paths cleaned up for clarity:

# Main server settings
server.modules              = ( 
            "mod_access",
            "mod_alias",
            "mod_accesslog",
            "mod_rewrite", 
            "mod_redirect", 
            "mod_status", 
            "mod_fastcgi",
            "mod_compress",
            "mod_expire",
)

server.document-root       = "/docroot"
server.errorlog            = "/var/log/lighttpd/error.log"
index-file.names           = ( "index.php", "index.html", 
                                        "index.htm", "default.htm" )
accesslog.filename         = "/var/log/lighttpd/access.log"
url.access-deny            = ( "~", ".inc" )
server.pid-file            = "/var/run/lighttpd.pid"
dir-listing.encoding        = "utf-8"
server.dir-listing          = "enable"
debug.dump-unknown-headers  = "enable"
server.username            = "www-data"
server.groupname           = "www-data"
#status.status-url = "/server-status"
#status.config-url = "/server-config"
# Expires stuff, per yahoo tips :)
$HTTP["url"] =~ "^/" {
     expire.url = ( "" => "access 8 hours" )
}
# Set mime-types.
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
# Allow for vhost configs
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
# Compress settings
compress.cache-dir          = "/var/tmp/lighttpd/cache/compress/"
compress.filetype           = ("text/plain", "text/html")

# Custom settings
# Set-up some aliases
alias.url = ( 
              "/admin-media" => "/django/contrib/admin/media",
              "/images" => "/docroot/images",
              "/static" => "/docroot/static"
)
# Startup the fastcgi server, point it at my custom
# fastcgi script.
fastcgi.server = (
    "/byteflow.fcgi" => (
        "main" => (
            "socket" => "/tmp/byteflow.socket",
            "bin-path" => "/docroot/byteflow.fcgi" 
        ) 
    ) 
)
# Make sure we're passing on these urls
# bare, don't process them with django.
url.rewrite-once = (
    "^(/rpc.*)$" => "$1",
    "^(/images.*)$" => "$1",
    "^(/static.*)$" => "$1",
    "^(/admin-media.*)$" => "$1",
    # Then push the rest through django
    "^(/.*)$" => "/byteflow.fcgi$1"
)
# Legacy url, redirect it to new feedburner.
url.redirect = (
    "^/rpc([\/]*)" => "http://feeds.feedburner..truncated..",
)

Here is my fast-cgi script, which resides in my docroot.

#!/bin/sh
# byteflow.fcgi

export PYTHONPATH=$PYTHONPATH:/home/bsmith/Dev
export DJANGO_SETTINGS_MODULE=byteflow.settings

/home/bsmith/Dev/byteflow/manage.py runfcgi

Compared to a run of the mill apache setup, this is cake walk. I commented the important bits so you can get the gist of what’s going on. If you have a question required more detail, let me know.

After spending a few hours converting my data to the model that django built for byteflow, I then focused on cloning my old theme. As you can see, I didn’t to a bad job! I tried to clean it up a bit and make sure I have more content for the search engines to munch on. Other than that bit of extra work, building the templates for this was pretty simple.

As you may have noticed, I also began using feedburner to serve up my rss feeds. That’s where the apology comes in..If you’re subscribed, most likely you have experienced duplicate posts..like..all of them. So, with that said So Sorry!.

Filed under  //  appology   byteflow   django   lighthttpd   python   site  
May 12 / 11:21am

Wow this software rocks.

I just converted all my tags and posts to run on this byteflow system. I’m impressed. It is by far the most full featured django blogging app I’ve seen. I was also able to get it jamming with lighttpd. Right now I’m running this from my development area until I can get comments imported. I couldn’t be happier with the results thus far! At some point today, once I’m done polishing things, I’ll post my configs and a little how-to.

Filed under  //  byteflow   django   lighthttpd   python   site  
May 12 / 11:21am

Wow this software rocks.

I just converted all my tags and posts to run on this byteflow system. I’m impressed. It is by far the most full featured django blogging app I’ve seen. I was also able to get it jamming with lighttpd. Right now I’m running this from my development area until I can get comments imported. I couldn’t be happier with the results thus far! At some point today, once I’m done polishing things, I’ll post my configs and a little how-to.

Filed under  //  byteflow   django   lighthttpd   python   site  
Apr 9 / 5:24am

Again with the site cleanup..

So I got bored again, go figure. I wrote some code that converts my titles into 'slugs' much like wordpress. I then altered my blog table to include it as an index, wrote a quick script to parse my titles and insert them and changed my templates to link via them. Throw in some rewrite magic and wala; hot sauce.

I'm glad I wrote this code base to be simple to manage and extend :). I'm kinda curious how it would fair from a security standpoint, however. Maybe I should just write it off and go ahead with something already baked; but it's fun to muck around like this.

Also, I'd like to appologize for anyone subscribing via a reader. It'll mark all my posts as unread due to the changes.

Sorry!

Filed under  //  cleanup   site  
Apr 4 / 6:58pm

SEOness? Getting there..

So after having a conversation with Dave yesterday about search engines, I decided to fix up the urls on my site to be more search engine friendly. I had some really ugly linkage and I'm glad I spent some time cleaning that up. Yay. Me.

Filed under  //  cleanup   seo   site   stanek  
Mar 21 / 1:52am

Archive & Feed Updates.

Yay! I threw together a quick archive of all my posts here

Per Mike's suggestion, I made the entire body of a blog post available via RSS. While I was refactoring all of the RSS code, I also went ahead and added the ability to subscribe to an single post, comments and all.

Why the hefty updates of my site? Well, I failed to get the Oxygen Sensor off my car today and wanted to feel like I accomplished something.

That's all, folks

Filed under  //  car   feed   geek   site  
Oct 22 / 1:28am

Just another manic Monday..

I woke up late, again, checked my son for a rash, poured a cup of coffee and drank a bottle of water. After my relaxation time was over I went to cleaning myself up for work. By this time I realized it was 7:45 and now I was _really_ going to be late. Why was I so late this morning? Because the Indians lost. What does that have anything to do with it? Well...I tried to forget the loss by consuming over the recommended dosage of liquor and beer(in that order) :/

Fast forward and I'm walking into the office. Open my email, seemingly thousands of errors over the weekend. Fixed some filesystems on a few servers, cut the verbosity of some logging down a notch, and discover that it wasn't a DNS problem after all, infact $user had a host file entry.
This was all before 9.

Moving right along, look for this photo at cleveland.com this coming Friday!
From the right: Me, Bob(hiding), Craig, Cory, Mike, Kathy, Martin.

And one last note.. Keep an eye out for adsense ads in the "leftovers" section of my side menu.. I think it might help drive some traffic and make a buck.

Filed under  //  beer   life   site   work  
Sep 21 / 8:31pm

Site updates..

Take a look to the left and you'll see a new menu listing the top tags on the site. That means the #1 tag is the #1 topic written about in my blogs..

When browsing a blog you will notice a comment form. That's right, you can leave comments related to the blogs I'm writing!


Enjoy folks..
Filed under  //  geek   site  
Sep 20 / 1:42am

RSS Feeds working!

Check out the new link setup to the right.. Under leftovers you will find a link that takes you to my rss feed to which you can subscribe from your favorite reader!

Word. Up.

Filed under  //  geek   site  
Sep 19 / 12:29am

Technorati...PING?!

Wrote a quick module today that will hopefully ping Technorati every time I update my blog.. Soon enough I will put my tagging stuff in place, as well as comments. I've also been writing an RSS feed generator for my posts, so stay tuned!

Filed under  //  geek   site