Contract Principal Consultant and Technical Lead

Category: agile-engineering

Blue/Green and Canary Deployments with Spring Boot, Docker and GKE.

This is a simple code example of performing a Blue/Green and a Canary deployment of a Docker-packaged Spring Boot Microservice to Google Kubernetes Engine.

It’s just the basics to get you started in 10 minutes.

Checking out the source

You can check out the source here.

It’s a basic Microservice that echoes a message that you pass.

Bash
git clone https://github.com/johndobie/spring-boot-gke

All of the instructions are also here

https://github.com/johndobie/spring-boot-gke

Run Standalone

Start the Microservice locally and pass it a test message to echo.

Bash
mvn clean spring-boot:run

curl http://localhost:8080/echo?message=testmessage
Host[192.168.0.13] : testmessage

Run In Docker Locally

Create the image and then run the service in docker.

Bash
 docker image build --tag="spring-boot/echo" .
 docker run -p 8080:8080 -t "spring-boot/echo"    

Run In Google Shell

Bash
https://console.cloud.google.com/cloudshell/open
?git_repo=https://github.com/johndobie/spring-boot-gke.git
&page=editor
&open_in_editor=README.md

mvn clean spring-boot:run

Run In Google Shell with Docker

Bash
https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/johndobie/spring-boot-gke.git&page=editor&open_in_editor=README.md

mvn clean install
docker image build --tag="spring-boot/echo" .
docker run -p 8080:8080 -t "spring-boot/echo"    

Run With Kubernetes

Open Google Shell

Bash
https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/johndobie/spring-boot-gke.git&page=editor&open_in_editor=README.md

Create and set the project

Bash
gcloud projects create spring-boot-kubernetes-echo --name="Spring Boot Echo on GKE"
gcloud config set project spring-boot-kubernetes-echo

export PROJECT_ID=”$(gcloud config get-value project -q)”

gcloud projects list
gcloud beta billing projects link spring-boot-kubernetes-echo --billing-account 003146-4D6988-3DC95C

Create the Docker Image

Bash
gcloud services enable containerregistry.googleapis.com

docker build -t echo-container-image .
docker tag echo-container-image gcr.io/spring-boot-kubernetes-echo/echo:v1
docker push gcr.io/spring-boot-kubernetes-echo/echo:v1

Create the Kubernetes cluster

Bash
gcloud services enable compute.googleapis.com container.googleapis.com

gcloud container clusters create echo-kubernetes-cluster \
  --num-nodes 4 \
  --machine-type n1-standard-1 \
  --zone us-central1-c

Deploy The Application

Bash
cd src/main/docker
kubectl apply -f deploy-echo-v1.yaml
or   
kubectl create deployment echo-deployment --image=gcr.io/spring-boot-kubernetes-echo/echo:v1

kubectl get deployments 
kubectl get pods

Create a load balancer and expose the service

Bash
kubectl expose deployment echo-deployment 
        --type=LoadBalancer --port 80 --target-port 8080

kubectl get svc
NAME              TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)        AGE
echo-deployment   LoadBalancer   10.59.247.132   35.222.75.46   80:31383/TCP   80s

Use the external address to access the service 

http://35.222.75.46/echo?message=test

Scale the pods up or down

Bash
kubectl scale deployment echo-deployment --replicas=3
kubectl get pods
kubectl scale deployment echo-deployment --replicas=1
kubectl get pods

Tear The Project Down

Bash
gcloud projects delete spring-boot-kubernetes-echo -q

All of the instructions are in the readme above.

Tips For Remote Pair Programming

I’ve been pair programming on a weekly if not a daily basis for nearly two decades.

In essence, it is a simple practice where two or more developers sit down and write some code together.

Over the last decade though, I have been increasingly leading remote teams which are split across the globe, across the country or who are just spending more time working from home.

This means you have to practice remote pair programming instead.

In these days of enforced remote working and remote onboarding, I thought a few practical tips might help those new to the practice of remote pair programming.

Pair Programming

I first came across pair programming in the extreme programming era.

Despite it being a simple practice, I never took to it right away. That was because I tried to use it for everything.

Fortunately, I quickly realised that this might not be the correct approach for the teams I was working in. We experimented and found that it added the most value in a number of specific circumstances.

As well as being great for building the very difficult parts of a system, it was found to be extremely effective in the onboarding of new members of the team.

At the moment, there are lots of people currently forced to onboard remotely. It’s really, really hard to onboard remotely, especially if there is a large codebase.

That is where remote pair programming can help.

Remote Pair Programming.

Remote pair programming is again, a simple practice where two or more developers sit down and write some code together.

The big difference is that you can do it from anywhere on the planet.

For remote pair programming to work, you only need to be able to communicate clearly about the code you want to discuss.

In practice, this just requires a decent internet connection and some simple software.

Remote Pairing Tips

1. Only simple software is required.

There are lots of goods tools around for remote pair programming but essentially you only need 2 things

  • A screen share to see the code
  • A decent voice connection.

As long as you can hear each other clearly and both clearly see what code is being discussed, your good to pair.

There are some great tools which certainly add to the experience, however you only need the above to start.

2. If you don’t have the above, don’t bother!

I hope this one is pretty self-explanatory. If you can’t see and hear what each other is doing, you can’t possibly expect a remote pair programming session to go well.

Do not try this with bad tools or a bad connection – life is too short.

3. Follow the rules for remote meetings.

A remote coding session is very much like a remote meeting, so treat it as such.

In the same way as you would with a remote meeting, make sure that you schedule your session well in advance and ensure that there is a defined agenda. Make it clear what you will be covering in the session.

It’s then up to you to make sure you join on-time and ensure you are somewhere quiet where the meeting won’t get disturbed. Remember your going to be on speaker most of the time.

