Creative Commons licence

© Copyright 2004
David Spencer
Terms and Conditions apply

The Daves Collective

How this site works
2003-11-11 22:38

/tech/site/

A brief writeup about how this site works. It is entirely served as static pages from my ISP, there is no server side scripting at all. The reasons for this are (1) it's cheap and reliable, (2) I could use the same stuff on my old 486 which would creak a bit if it were laden with PHP and (god forbid) MySQL. So it's Blosxom for content management and Gallery for picture management as they both have the capability of local rendering into static pages.

A site update consists of combining three sets of pages into a single tree: (1) a set of static files, (2) pages rendered from the locally hosted Bloxsom installation, and (3) a snapshot of dynamic content (Gallery and anything else I fancy) created using wget. The combined tree is then incrementally mirrored to my ISP using lftp. Lastly, the local tree is retained as a handy backup. And it can all run from cron. Sweeeeet.

Note that I'm using some cunning tricks with Blosxom. As my pages are intended to be 100% static, I don't need to worry about getting a mixture of static and dynamic working. The only purpose the local installation fulfils is for preparing and verifying new content. So, local pages are accessed as normal via the Blosxom CGI script at /opt/local/share/cgi-bin/blosxom.cgi, and its $url setting is empty so that it only accesses Blosxom content on the local host. But for rendering static pages I use a second copy at /opt/local/bin/blosxom, in which $url is set to http://www.daves-collective.co.uk/. And I don't use the static_file plugin; all static files are merged from my parallel static tree, either (in the CGI context) by Apache aliases, or (in the static case) at render time.

Updated

For quota reasons I've now split the Gallery content to a different ISP site, but the same principles apply. Also, a bit of tweaking now means only changed content needs to be mirrored to the ISP sites. So the script now looks like this:

#   First mirror Blosxom content to site1
mkdir /srv/www/dc/new-site1
blosxom -password='1of2' -quiet=1 -all=0
for d in /srv/www/dc/static-site1/ /srv/www/dc/rendered-site1/
do
    cd $d
    find . ! \( -name '*.orig' -o -name '*.$$$' \) -follow -print \
    | cpio -pdm -u -L --quiet /srv/www/dc/new-site1
done
cd /srv/www/dc/new-site1
lftp -c "open -u user,pass ftp://site1.isp.example.com; mirror -p --delete -R"
mv backup-site1 backup-site1.prev
mv new-site1 backup-site1
rm -rf backup-site1.prev

#   Now mirror Gallery content to site2
mkdir /srv/www/dc/new-site2
cd /srv/www/dc/rendered-site2
wget -m -k -K -E -q -np -nH 'http://dsds/gallery/?set_offline=true'
cp 'gallery/index.html?set_offline=true.html' gallery/index.html
for d in /srv/www/dc/rendered-site2/ /srv/www/dc/static-site2/
#   Note different order (cf above), for reasons I won't delve into.
do
    cd $d
    find . ! \( -name '*.orig' -o -name '*.$$$' \) -follow -print \
    | cpio -pdm -u -L --quiet /srv/www/dc/new-site2
done
cd /srv/www/dc/new-site2
lftp -c "open -u user,pass ftp://site2.isp.example.com; mirror -p --delete -R"
mv /srv/www/dc/backup-site2 /srv/www/dc/backup-site2.prev
mv /srv/www/dc/new-site2 /srv/www/dc/backup-site2
rm -rf /srv/www/dc/backup-site2.prev

exit 0

For further drivel see the Index

Related links

  • None in this category