Slicehost Rocks

Posted by jph98 | Sysadmin | Friday 7 November 2008 12:28 pm

I’ve been with Slicehost for over a month now and first impressions of the service are very very good. I’ve been impressed with the overall up-time of the service, I’ve had no downtime issues with the websites I host there.  They also provide a few other value added services:

  • Rails based web management console;
  • Wide choice of distro’s (Debian Etch, Ubuntu, Gentoo, Fedora, Arch - as of Nov 2008);
  • Lots of how-to docs and tutorials;
  • Community features such as a campfire chatroom, irc, wiki etc…

The community side of things is particularly impressive.  It’s always got someone who can help with any issues you encounter and the guys there really know their stuff.  I can’t recommend this side of the service enough.

At present I pay $38 a month for a slice with 512MB ram, 10GB storage and 100GB bandwidth.  They provide a paid for backup service and I also backup the server via a set of rsync scripts which helps to avoid issues that I’ve encountered in the past.

They were recently acquired by Rackspace, along with JungleDisk in a strategic move to compete with Amazon it would seem.  I sincerely hope this doesn’t change the way the company operates or the service it provides.

Slicehost can be found here: http://www.slicehost.com/

Lighttpd Setup and the octet/application stream issue

Posted by jph98 | Sysadmin | Saturday 25 October 2008 7:31 pm

Lighttpd is a pretty nifty web server and a lot more lightweight than the likes of Apache, incorporating a number of similar features (webdav, rewrite, vhost, alias,compress) etc…

I just wanted to write a quick post on this as I didn’t find a satisfactory answer on the internet.  I had a small issue setting up lighttpd on debian.  One of the issues was that php pages were served up in Firefox as octet/application streams.  This was because the mime types were configured incorrectly in lighttpd.conf.  In order to fix this you have to define the mime types as follows:

http://redmine.lighttpd.net/wiki/lighttpd/Mimetype.assignDetails

It would seem that the config file provided with lighttpd is a cut down version, that then needs a lot of further work to get php based applications up and running.  Don’t get me wrong, this is a good thing because it teaches you the intracacies of web server configuration.

Essentially serving up php applications via Lighttpd requires fastcgi to be installed.

General Lighttpd Install
The following steps were required under Debian to install the latest version of Lighttpd from source:

  1. Install the Perl compatbile runtime expressions (pcre).  I got the latest version from: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.8.tar.gz
  2. Install php5-cgi, php5-cli, php5-common, php5-mysql packages using apt-get
  3. Install ruby-fcgi, I got this from
    http://www.moonwolf.com/ruby/archive/ruby-fcgi-0.8.7.tar.gz
  4. Install lighttpd from:
    http://www.lighttpd.net/download
  5. Configure and install using ./configure; make; make install

That’s about it, from there you need a simple startup script and some entries in the config file in /etc.

A word of advice, if you are migrating from Apache or similar web server then you can set Lighttpd on port 81 to test the installation and gradually move your applications over from there.

Technology Against Poverty

Posted by Caroline | Uncategorized | Tuesday 14 October 2008 9:00 pm

We live in a society that is online, mobile, wireless, but yet totally out of touch with the plight of thousands of people struggling just simply for daily survival. What has become everyday necessities to us, would make the world of difference to their lives.

Today is Blog Action Day - a nonprofit event aiming to unite the world’s bloggers, podcasters and videocasters in a fight against Poverty. As part of this, we wanted to take a look at what ways the realm of technology can be used in the fight against poverty.

Here are some examples of initiatives already using technology to help the fight against poverty:

One Laptop per Child - http://laptop.org/
Helping the world’s poorest children by providing them each with a low-cost, low-power connected laptop.

Computer Aid International - http://www.computeraid.org/donorsintro.htm
100% of donated computers that pass quality tests are provided to not-for-profit organisations in the developing world

Benetech - http://www.benetech.org/
Developing technology that truly helps the World.

Grameen Foundation - http://www.grameenfoundation.org/what_we_do/technology_programs/
Combining the power of microfinance, technology and innovative solutions to defeat global poverty.

Only One Pound - http://www.onlyonepound.org/index.aspx
Forget Ebay, use this online auction tool instead.

The Internet (a little online education goes a long way)
Indian man finding jobs scarce uses the internet to help him find work through http://babajob.com/
News Source: http://www.nytimes.com/2007/10/30/technology/30poor.html

So you see - technology can help in the fight against poverty. Have an old computer? Donate it! No need for those already read books on the shelf? Auction them!