4. Integrate code often so you can swap roles.

You won’t be able to swap “Drivers” when doing remote pairing unless you are on the same code. So you are going to have to check-in and push your changes frequently. The other pair can then pull those changes and you can swap roles.

TDD is really important for this. To make things crystal clear, you may also have to do a few more steps than would be necessary when not pairing. You want to make sure whatever is vocalising in your head, is clear to the other person.

5. Use Feature Flags

If you are making a large fundamental change or a change to a delicate area of code, the use of feature flags can really help. Just add a simple toggle to turn the feature on or off. That way, you can’t really break anything.

6. Do some prep

It can be painful to be part of a pairing session where the driver is jumping all over the place to remember how things work.

So do yourself a favour and spend a little time thinking about what areas you might touch upon and spend some time familiarising yourself with that area.

Get yourself set up with the correct source checked out and built, key files loaded in your IDE and have any relevant documents open etc.

This will make everything much easier and It’ll also make you look good.

7. Keep it to one screen.

This one is just a preference. I just feel it’s much easier on the viewers if you keep the screen share to one screen.

If you then just have a couple of apps open – say your IDE and a shell for your build, its much clearer and easier to focus on the session.

8. Make it social.

One of the best things about pair programming is that it’s social. Quite often when sitting together you might go get a coffee together before you start and have a bit of a chat. If its someone you don’t know, its a great opportunity to find out about them. If it’s one of your closer teammates, it’s a great time to catch up a little.

It’s never going to be the same remotely but it is still a good time to have a chat and bond a little.

Wrap up

Every team will find their own best way of remote working and it will take some time. I hope that you might save time in finding your rhythm by following some of the tips above.

References

https://martinfowler.com/articles/on-pair-programming.html

Full-Cycle – Time to drop the Ops in DevOps?

Full-Cycle Teams

When I first started as a developer, everyone was a “full-cycle[1]” developer. You did the front end; you did the back end; you did the database; you released to production; you owned the production support.

This was known as Dev, and everyone worked that way, even if it was pretty poor compared to what we do now.

Over the years, each of the above tasks has become increasingly complex. The gap between each of these activities has widened and specialisations have emerged. This has led to some of the above tasks no longer being considered part of the standard development cycle. Many of these tasks now come under the purview of DevOps.

The Rise of DevOps

The rise of DevOps has finally brought focus to all activities across the whole SDLC. It is clear that there are benefits to returning to what Netflix label “full-cycle” when you look at things this way. Once again teams cover both the Dev and DevOps side of things and manage everything including production. By embracing DevOps to such an extent, all of these activities just becomes part of Dev again. This is the full-cycle way.

Supporting The Team

However, if that is to be done, the team need to be given the time and support to allow them to do a successful job.

The first problem is always the tooling and the skills required to use that tooling. Building and supporting a production system requires skills beyond that simply required to build the UI and Services. Nowadays you often need a good knowledge of pipelines, containers and infrastructure and getting that knowledge is not easy.

Building The Pipeline

As with all difficult things, the best way to deal with them is to do them every day. For me, building and owning your pipeline is the first step in that journey. By owning the pipeline you have to understand the complete journey that all of your deployment artifacts take before being built and deployed to an environment.

There are always problems in pre-prod environments, and by having to deal with them daily ensures that you fully understand the pipeline. You are also more likely to fully automate if you have to use something every day. That’s where integrations into your other tooling such as slack or custom bots can also off payoff.

Monitoring, Alerting and Logging

Once you’ve built your new system, you are going to have to look after it. The best way to do this is to make sure you build in the Monitoring, Logging and Alerting (MLA) capabilities that you need, right from the start. I cannot stress highly enough how important it is going to be to take a look at a dashboard and see exactly what is going on with your application. You might not get to a single pane view of your entire system from front to back but you must have a simple capability of viewing its overall operation. If you cannot do that, you cannot effectively support your system.

There are many great tools to help with this in a Microservice environment. But there’s a good chance that your Microservices are not generally going to be the problem. It’s often the case that it’s a downstream system that causes the issue. With decent MLA in place, you can pinpoint the exact system causing the issue even when it’s not one you’ve built. Then with some simple synthetic tests in place, the whole incident can be sorted without involving a million unnecessary people. The tests return to green, and all will be well in the world.

Production Support Tickets

So you’ve got your skills, tooling and MLA all sorted – what’s next?

Well, possibly the biggest mindset challenge for teams is the change to treating production support issues as day to day work. In general, people see production issues as either red or green. Production is red if it’s on fire and it requires immediate treatment. Otherwise, production is green and can be ignored until someone else sorts it out. That’s really not going to fly with full-cycle.

Production support issues need to come into the team’s backlog and be prioritised and worked on exactly the same as every other piece of work. This may require a piece of custom tooling to link production support ticketing and day to day tooling. Then it can all be easily managed as the same work. It is also essential that it is dealt with on a daily basis and by the whole team.

Full-Cycle Is Intense!

Full-cycle is pretty intense – especially when combined with out of hours support. It can take a toll on a team, leading to burnout and higher turnover. By putting the right strategies and incentives in place, you can mitigate the chance of this and keep everyone happy.

Is Full-Cycle For You?

After reading all this you might be thinking, “this is not for me!”. That might very well be the case. In the same way that there are pros and cons for full-stack, there are tradeoffs that you have to consider when for full-cycle. Some devs just want to do dev. When hiring, just make sure you get people that are really bought into the idea.

Whilst it may not be for everyone, for curious individuals who like being in charge of their own destiny, full-cycle is the ultimate way to work.

References

[1] Netflix – Operate what you own.
https://netflixtechblog.com/full-cycle-developers-at-netflix-a08c31f83249

© 2026 John Dobie

Theme by Anders Norén — Up ↑