Showing posts with label architecture. Show all posts
Showing posts with label architecture. Show all posts

Thursday, 7 November 2013

Agile Testing Days take-aways #3 - Infrastructure Testing with Jenkins, Puppet and Vagrant

Infrastructure-as-code (IaC) tools, such as Puppet and Chef, have fascinated me since I first became aware of them about three years ago, and I'm very excited that my organisation is now making use of them. Attending this session was thus an easy choice to make. Carlos Sanchez delivered a well balanced talk that was high-level enough for newbies to understand, but still provided enough meat to satisfy those familiar with the concepts. You can read the abstract and grab the slides from his blog.

I had two direct take-aways from his talk, one technical, the other cultural:
  1. Carlos shared how RSpec-puppet can be used to assert that packages are set up correctly - think acceptance-test-driven-development for puppet.
  2. There was a great quote and this picture at the very beginning, which gave the Printing Press as an example of a tool can lead to significant cultural change. The quote was from Patrick Debois: Tools can enable change in behaviour and eventually change culture. This is controversial point, because, in the case of BDD, for example, using tools too early can hinder or even prevent the right kind of culture change. Choosing the right tool at the right time is a difficult decision to make, but one we shouldn't be afraid of.


Following his talk, Carlos and I met up to have a deeper discussion on the following practices.

Environment specific variables and configuration servers

One of the benefits of IaC is that it helps overcome environmental configuration issues, by explicitly codifying each environment's configuration. A few years back, the concept of a configuration server was mooted, which also partly addressed this. The concept involves a central server and configuration repository, from which applications retrieve their configuration (via HTTP, for example), by telling the server where their running. We discussed how IaC solves this, and whether configuration servers are now redundant. Our conclusion was that environment specific variables (e.g. connection strings for QA, Pre-Prod, Live) should be separated from recipes into environment specific files. It's still worth considering the use of a configuration server, quite separate from Puppet/Chef. I think experimentation would be required to establish if this separation was beneficial or not. If any readers have experience of this, I'd love to hear it.


Should engineers develop on local, remote or cloud VM's?

IaC tools can lead to the increased use of Virtual Machines (VM's) throughout the development process, including an individual engineer's dev-environment. This raises the question of what's the best host for VM's used for this particular purpose. Is it better that they be hosted locally (on the engineer's own laptop), remotely on a VM Server, or remotely in the cloud (e.g. AWS). There are many trade-off's to make in deciding this, but our discussion concluded with the instinct that (beefy) local hosts were best.


What's best: immutable images or a clean base + recipes?

Martin Fowler has an excellent article that presents the concept of immutable images (a VM image that needs no configuration), and compares them to deploying binaries that need no further tinkering nor configuration. At first, this seems to go against the IaC concept of having base images that source-controlled recipes fully define the configuration of. When you evaluate this in practice though, a hybrid of the two practices gives the best of both worlds, as using an immutable image significantly speeds up chef execution and deployment. The immutable image should be created, though, by using a clean base image and a source-controlled set of recipes. The image and it's recipes should be updated every couple of weeks, depending on your release cycle.

Who chef's the chef / who puppet's the puppet?

Chef/Puppet recipes include definitions of required applications, where to get them from, and what version to get. So where do you define what version of chef to use (in order to keep it consistent and up-to-date)? Carlos suggested this could be achieved by a mix of running update scripts and using chef recipes themselves.

Friday, 8 March 2013

Our first public coding dojo


Tuesday evening saw NewVoiceMedia host its first public Coding Dojo, under the auspices of the Guildford Meetup Group.
Dojo literally translates from Japanese as “place of the way” (Wikipedia). It’s a place where students hone their skills in a given art. The art, in our case, is writing maintainable code. Dojo’s normally use katas to develop the skill: kata being the deliberate, repetitive practice of the technique, to improve one’s expertise in that area.
We were led by the excellent Chris Pitts who did a fantastic job of guiding the six students (four from NVM) through the FizzBuzz puzzle:
Output the numbers 1-100, but for numbers divisible by 3, output Fizz, and numbers divisible by 5, output Buzz. For numbers divisible by 3 and 5, output FizzBuzz.
This appears at first to be a very simple puzzle, which can be solved in under five minutes by an expert. Chris provided a great extension to this puzzle (applying the Single Responsibility and Open Closed Principles) that stretched even the most seasoned programmers present. All in all, it was a very fun and educational evening. The pizza and coffee was pretty good too!
We look forward to the next one!

Tuesday, 2 August 2011

Making a Restful WCF service vary its response

A natural fit with the HTTP architecture is to have a WCF service vary the response contents according to the MIME type set in the Accept header by the client.

Whilst this is easy to do using the WCF Web API, it is slightly more challenging in an application using regular WCF (even WCF 4).

The specific scenario I needed to handle was:

  1. Given a request for a resource.
  2. When the Accept header is not set, respond with the appropriate default representation (e.g. XML/JSON object).
  3. When the Accept header is set to a relevant MIME type, e.g. application/png, respond with a stream containing the PNG representation of the resource.
  4. Due to the architecture being used, the method's response type could not be the Message type, but had to be that which represented the default resource representation.

The solution I finally arrived at was greatly added by this great post on IOperationBehaviour and the WCF Web API PngResponseFormatter. A sample solution can be downloaded as a zipped VS 2010 solution.

Friday, 27 April 2007

QCon 2007 - What I learnt about architecture

This is the first post in a series that summarises what I learnt at QCon 2007.

This post focuses on solution architectures.

For a mind map version, click here QCon 07 Architecture Notes

Inspiration came from the following excellent sessions:

Replacing Amazon's architecture

  • Monolithic application to SOA
  • Took 6 years
  • Cost $2 billion
  • Only 30% of cost delivered visible business value
  • 70% was on the "heavy-lifting"

Architecture relates to

  • how it runs
  • how it fails
  • how its developed
  • how it changes during
    • development time
    • run-time

Architecture is interwoven with the development process

Operational manageability

  • Design for
    • operational configuration
    • operational monitoring
    • failure (no SPOF's)
  • Maintain clear dependencies

Design up-front the parts that are costly to change

  • Reduce the significance of remaining decisions
  • Defer decisions to the last responsible moment
  • Metric is cost of reversing decision
  • e.g.
    • testability
    • security
    • maintainability
    • performance
  • Its like putting stones in a bucket.
stones in buckets

How much up front design (UFD)?

  • BUFD - Big
  • RUFD - Rough
  • NUFD - None
  • Time spent should be inversely proportional to
    • Knowledge of domain
    • Experience in design

Quotes

  • "A stable architecure is not the same as a frozen architecture"
  • "Doing the simplest thing that works is not same as doing the easiest thing"