Thursday, July 6, 2017

The struggle to stay up to date is real...

We all know the software development industry is a non stop innovation avalanche
barreling down a mountain.

So staying up to date with all the tech you touch is becoming a real struggle. When I started out as a developer many years back, I felt staying on the bleeding edge wasn't too bad.
I mean I needed to know and keep in touch with:

  • My main language and some of its main frameworks..  Java / Junit / Hibernate   
  • Some html, javascript, applets, JSP tags
  • Some RDBMS and SQL.. Latest changes on Oracle / SQL Server, how their indexing strategies change between versions etc.

These days however the list of technologies, frameworks, languages and tools has just exploded.

I have in some way or other worked with, tried, read about, implemented, studied, interested in or affected by the following in the last year. Most of which have shipped so much functionality it's actually mind boggling :

  • Java
    • Java 7 to 8 
    • Frameworks: Spring, Spring Cloud, Spring Boot, Hibernate 
  • JavaScript
  • TypeScript
  • Go
  • Python
  • Testing:
    • JUnit, Cucumber, Pact.IO, Selenium, Jasmine, Karma, Protractor, Hamcrest, Shazamcrest, Mockito
  • AngularJS
  • Angular 2 / 4
  • Docker
    • Docker, Compose, Swarm
  • AWS
    • Lambda, DynamoDB, Step Functions, S3, Cognito, ECS, EC2, VPC, Cloud Formation
  • Netflix
  • Elastic Search
  • LogStash, Kibana
  • Weblogic
  • Tomcat
  • Kubernetes
  • Kafka
  • Pivotal Cloud Foundry
  • Caching
    • Hazelcast, Redis, EHCache
  • Storage
    • Oracle, MongoDB,, Neo4J, H2, MySQL, InfluxDB
  • Build + CI/CD
    • Jenkins, Bamboo, Concourse
  • Git
  • Windows Server, MacOS, Linux, iOS
  • Blockchain

I am pretty sure there are a couple others that I am missing... and not mentioning the architectural styles, patterns, agile practices and the like so prevalent in our industry.

What sparked this blog post was watching the DockerCon Videos from May...
I would say I use Docker pretty regularly, generally on quite simple use cases for my own development and some work related projects...
But watching the videos below I realized that I had completely missed out on a ton of new functionality I didn't know about...

The reason I could watch a DockerCon video 11AM on a Wednesday morning is because I am current between countries and therefore between jobs... So I have a week or 2 to kill, and obviously I jump at the opportunity to go check out some of the latest stuff...

However seeing how many changes there were and that I missed a lot of it...
I think I may need to schedule "tech-cations" every couple months to just gorge on all that is new for a couple days.. or hopefully with the use of public transport in my new city, I can cram in another hour or so of podcasts or videos into my daily schedule.

Friday, May 5, 2017

Some interesting videos from the last ng-conf

With so much content out there it is sometimes hard to find content that is actually worth spending your time on.

ng-conf released 66 videos in their last playlist
also someone gathered all the relevant resources for the conference available here

Here are a couple that I watched and found interesting or informative

Angular & GraphQL ... Apollo looks awesome, something I definitely want to try that on my next angular app / side project.

I use the angular-cli and I think it's awesome... but John Papa uses it more.. some nice tips

RxJs - as I don't get to develop in Angular on a daily basis, always good to get a refresher and learn new functionality

More RxJs...

Some component design consideration from the guys on the Material angular team.

Monday, April 17, 2017

B.A.S.S - Boot Angular Secure Starter

As this is a post related to a project "starter", I decided this time to rather have most of the details in the on github rather than here on my blog.

To skip my ramblings:

I have recently done a couple little side projects and proof of concepts, all in Angular 2 (or 4 or whatever someone calls it), all using Spring Boot, all requiring some sort of authentication.

With both Spring and Angular teams iterating and releasing so quickly I found that by the time I got to a new POC I often had to do a number of updates and some of the projects brought in their own unnecessary complications, so it would take longer than I like to get started with the new POC, and therefore I decided it get back to a barebones implementation.

Hopefully it proves helpful to someone that requires an quickstart full stack Angular / Spring application.

It can extended and deployed as required.

