Archives

2008 (183)
2007 (276)
2006 (343)
2005 (56)
2004 (4)
2003 (8)
2002 (7)

Search


Search in “Igor’s scrawls”

Type in this box and hit “enter” to search through all titles, content, authors, along with tags on bookmarks, photos, etc.

Searches for words which bring up more than half of all entries are ignored.

Tags

Top 30 tags I’ve added to blog posts and bookmarks.

beograd (15)
car (15)
code (48)
españa (24)
food (20)
geek (67)
holiday (17)
java (18)
kingsland (19)
kingsland road (22)
london (255)
madrid (16)
madrid march 2007 (16)
madríd (16)
olympic (15)
olympic torch (15)
olympic torch relay (15)
philosophy (28)
php (16)
programming (17)
railway (15)
road (24)
serbia (18)
shoreditch (70)
spain (24)
station (16)
street (47)
torch relay (15)
whitechapel (15)
whitechapel road (15)

About me

I live and work around Shoreditch, London. My obsession with making Internet stuff leads me to spend my days heading up the tech side at POKE. What you’re looking at is entirely my doing, though, and as you’ve probably guessed, in no way reflects POKE’s views on anything, at all, ever.

In addition to providing me with a soapbox, this site tracks what I’m up to online using feeds from Flickr, del.icio.us and others.

View my profile on LinkedIn

.

Regular reads

Tuesday, October 7, 2008

Serious business

Republican senator Brad Sherman claims that several members of congress were threatened with martial law if they didn’t support the bank bailout bill:


Naomi Wolf offers her analysis of this event in light of others including the first deployment of US military on home turf since 1807 and the changes in the chain of military command implemented by Bush and Rumsfeld:


When someone like Wolf goes on record saying that “a coup”, “an armed insurrection” has taken place in the USA, and that its populace needs to “fight back” by organising, rising up, imprisoning the president and reclaiming control of the state, I don’t know about you, but my personal alarm bells start ringing.

Monday, July 14, 2008

php-fpm: a smoother PHP/FastCGI process manager

I’ve been running PHP apps with the standard PHP FastCGI server behind nginx for a couple of years now, and in that time have worked up a set of tools to manage PHP processes with multiple configuration profiles. This has been based around my slightly hacked version of Alexey Kovyrin’s PHP–FCGI spawn script, along with a chkconfig–compatible init script I’ve written as a front–end to control it, taking in some simple per–profile configuration in /etc/sysconfig/php-fcgi.

Various contributors to the English nginx mailing list have posted in that time singing the praises of Andrei Nigmatulin’s php-fpm, a patch to the PHP source which adds “FastCGI Process Management” to the standard php-fcgi binary. It’s apparently in use in some pretty heavily–loaded sites, and I’ve had it in mind to check it out, but as my setup has been stable (if not exactly full–featured) over the last few projects, I haven’t had a huge impetus to get and do it. Today, however, I finally had enough downtime to check it out, and now I’m wishing I’d done it earlier.

My existing method basically worked like this:

· init script reads configuration file, with one “profile” per line detailing location of php.ini file, interface and port to run on, number of child processes to run, number of requests to serve before a re–spawn, etc.;

· init script uses these details to construct a command–line to call Alexey’s spawn script, once for each profile;

· spawn script constructs environment and command–line argument list to spawn a set of PHP processes for each profile entry.

This has worked fine, but as so often with these things, the init script became a bit unwieldy with additions over time, and is still unable to do anything elegant like graceful restarts on the PHP daemons.

php-fpm addresses these issues and more. The “profile” configuration is put into a sensible, clear configuration file (php-fpm.conf) which allows you to specify a number of named PHP process “pools”, each with its own detailed FastCGI server and PHP configuration.

