Building a Chef server from scratch

As I explained to my non-techie brother-in-law when he asked how I’d spent my weekend: “We have a task that requires a car. The car we have now is serviceable, but it creaks a bit, and if any bits of it fell off or the whole thing caught fire, fixing it would be extremely difficult. What we have now, with this thing I’ve built, is a factory for churning out identical Ferraris by the dozen.”

 

Apparently this is the first time I’ve ever explained anything about my job in a way that made sense to him. 

 

Chef is something we’re using more and more for Ops at AMEE. We have our own Chef server, which works OK, but was put together in a rather ad-hoc way – it’s basically a big pile of Technical Debt. This was starting to bother me, so I sat down on Friday night to see if I could come up with a better solution.

OpsCode have this excellent guide to installing your own Chef server, which serves as a fine starting point, but I took a diversion into RVM and Ruby 1.9.2, and also installed a newer version of RabbitMQ.

Chef has all sorts of dependencies on all sorts of technologies. Of particular interest are:

  • Java – Oracle, ever the friend of Free Software, recently made it more difficult to install Java on Ubuntu. On Friday night, however, I stumbled upon this witchcraft which apparently downloads the sources and prepares deb packages locally, which we can then install. I didn’t look too deeply into this (and Heaven knows what Oracle will make of it), but it works and it’s mind-blowing. Oh, and Java is required because Solr.
  • Ruby – Chef runs fine on Ruby 1.8, but I’d much rather use 1.9.2 these days. This is currently not in the Ubuntu apt repos (at least on Lucid, our current release of choice), so we turn to RVM.

So I followed the instructions in the OpsCode howto, and by about 02:00 on Saturday morning I had a huge number of VirtualBox snapshots, a page of notes, and a working Chef server!

I transcribed the notes into a clunky first-draft script, then I set about making all of this stuff start at boot-time. The Chef gems come with upstart scripts to kick things off, but these want to run everything as root, and we’d rather use the ‘chef’ user. So we attack these scripts with a horrendous sed monster until they look like this:

# chef-server - Chef Server
#
# Chef Server provides the Chef API server

description "Chef Server API"

start on filesystem
stop on runlevel [!2345]

respawn
respawn limit 5 30

pre-start script
  su - chef -c "which chef-server" || { stop; exit 0; }
end script

script
  su - chef -c "chef-server -e production -p 4000 -L /var/log/chef/server.log"
end script

and that’s all there is to it.

So I now had a working script, but what I really wanted was to make it idempotent. VirtualBox snapshots are great for this:

A whole lot of VirtualBox snapshots

So after a  long afternoon of testing, breaking stuff, and reverting to previous snapshots, I had produced this. To install it from scratch on a pristine Ubuntu Lucid node, you can do this:

sudo apt-get install -y curl ; bash <(curl -s https://raw.github.com/gist/1869395/179c776758d8aae317b63fa87c447b821fb420a4/catering-college-installer) 

It will probably work on other Debian-ish distros, and it might even play nice on a box that already has some of this installed, but be very careful if you already any Solr data you care about: chef-solr-installer will nuke it all.

Hope somebody finds this useful.

Posted in Developer news | Leave a comment

AMEE Platform Update

AMEEconnect

This morning, AMEE deployed an updated version of AMEEconnect to the stage AMEE platform.

The change in this release of the AMEE platform is a bug fix for certain (rare) drill down conditions.

We expect that this change will be deployed to the live AMEE platform next week.

Posted in Developer news | Leave a comment

AMEE wins Rushlight Award for Environmental Analysis and Metrology

The Rushlight Awards showcase innovative cleantech for the future.

Against “very strong competition”, AMEE won the peer-reviewed, lead award for Environmental Analysis and Metrology (in case you don’t know Metrology is the science of measurement).

We were also shortlisted for the Group Award for Environmental Management (which ultimately went to waste-to-energy technology company, Plasma Power)

I was also delighted that one of AMEE’s original startup team was the keynote speaker – Bryony, now Baroness(!), Worthington said: “I like to quote Alan Kay – the man credited with the invention of the personal computer – he said ‘the best way to predict the future is to invent it’. And that is why everyone in this room is here tonight – you are all involved in inventing the future.”

Now in their 5th year, the RSA-accredited Rushlight Awards are a celebration and a promotion of new technology, innovation and best practice across the whole environment spectrum for organisations throughout UK and Ireland.

Designed to highlight innovation and the holistic environmental benefit of technologies that are most likely to or are already creating a stir in the market, they are a means of disseminating the successes to support further development.

The group and overall winners will be eligible to be considered to represent the UK in the European Business Awards for the Environment 2014.

 

Posted in Company news, Events we're attending | Leave a comment

Hackathons aren’t just for geeks. London Green Hackathon welcomed all and sundry to hack for good!

What is a Hackathon?

To a non-programmer with a background in corporate software sales & marketing the word “hack” conjures up images of swarms of programmers attempting to break into closed government networks.

Definitions include: “A hackathon is a gathering of programmers to collaboratively code in an extreme manner over a short period of time” http://www.techopedia.com/definition/23193/hackathon “A hackathon is a collaborative event where programmers, designers, and creative people meet to build programs and applications.”  http://hack4reno.com/hackathon/  

The “extreme” side of our London Green Hackathon these events is that a handful of the really committed coders stay up all night to bring their ideas to fruition. Fortunately, with many seasoned hackers in AMEE it became clear I would not have to do that. As a non-techie my role would be to offer some business ideas and commercial feedback on the viability of ideas developed.

 A collaborative format. Aside from just over an hour upfront of presentations from our sponsors (who kindly paid for the event and put up the prizes) it was fixed that at 12 noon hacking would start.  This begun with the hackers standing up to pitch their hack to the room, share the tools and tech they had and outline what help they needed. 

Examples ranged from offers of database and design skills to individuals who could provide unique chunks of energy efficiency related data from buildings. This is an event focussed on the programmers – showing off what they can do in a fully focussed environment, with a free reign, supporting resources and an immovable deadline –in our case 5pm on the Sunday.  Many dedicated programmers stayed up through the night to execute on their ideas

Our sponsors got involved. We had fantastic support from industry, ranging from corporate software houses (check out this review from Autodesk) to SME start-ups making their tech tools and data available to government innovation teams putting up cash bounties for the best hacks. 

All the sponsors got involved, walking the room during the welcome coffees, engaging with developers and bringing data, tools and ideas to the day. The judges on day two also got amongst the attendees sniffing out talent and translating tech ideas and concepts into broader business value. 

Who was there?  We had no hard and fast rules on restricting attendance although we did make an effort to ensure as many developers as possible. However, our “Green Hackathon” included many types who did not fit the software developer mould but who often brought some unique and valuable input to the event:

The PHD student using the event to support her thesis.  She brought unique data and a load of passion to get involvement from others on her idea.  Those who attended the London Green Hackathon may recall who this was – she worked the room and got together a hit squad that hacked her data into a useful prototype app, which won the energy management hack category.  Nowhere else could this have happened

Businesses hunting for talent. Aside from some of our sponsor companies we had a few other business folk show up from start-ups. Whilst they stood out against the backdrop of T-shirts, cheque shirts / jeans developer brigade the event offered a unique chance for them to meet and witness first-hand the skills, enthusiasms and mind-sets of developers with a passion in the CleanTech / start-up sector.   What better way to ensure your next developer hire hits the mark than see them perform in a deadline driven, collaborative team based environment? Sponsors Trucost and ITOWorld both took this opportunity as did guest attendance coming in from Tendril

The entrepreneur with a cool tech idea but limited time and resources.  At a Hackathon they can rope in others, build a team and have a go at prototyping the idea.  “Mastadon” the winning hack at our event did just this by getting together a team who showed off how the web and mashed up available data can be used to source the greenest and cleanest cloud services

The curious venture capitalist – looking to get in early on any crazy ideas that could actually end up being disruptive.  We managed to rope in Jason Pinto from Amadeus

Developers came from far and wide – we had attendees from universities in Bristol, Scotland and London as well as representatives from the digital agency / tech start-up world across the UK

As a BusinessCat (the aficionado my colleagues bestow on me) what did I get from the Hackathon? Great insight into how a group of technically talented people thrown together with some creative ideas and a common purpose can get some really cool stuff done – fast! 

To paraphrase on the A-Team’s opening sequence if you are not a programmer if you are someone with an idea and if the data exists, if nobody else can help and if you can find the right one maybe you should attend a Hackathon…

For update son future London Green Hackathons  join our linkedingroup.  

 

 

Posted in Company news | Leave a comment

Innovation at the AMEE Green Hackathon

“Awesome” was the word used by the judges to describe the winner of the Innovation prize.

Having attended many hack events, I was very impressed by the extremely high quality of the output.

 

Over 130 people registered for AMEE’s first Green Hackathon, and around 100 participated over the weekend (including a hard-core of all-night coders).

Interestingly, this Hackathon wasn’t just for coders. We put a lot of effort into creating themes and bringing together domain knowledge about enviornmental sustainability with developer skills: some participants simply turned up with an idea, and found a coder to help them build it!

As a result, almost all of the hacks focussed on business problems, not consumer problems, and all focussed on the notion of CleanTech-meets-Web (also coined as CleanWeb in the USA).

We are extremely happy with the energy and outcomes produced, and hope to see at least one of the projects attempt to build out into a business. We are obviously also delighted that many of the winners and projects used AMEE as part of their solutions – we know from experience that hackdays are extremely unpredictable (in fact our own James Smith added an API to AskAMEE during the weekend so that it could be used more easily in one of the projects!)

Watch the videos here

Thank you everyone for your time, effort and, for our financial supporters, the Technology Strategy Board (TSB) and our sponsors:

  • Gold: 

Autodesk, UCL Adances, and UK Department for Business Innovation & Skills (BIS)

  • Silver:

Amadeus Capital Partners, European Institute of Innovation & Technology (EIT), Forum For the Future, ITOworld, Opower, Trucost, and 2degrees

 To read more about the event click here >>

The Winners

The Hack Day judging panel selected winners based on the following categories:

Other Presentations

Everyone was excellent, but unfortunately not everyone can win! Here are the other hacks built over the weekend:

Posted in Company news, Events we're attending | 1 Comment

AMEE Platform Update

AMEEconnect

Earlier this week, AMEE deployed an updated version of AMEEconnect to the live AMEE platform.

The main changes in this release of the AMEE platform are:

  • A bug fix for a new calculation API call (to be announced soon!) for categories which have historical emissions factors (e.g. eGrid categories); and
  • A bug fix to eliminate delays in authenticating when AMEEconnect API key passwords are updated.

This deploy follows on from the same version having been deployed to the stage AMEE platform last week.

Posted in Developer news | Leave a comment