Shiny New Blog
While I had a WordPress-based blog quite some
time ago (which I rarely made use of), I was never quite content with
it; I wanted something more simple, something that does not need a
whole LAMP stack,
doesn't require tinkering with mod_rewrite
, and ideally has a
codebase that I'd want to hack on (which definitely rules out
WordPress, which is written in PHP).
Tekuti in R6RS clothing
Well, meet Tekuti. It's a lean blogging engine using Git as storage (so you get hot-backup and versioning for free), and, best of all, it's written in Scheme. Since I already have a Scheme HTTP server running for IRClogs, I decided to hack Tekuti so it could run in the same process; this involved porting Tekuti to R6RS and adding code to interface with the web-server (the original Tekuti only provides its services via the mod_lisp protocol). I must say that working with the Tekuti code was a joy; after getting it running using the mod_lisp protocol under Ikarus and Ypsilon, I could add the HTTP integration without touching the rest of the code at all. Kudos to Andy Wingo for writing this nice piece of code.
Yet another Scheme Web server
To avoid code duplication, I re-factored the ad-hoc libsoup-based web server that drove the IRClogs application into its own library. The interface provided by the library is very much inspired by the SUnet Web Server and hides libsoup entirely.
So, how does my script for running IRClogs and Tekuti inside the SPEnet HTTPd look like? Well, leaving out the customization and library imports, like this:
(define (rforge-request-handler irclogs) (alist-path-dispatcher `(("blog" . ,(tekuti-handler)) ("irclogs" . ,(lambda (path request) (irclogs 'dispatch path request)))) (rooted-file-handler *static-dir*))) (let ((irclogs (make-irclogs *irclogs-config*))) (httpd (make-httpd-options with-port *port* with-request-handler (rforge-request-handler irclogs)) (lambda (httpd) (irclogs 'update-state) (httpd/add-timeout httpd 60 (lambda () (irclogs 'update-state) #t))))))
Running the above code,
with port
, static-dir
and irclogs-config
appropriatly defined, will launch a
completely stand-alone web server that will serve IRC logs, run a
Tekuti blog instance, and provide static content
from static-dir
.
Code
You can fetch the R6RS port of Tekuti via git:
git clone git://gitorious.org/tekuti/tekuti.git git checkout t/r6rs/do-port