The documentation’s somewhat light, and mostly in Russian, but it has all you need to get going, and the configuration file is easy to read. Once you’ve configured the pools you want (in my case sets of named dev/stage/live setups on different ports, so as to keep include_paths — and therefore library code — properly staged), you just need to run php-cgi --fpm. From there on, you can send various signals to the master process including SIGQUIT for a graceful stop, SIGUSR1 to cycle log files, and SIGUSR2 for a graceful reload/restart. The master process ID is stored in $PHP_PREFIX/logs/php-fpm.pid.

I’ll probably write a simple chkconfig/init wrapper to send these signals to the master using e.g. /etc/init.d/php-fpm graceful, but that’s about all I’ll need to do in order to replicate and extend my existing setup.

Not only does this simplify and tidy up my PHP–FCGI setup enormously, it also adds a number of convenient extra points, including IP–restriction and a nice fix for the fix for the “empty error” page problem. Intuitively it “feels” a lot more solid, and I’m looking forward to trying it out on the next suitable project. Nice bit of Russian coder humour there on the “extra points” page, too. Thanks, Andrei!

Sunday, July 13, 2008

Setting up “yum” on RedHat Enterprise Linux

I just found myself in the situation of needing to install a load of software on a RHEL 4 box which had not had up2date set up. “Simple,” I thought, “it’s RPM-based, so just install yum and all will be well. yum’s nicer than up2date anyway, so”.

A cursory Google threw up this guide to doing just that, but I found that the list of RPMs provided was incomplete, possibly due to the age of the article. With the duplicates removed, package versions matched, and downloads sourced from the up-to-date CentOS and pbone, the set now installed without dependency problems, but left a non-functioning yum installation:

Setting up Install Process
Setting up repositories
not using ftp, http[s], or file for repos, skipping - Null is not a valid release or hasnt been released yet
Cannot find a valid baseurl for repo: update
Error: Cannot find a valid baseurl for repo: update

I hadn’t delved into yum’s config or repository setup much before, as on most non-RHEL rpm-based distributions it tends to work out of the box; I’d added other repositories, notably Dag Wieers’, but not looked at the format much. Imagine my delight on realising that now was my chance.

A first glance at the repository definition in /etc/yum.repos.d/CentOS-Base.repo suggested trying to use the baseurl entry which is commented out by default, rather than the mirrorlist. No joy, but it gave a pretty obvious clue:

http://mirror.centos.org/centos/Null/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
Cannot open/read repomd.xml file for repository: update
failure: repodata/repomd.xml: from update: [Errno 256] No more mirrors to try.
Error: failure: repodata/repomd.xml: from update: [Errno 256] No more mirrors to try.

Got it? That nasty Null is caused because the repository definition file uses a variable $releasever which, as man 5 yum.conf tells us, is taken from the currently installed version of the package named as distroverpkg in /etc/yum.conf - which by default is centos-release (presumably taken from the RHEL redhat-release convention). Thus the only step necessary to get it working was to install the centos-release package. The baseurl entry in the repository definition could be commented out again.

So here, for your edification, and as an »aide-memoire« for me, is my list of the packages required to get yum working correctly on RHEL4:

centos-release
centos-yumconf
python-elementtree
python-sqlite
python-urlgrabber
sqlite
yum
yum-metadata-parser

Joy.

Friday, June 6, 2008

Play Balloonacy

Hot on the heels of Spot the Bull comes POKE’s next big campaign for Orange, Balloonacy. It’s a balloon race across Internet. No, really. It’s in its sign–up phase at the moment; the race itself starts on June 23rd.


You can launch a balloon or sign your site up to be part of the map, and if your balloon gets the furthest you can win a holiday in Ibiza.

It’s the biggest project we’ve built using our home–grown, bare–bones, remote–MVC framework, “Death Star”, and the first in which we’ve integrated it with AS3.