This is just a snapshot of the ways that technology can help in some small way. Perhaps everyone should take the time to look at ways to use technology to help others, rather than looking for the next technological advancement to help themselves. Then, maybe we could do our part to make poverty a thing of the past.

If you have know of any other great poverty-fighting initiatives, please add their links below.

VPSVille - When hosting goes wrong

Posted by Jonathan | Sysadmin | Monday 13 October 2008 11:02 am

I have a funny story regarding a VPS hosting company called VPSVille, actually it’s not a funny story… it’s pretty annoying.

I changed my hosting provider when I moved over to Canada to a company called VPSVille:

www.vpsville.ca

I was originally with a great little company called Bytemark in the UK:

www.bytemark.co.uk

but wanted to move because I wanted to a VPS this side of the “pond”.  VPSVille looked to be good from what I saw of their website and reviews about them.  This is what VPSVille have on their front page:

"Welcome to VPSVille, one of the most advanced VPS service providers on the internet. Virtual Private Servers (VPS) are the future of web hosting. A VPS performs and executes exactly like a stand-alone server; Your VPS can be rebooted independently and have root access, users, IP addresses, memory, processes, files, applications, system libraries and configuration files. This website is being hosted on one of our VPS's."

I was a little concerned about a few things backups, in particular seeing as I’d previously had a backup server with Bytemark.  Besides the VPSVille FAQ stated:

"we perform regular backups of all our servers and also allow for all users to make their own backups from our custom control panel. You can choose when to backup your server and when to restore it."

So all good, First impressions were pretty good, cheap, lots of bandwidth for what I wanted, full root access and an installation of Debian Etch, Centos, Fedora whichever I wanted.  I migrated all my websites over along with my MySQL database onto a fresh new Centos install.  I hosted Subversion and Mercurial there, used it to backup my thesis etc…

Gargh
This was back in May, all was good for the next six months or so… until two days ago (Tuesday 7th October to be exact).

All my websites went down that evening…
I figured it was a glitch…
They didn’t come back up the next morning…

I figured something was drastically wrong so I posted a support ticket.  No reply, in fact an hour later the entire support portal was removed from their website along with the user forum.  I decided to have a look to see if anybody else was having similar problem finding this thread on webhostingtalk.com:

http://www.webhostingtalk.com/showthread.php?t=727603

I was in the same position as a lot of other people.  It would appear that VPSVille had pulled the plug on their customers.

VPSVille Announcement

A while later the following announcement appeared on their website, not on the front page I might add, and in very broken English without the use of a spell checker:

"On October the 7th we exeprienced what looks like total failure of some storage devices. This has resulted in data loss for many customers that have been migrated to these new systems. Data recovery is not possible, and we are unable to allocate space for these customers on other nodes. This is a terrible situation and if we could salvage the data in some way we would, but unfortunately its not possible. This data is lost permanently. We also lack the capacity to move affected customers to other nodes.

We are working hard to add more capacity but it will be some time until its online. We are therefore forced to cancel these accounts and starting next week will be refunding all affected customers. We have also suspended all new sign-ups until this situation is resolved and VPSVille returns to normal operations.

Due to the volume of support requests we are unable to respond to affected users individually at this time. We will be in contact with you in the future. Your patience in this regard is appreciated"

so in short we were all pretty screwed and very very annoyed.

The Response
A while later vpsville posted an entry on the forum:

"Hello, we have an announcement on our site now explaining our predicament.

Unfortunately, the data that was lost is permanently gone, and we can't recover it. We will be canceling all affected accounts and refunding users.

The reason for the outage isn't power related as we at first thought, it turns out there was a malicious attack on our servers aided by an internal leak. We won't be accepting new customers until we rebuild all of our servers and templates to ensure they were not tampered with.

This was devastating blow to our business and we understand that our valuable customers are also victims.

When we begin accepting new customers again, rest assured we will be better than ever, and more focused than ever on providing good value hosting for the Canadian market."

It doesn’t really make things any better does it?  As well as admitting that you didn’t have a sufficient redundant setup in place you’re now telling us that you don’t have the required security measures in place.  In short I lost six websites I’d been working on for two years, a whole Subversion repository (which contained months worth of my thesis work) and lots of other important documents - thanks vpsville!

Moral of the Story
I would advise a number of things here when choosing a Virtual Private Server (VPS) Hosting Company:

1. Research your VPS hosting provider before you invest money, time and effort.  Look at reviews on the internet.  Look for well written reviews from people who clearly explain the issues they had with the hosting provider and what they did about them.

2. Choose an established company not amateurs who have purchased a dedicated server and are looking to divide it up in order to make some quick money.

