WARNING: building your own web server requires a bit of effort. The rewards however are large. If the word “server” puts you into a blind panic you should perhaps skip this article. The more adventurous should read on…
So the obvious question, what to run your “reclaim your media” website on? Well as I’ve stated before running a web server has a pretty low performance requirement, especially as you are not expecting to have thousands of simultaneous connections. Connections for my website hit a new all time high the other day at two – me logged on at home doing some admin and a friend testing it for me. The point is you’re not building the latest Amazon or Facebook and so all it needs to do is perform fairly snappily with a couple users max.
Interestingly, one of the main tenants of web server software design is to be able to cope with huge amount of simultaneous users and this is where caching comes in. One of the pleasant surprises I discovered about implementing Joomla (for that is the CMS I use for this site) and more specifically some of the photo gallery plugins is that you can set them to dynamically build media assets at a given time schedule.
As a real world example, say you chuck a big pile of photos into a directory and want them to appear as a gallery on your website. What happens is this: you go to the website gallery page on your browser which instigates a script to generate the thumbnails. These then get dropped into an HTML page which is served back to you the viewer. You can immediately see a problem with this if you are running on a server box that hasn’t got much horse power – if the directory contains say 25 images at 4MB each then your server has suddenly got to resize all those images before it can display the page of thumbnails. My first experiments with running dynamic websites (i.e. ones that build stuff automatically, rather than you doing all the leg work) were plagued with this – pages would just take an eternity to load.
Joomla and the photo gallery plugin I’ve been playing with accommodate this problem by building any required assets in advance at a given schedule, so for example you can tell it to look every 60 minutes for any stuff it might be asked to do and it’ll build it in advance. This is good especially if you are running on a a relatively low power server because it means you can set you server to build the pages ahead of them being served – the server can happily sit there and thrash away processing images all night if it so wishes and everything will run silky smooth when your Mum comes to look at your holiday photos in the morning.
Right, so lets get down to the nitty gritty. There’s three things we need to look at here:
Performance as we have already discussed is largely irrelevant. Any PC made in the last few years will be up to the task we are asking of it.
If your flat broke you’re not going to want to buy a shiny new box, irrespective of how cheap you can get one these days (more on this later) so your likely going to want to dust down an old PC left in a cupboard, acquired from a friend or if you live in east London found lying in the street. All these PC’s are suitable for the job but you are going to have to consider the reliability factor.
A repurposed PC is not going to score highly in our reliability stakes but there are a few things we can do to address this problem. Firstly, the things that are most likely to crap out are the hard drive or the power supply.
Power supplies fail mainly for one reason – they run too hot. This is usually because they are:
a) Kept somewhere stupid – under a desk with a pile of paper leaning on the vents.
b) Allowed to behave like hoovers rather than PSU’s – dust and dirt clogs vents and causes over-heating.
I’m of the opinion that given the UK climate that the best place for a server is the garage (providing it dry) this is always going to be colder than the rest of the house and unless you are in the habit of doing a large amount of carpentry the dust is a lot less than the rest of the house.
Anyway you get the message, put your server somewhere cool and dust-free.
Hard disks fail yes you read that right, there is no proviso – just like car tyres wear out inevitably hard disk fail. This should be chanted like a mantra until you fully understand it. There is no “if” about it – it’s a “when” just remember that when you dump your entire photo collection onto a single shiny new 2TB HD, it’s not going to last forever.
Now that we’ve grasped the concept of the ephemeral nature of HDD’s we can start thinking about how to address it.
MIRROR or RAID
Given that everybody in the IT world is aware of the inevitable failure of drives it comes as no surprise that there are solutions to the problem. Mirroring is the obvious solution – using two drives and keep identical copies of all files on each – if one craps out you’ve got a backup. Basic mirroring is implemented on many motherboards and is a simple and effective solution to our reliability problems.
RAID is glorified mirroring. I’m sure lots of IT people will jump up and down about this statement, but it is. RAID uses maths and more discs to do the same thing as mirroring in a more robust way. The main advantage is the disk space overhead is reduced – Mirroring needs double the number of disks to work and so you only get half the combined space. a RAID array only uses 1/3 of the space to protect for data.
So what to do if you cannot find a PC with any of the above?
Backups are tautologically the most important and the most boring things you have to get involve with when dealing with a computer. There are two types – to break it down:
A disk image is as it would suggest a byte by byte faithful copy of a disk. They are the singularly the most effective way of dealing with a critical disk failure and the simplest way of dealing with one. They are without doubt my preferred solution to backup because they deal with all the issues that arise out of a disk failure in one simple elegant solution. If you have an image of the disk you can restore the computer to exactly how it was prior to the failure. Copy an image back to you new disk and everything will be exactly as you left it. There are numerous ways of implementing disk images far too numerous to go into here but my recommendation is Acronis which does exactly what you want with minimum fuss.
This is the bodge it solution whereby you make a copy of all the files (you think) are relevant to another drive. The main drawback here is that configuration files are lost and (as in our particular scenario) complex things like databases are not correctly copied. File backups work in a singular world, they will look after protecting your accounts spreadsheet, they will not protect a whole machine.
Do it Properly, buy a New Dedicated Server Box.
The best solution to reliability is to buy a new dedicated server. When you start talking about “servers” people panic, but don’t worry there’s no great difference between a server and a normal PC, they just tend to be designed to take into account different requirements. Servers don’t need fancy sound cards or graphics cards. They do need to take into account things like disc drive redundancy instead.
My current favourite home server is the HP ML 110. Yours for only £180 quid. It features 4 drive bays so you can max out your storage, onboard RAID/MIRRORING so you can protect you data, is relatively small and almost silent in operation.
Here’s the break down on mine:
- Xeon Processor dual core 2.3GHz
- 4GB RAM
- 4 x Western Digital Green Disks in a RAID 5/Mirror configuration – Boot partition is Mirrored data is on the RAID.
This is complete overkill and mainly historic. I’d recommend 2 drives as a mirror and 1GB of RAM for pretty much any general installation.
The whole lot will probably set you back £250.
On top of this you need an external drive for backups. That’s probably going to be another £50 for a USB drive, unless you’ve got one already.
The software install/setup is a whole article in itself, but here’s a few pointers to get you going. Remember Google is your friend, there are no shortage of tutorials and forums to help out.
If your a windows sort of a person run a copy of XP/Vista/W7 and install WAMP. This gives you a nice graphically interface you are familiar with and all the components to get online.
If you want to be a the bleeding edge of geekery I’d angle for a copy of UBUNTU server along with LAMP. This is a bundle of all the necessary components to get a web server online in one nifty installer. The main advantage to this is it will cost you absolutely stuff all as it’s all open source software.
Once you have these up and running you need to install a CMS (content management software) to build your website. My CMS of choice of choice is Joomla, but I’ll save that for another article.