A lot of POKErs have been involved in this, including Iain who came up with the idea in the first place. Design is by Marc, Nicky and Dickon. In the client-side tech team, we have extreme Flash & pattern action by Dezza, with code & Papervision help from Gabes, and lovely Flash 9 sheen from POKE’s very own Caroline B. Stepping back from the Flash, we have front-end build and Death Star CMS delights from Greg; JS integration wizardry and Death Star coding from Mattias; Death Star coding, AMF services and database tomfoolery by Nilesh; system & platform architecture and team leading by mine own evil hand. Project managed by Mike who’s done his damnedest to keep us all sane. Ish.

Monday, March 17, 2008

e. e. cummings

For several years one of e. e. cummings’ selections of his poems had sat calmly on my bookshelf, unread and almost forgotten, but, unbeknownst to me, waiting patiently for life to prepare me sufficiently to grasp its content.

All the while I’d known nothing of cummings’ work save a few quirky, cheekily risqué pieces to which I’d been pointed over time, and had rashly assumed that they were what it was all about — so when, in a mood for some impish light-heartedness, I stuffed that slim volume into my pocket and dived into the first few stanzas on an empty eastward Saturday evening Tube, the strength of the undercurrent pulled me completely off course.

Two pieces in particular left me stunned into silent contemplation — who knows if the moon’s a balloon, conjuring in my mind Chagall’s eery, idealised yet somehow troubled world of airborne lovers (particularly Promenade and Lovers in the Red Sky); and Humanity i love you: a sly sucker-punch, an indulgent sigh of gentle resignation tailing finally to a hoarse rattle of anger and despair.

Here is an elegant and innocent beauty, a playful naïveté shot through with a mournful, quietly desolate seam of profound and mature comprehension, the understated expression compounding the contrast’s potency. An unexpectedly powerful discovery, for me, of an unheralded eloquence and grace.

Tuesday, January 8, 2008

New year, new tech

There’s so much activity at the moment around web development using niche and previously esoteric languages that the recondite is fast becoming the norm: recherché, my dear, is the new accessible. One can’t help but wonder in some cases how far the developer of a given zoom–to–web framework has set out with some clear design goals in mind, carefully considered specific features of various languages in the context of those goals and eventually settled on one; conversely how far languages which natively support continuations, functional or concatenative programming are simply too cool not to have three–step web app frameworks, or indeed whether the implementation of such a framework has become a rite of passage for a langue débutante. For such considerations to stray into the realms of whether particular languages are selected purely on the basis of how arcane their syntax may be would be nothing less than cynicism, which is obviously untoward in technical discussion.

Nonetheless niche is sometimes nice, focus is frequently fantastic, and it goes (almost) without saying that a tightly–focussed development effort by some extremely smart people can, and often will, bear fine fruits. Recent ponderings in the Clark–brain have concerned The Right Way To Get The Job Done, and whether a “right” way might actually exist — more to follow on that topic, but for me, it’s all about that same ol’ focus, tools for tasks, and the Unix Way — so to that end, please find herewith a beauty parade of some of the linguistic and mechanical delicacies currently whetting my appetite, and lined up for perusal at some point in the not–too–distant.

Factor Stack–based programming definitely is cool.

Merb MVC framework Looks to do what it says on the tin, neatly, without any fuss, and hopefully without eating gigabytes of RAM for entrées.

Ragel state machine compiler If it’s good enough for Zed, it’s good enough for me.

Seaside If you want old–school cool with a nu–skool polish, it doesn’t come much better than Smalltalk — even if the Smalltalk community site does try pretty darn hard to convince you otherwise.

Finally, while we’re talking continuations in web frameworks (though post-AJAX Seaside seems to be sidelining them somewhat): even if the mere thought of a “full–stack web application framework with tools and APIs to implement most common web features” is enough to make my knees itch, using continuations but still maintaining control over HTTP nuts and bolts has a cool factor of at the very least Xe+28, and the recent burst of POJO–speak has re–lit my hitherto Bean–sickened and J2EE–weakened Java fire — all of which factors combine to suggest that RIFE is likely to get a look in.