3. Always, always, always backup your server - even if your VPS provider claims to do this.  You can look at rsync as the simplest method, but there is also rsnapshot or rdiff-backup.

4. Never ever host with VPSVille, full bloody stop.

Update From VPSville (Thanksgiving - ironically)
I had a fairly decent update from VPSville, after a week and a half:

We here at VPSVille have had a few days of frantic phone calls, hair-pulling, yelling, crying, screaming, sector-recovery tools and angry accusations. We've also looked closely at our logs and have pieced together what happened with our recent data loss incident.

Initially we thought it might be a case of gross negligence and some harsh words and harsher threats were exchanged, but we now believe it was just an honest, stupid mistake. Inexperience sunk the ship.

One of our new employee's made some crucial errors regarding security, and this was compounded by one of our techs travelling abroad and requiring some relaxation in our usually
strict access policy. One firewall in front of another and both temporarily disabled = no firewall at all.

This unfortunately resulted in some malicious SOB with no real life to waltz into an almost unprotected segment of the network through a newly installed appliance with a default password
and start deleting things. Several servers actually and a NAS unit assigned to back them up. One of the servers was our control node, which interfaces between the website and the other servers. Even our mail server was affected.

Some servers were running even after their files were deleted, through some strange quirk of Linux buffering that we still don't fully understand.

Its easy to blame a hacker of course, but we do feel that an unfortunate series of events combined to make their hack particularly easy. Far to easy for a network of this magnitude and importance to so many people.

This looked like a total loss, with no way to recover the data, so we sent out a somewhat panicked email to affected users that their accounts would just be canceled and refunded. Shortly afterwords our outgoing email died.

This resulted in a torrent of email, most of it surprising friendly, and much of it understandably angry and dismayed, telling us they wished to remain customers even if their data was not recovered.

Happily we were able to restore many servers with sector recovery tools. In light of this we have not arbitrarily canceled any accounts.

All affected accounts are re-enabled and have been credited. If we were able to restore your data we have sent you an email about it (hardware nodes rapier, cutlass and spear).

We sincerely express our condolences to affected customers for this unfortunate series of events, nobody should lose data at VPSVille, its an awful thing and we feel your pain.

Things do happen in life, but this won't happen again.

- Staff"

So, just to add salt to the wound they admitted poor infrastructure, poor security measures, giving junior employees work to do without providing sufficient training and a complete lack of communication on the issue.  They also claimed they sent the server disks away for recovery.  In fact what they did was to attempt to recover the data using their own tools.

The final reply I got from them on their forums stated this:

We used several tools, including one given to us by adaptec support. None of the tools were able get the files on Katana. The tools let you view the bytes on the drive in various ways. Its quite interesting actually, if you'd like to know how sector recovery works read up on it or try it yourself.

You need to understand that interrogating us will not get your data back. Your data stored on Katana is gone. We tried our best."

to which I responded:

"No, no.  You said you sent the drives off for sector recovery.
That is not the same as using some tool you found on the internet."

I understand that interrogating will not get my data back...
I was just trying to ascertain exactly what measures you went to in order to recover the data.

I'm still incredibly annoyed about the lack of communication here, the explanations, the complete lack of professionalism you've demonstrated.

You're obviously not willing to go to any further measures to recover the data. I'd like a refund on my complete hosting charges with you, that amounts to $135.00 in total which is nowhere near how much it will cost me to reimburse the clients I have and the data they have lost."

I didn’t get a reply.

and most recently:

"I noticed you haven't applied for a refund, yet you seem very angry. I'm angry about losing data too, but I blame the people that deleted it, not the people who spent days trying to recover it, at no charge.  Please submit your transaction details to refunds@vpsville.ca and I'll expedite the process for you."

I had sent my refund, but due to their normal unorganized ways they’d obviously missed it - doh.

You have been warned about hosting with VPSVille.

Some Amusing Industry AntiPatterns

Posted by Jonathan | Design | Sunday 12 October 2008 8:47 pm

Back last year I carried out some developer interviews for my thesis at a company in the UK. Part of the interviews looked at anti-patterns that developers thought were important in the workplace. A number of these related back to the “Anti-patterns: Refactoring Software, Architecture and Projects in Crisis” book by Raphael Malveau et al… but a number of them we talked about were somewhat interesting (if only amusingly by name). What they described were issues we had faced during development with software, people and systems. They were not documented in any real depth, but a brief summary follows:

Inappropriate Use Of Patterns - Overuse of patterns or misunderstanding of patterns
Pattern Of The Week,Using a pattern for the sake of using that pattern

Tier Leakage (Cross Cutting Code) - “Using objects from one tier in another, i.e. presentation tier objects used in the integration tier”.