One choice I would like to mention as it might not be to everyone's taste is the idea of having the Angular application as a Spring boot application rather than just deploying the static content to Nginx or Apache, and if you're looking to deploy this in a high volume production environment, you'd probably want to relook at that.
The reason I did this was just as convenience for myself. I liked having the whole app deployed as 3 self contained jars and drive both backend and ui configuration from one spring profile environment variable. Of course as this already does contain some of the Spring cloud dependancies, it would be simple enough to include Service discovery with Eureka and a Config Server, but for quickstarter... running 5 or 6 boot applications for a simple web ui might be overkill :)

More details on Github Project

Tuesday, March 14, 2017

Consumer Driven Testing with Pact & Spring Boot

Recently a colleague of mine stumbled across,  Our current application had grown to over 50 services and we we're starting to have some integration test failures and a brittle dev / acceptance test environment. So we decided to have a look at ways to try help with this.

I started out by reading:

Then watching:

Those 2 resources convinced me to give it a shot.

So I set out and created a quick set of Spring boot apps, the GitHub repo here, to test out the concepts and get everything working.

To highlight some important bits from the demo.

As Pact is a consumer driven test framework. This is where you define a unit test, that test mocks the http server response and you assert against that.
Once the test is successful it creates a pact json file in the /pacts directory.

So after the "mock" test is run and the pact file has been created. You need to include a maven plugin ...pact... that is then used to publish the content of the pacts/ folder to the pact broker... which is defined in the pom as below.


This uses the JUnit integration from to download the pacts from the broker and then run against an running service.

Since this already uses a @RunWith annotation, I could not use the spring boot runner. So to get around that as a before class step, I start the Spring boot application, the pacts then gets run against that running instance... and the boot application gets stopped again after the tests. Depending on your use case I guess it would also be an option to do this with @Before so you get a new service instance started before each pack, but that would slow down the execution tremendously.

The @State annotation, allows for clients to define a specific state, which the producer can the use to setup additional data / conditions required for the test to run.

Once the pacts have executed against the service there are reports generated in the target folder.

Setting up the Pact Broker

1. Grab the public images from Docker Hub.
docker pull dius/pact_broker
docker pull postgres

2. Then setup the Postgres DB
docker run --name pactbroker-db -e POSTGRES_PASSWORD=ThePostgresPassword -e POSTGRES_USER=admin -d postgres
docker run -it --link pactbroker-db:postgres --rm postgres psql -h postgres -U admin
CREATE USER pactbrokeruser WITH PASSWORD 'TheUserPassword';
CREATE DATABASE pactbroker WITH OWNER pactbrokeruser;
GRANT ALL PRIVILEGES ON DATABASE pactbroker TO pactbrokeruser;
3. Once the DB is up, run the actual Broker:
docker run --name pactbroker --link pactbroker-db:postgres -e PACT_BROKER_DATABASE_USERNAME=pactbrokeruser -e PACT_BROKER_DATABASE_PASSWORD=TheUserPassword -e PACT_BROKER_DATABASE_HOST=postgres -e PACT_BROKER_DATABASE_NAME=pactbroker -d -p 80:80 dius/pact_broker

Extra References:

Get the example project

Sunday, February 12, 2017

Quick Docker environment cleanup

Just a quick reference on my docker usage.

When working / playing with docker a lot, you quite often end up with a ton of containers and volumes laying around after they are needed...

Here are a couple tips I use to keep my environment clean.

On Windows 10
If you are using GitBash create a .bashrc and include the commands below:

alias docker-rm='docker rm $(docker ps -q -f status=exited)'
alias docker-rmi='docker rmi $(docker images -q -f dangling=true)'
alias docker-rmv='docker volume rm $(docker volume ls -q -f dangling=true)'

For MacOS X 
Add the following to your .bash_profile:

docker rm $(docker ps -q -f status=exited)
docker volume rm $(docker volume ls -q -f dangling=true)
docker rmi $(docker images -q -f dangling=true)
docker-update-all() {
docker images | awk '(NR>1) && ($2!~/none/) {print $1":"$2}'| xargs -L1 docker pull

Then simply run docker-rm, docker-rmi and docker-rmv to remove all the dangly bits :)

docker-update-all, is a handy way to get the latest images from docker hub.

Popular Posts