The Upstart - A developer who kicks up a stink about poor code, but does the same thing himself.”

Cowboy Coding/Non Learner - A person who does not want to learn about good principles or practices. They just want to get the job done quickly and ride off into the sunset.

Data In Session - Putting data into a HTTP session haphazardly.

Stick In The Mud - When someone is continually obstructive and prevents others from making progress possible because of their position of authority.

Square Peg Round Hole - Using a pattern or principle where it does not fit or causes a great deal of unnecessary complexity.

Inappropriate Reuse - When using a framework or tool is overkill and simple code could have sufficed instead.

Job Consolidation - “Consolidation of a developers’ position through the production of unreadable, unnecessarily complex code.”

Firefighting - “Continually bug fixing a system that is poorly designed, incredibly brittle with little testing in place.”

Overengineering - “A bit like YAGNI, trying to cater for improbable scenarios.”

Continual Patchwork - Continually patching or adding new features to a system when it really should be re-architected.

Hardcode Central - “Hard coding business rules that need to change often e.g. resource locations (databases, email servers etc…).”

Kerplunk - “A small change to the system breaks many things, this is inherent within brittle, poorly architected systems.”

Too Many Cooks - Having too many technical architects/leads who cannot agree on an approach to a problem.

Last Person To Leave - Blaming the last person to leave for bugs or poorly written code. A type of blamestorming.

Websphere Install On Ubuntu Hardy Heron

Posted by Jonathan | Sysadmin | Sunday 12 October 2008 8:46 pm

I recently underwent the painful process of installing IBM Websphere 6.1 on Ubuntu Hardy Heron (8.0.4). there was one issue in particular that I wanted to share involving the process of creating a Websphere profile in order to start a server. This involves running the manageprofiles.sh file with something similar to the following:

sudo bash -x manageprofiles.sh -create -profileName
-profilePath /opt/IBM/WebSphere/AppServer/profiles/
-templatePath /opt/IBM/WebSphere/AppServer/profileTemplates/default/

This fails on Ubuntu with the following error message:

INSTCONFFAILED: The profile could not be created.  For more information, consult the
/opt/IBM/WebSphere/AppServer/logs/manageprofiles/AppSrv01_create.log file

Tracing through this logfile yields the following warning:

/opt/IBM/WebSphere/AppServer/profileTemplates/default/action/generateKeysForSingleProfile.ant:25:
wsadmin task failed with return code :-1

which involves running a shell script called wsadmin.sh which in turn calls this Ant script. It’s not immediately obvious, but the reason this fails is because under Ubuntu the default shell is dash rather than bash. There are two solutions to this

1. Unlink /bin/sh

sudo unlink /bin/sh
sudo ln -s /bin/bash /bin/sh

2. Reconfigure via dpkg

sudo dpkg-reconfigure dash

Amazon Elastic Compute, EC2

Posted by Jonathan | Uncategorized | Sunday 12 October 2008 8:46 pm

I’m sorry, I’m quite confused about Amazon’s new offering - EC2. It sounds great in theory, elastic IP addresses, cool, persistent storage (eventually - cool), availability zones (cool). However, it’s pretty much the same as paying for a virtual server actually - that’s where my problem starts, how is it different? Ok, so you can fire up your new service using a specific distro, Fedora whatever, yada yada and you can add more instances of that service and have failover between them, groovy but I’m pretty sure you can do this with an existing hosting solution, take Bytemark for example (http://www.bytemark.co.uk/) I’ve been with them for about a year now, I pay around 150 GBP ($300) for the solution per year. That buys me a managed Centos installed O/S on a virtual machine that has 150MB RAM, 10GB space, 50GB in traffic, 2GB backup space, some watchdog type services. I have full root access and can redelegate IP addresses to the DNS as I wish, I can setup more virtual machines via Xen if I want. With Amazon I get:

1.7 GB of memory, 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit), 160 GB of instance storage,

Amazon EC2 is a little easier to manage since I can install an O/S on the fly (which is non persistent as present) but have less control over it and ok it’s more powerful, but at what cost - well the basic amount is $0.10 per hour. Before traffic that’s

24 * $0.10 = $2.40 a day
365 * $2.40 a day = $876.00 per year

Traffic on top of this is $0.10 per GB, so matching with Bytemark that’s another 5 dollars on top so it scales pretty well with regards to that. However, $300.00 a year as opposed to nearly $900.00 a year… For $1200 with Bytemark I get my dedicated server, I’m pretty sure this comes in cheaper than this when we look at dedicated servers in North America. It’s confusing as to whether it’s good value for money or not…

Design Pattern Relationships

Posted by Jonathan | Design | Sunday 12 October 2008 8:45 pm

I’ve been looking into design pattern relationships until recently and didn’t realise that there has been work done in this area in the past. I find it awkward sometimes to understand how patterns relate to other patterns and which ones should be used in certain scenarios. Judging by the community I guess I’m not on my own. I recently found out that there are various classifications of patterns, not just the arrangement of patterns laid out originally by the Gang Of Four (which I don’t find that useful to be honest) in terms of their scope and purpose:

1. Zimmer (1995) suggested a set of horizontal layers to divide the patterns and proposes some new patterns which encompass sets of patterns. An example of this is the Objectifier pattern which encompasses the Strategy, Builder, Command and Visitor patterns. In order to relate the patterns Zimmer proposes a set of relations (X uses Y in solution, X is similar to Y, X can be combined with Y). This provides a new way of working with patterns since a developer can find out which patterns can be used together and which patterns achieve the same goal.

2. Noble (1998) discussed three new primary relationships for patterns, a pattern uses, refines and conflicts with another pattern. He also describes a series of secondary relationships with a pattern being a variant of another pattern, two patterns being similar or two patterns combining to solve a problem. Noble also describes sequences of elaboration which refers to a sequence of patterns beginning with small simple patterns building up into large scale architectural patterns.

3. Tichy (1998) looked at categorizing a large number of software patterns from various sources based on their purpose. The patterns selected were general purpose patterns, i.e. patterns that can be used in many different systems irrespective of their domain. They proposed a number of different categories to contain the patterns based on the problem they solved. Some of these included decoupling, state handling, control, concurrency and distribution.

There are others, people may be familiar with the J2EE pattern blueprints that describe how each of the J2EE patterns relate to each other:

http://java.sun.com/blueprints/patterns/index.html

This is kind of interesting because it provides a big picture for us to focus on, a top level hierarchy of patterns and how they are arranged from the enterprise down.

Also one more note, most people think of patterns as being the Gang Of Four design patterns but there are loads of other pattern types as well:

Antipatterns [Brown98];
Enterprise Architecture Patterns [Fowler02];
Elementary Patterns [Wallingford98];
Concurrency Patterns [Schmidt06];
Analysis Patterns [Fowler96];
Micropatterns [Gil95];
Re-engineering Patterns;
Process Patterns

etc… etc…

Lighttpd, Tomcat, mod_proxy

Posted by Jonathan | Sysadmin | Sunday 12 October 2008 8:43 pm

Just a quick guide to setting up Lighttpd (http://www.lighttpd.net/) and Tomcat using mod_proxy. there are only two steps involved here:

1. Make sure mod_proxy is enabled in the list of server.modules

server.modules = ("mod_proxy",
...

2. Add a HTTP host block to redirect requests on localhost to port 8080 for Tomcat.

$HTTP["host"] =~ “127.0.0.1|localhost” {
proxy.server = (
“” =>
(”tomcat” => (”host” => “127.0.0.1″, “port” => 8080, “fix-redirects” => 1) )
)}

Eclipse Not Starting

Posted by Jonathan | Java | Sunday 12 October 2008 8:43 pm

Had a weird issue with Eclipse not starting, it would bomb out with the following exception:

JVM terminated. Exit code=1
/usr/bin/java
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=768m
-Xms256m
-Xmx1024m
-jar /home/jon/eclipsercp/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
-os linux
-ws gtk
-arch x86_64
-showsplash
-launcher /home/jon/eclipsercp/eclipse
-name Eclipse
--launcher.library /home/jon/eclipsercp/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.0.3.R33x_v20080118/eclipse_1023.so
-startup /home/jon/eclipsercp/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
-exitdata 257000e
-clean
-vm /usr/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=768m
-Xms256m
-Xmx1024m
-jar /home/jon/eclipsercp/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar

Under the workspace folder there are a number of files and directories:

.plugins
.mylyn
version.ini
.lock
.log

Normally deleting the .lock file seems to cure this problem, but it didn’t in this case.

In order to cure it I had to go into

.plugins/org.eclipse.core.resources

and remove the .snap file. This sorted out the issue and allowed me to start Eclipse again. Unfortunately I lost all the projects within the workspace and had to reimport them (grrr).

You can alternatively try running the Eclipse Workspace Rebuilder (http://www.eclipse.org/eclipse/platform-core/downloads.php). Unzip the rebuilder zip file and run it using:

eclipse -application org.eclipse.core.tools.restorer.application

It doesn’t restore everything, only the basic state of your projects.

Next Page »