Functions

Colleague: “No, you cannot do functional programming in Python!”

Me: “Hold my pretzel.”

multiinsertL = (lambda list, new, old:
                [] if not list
                else [new, old, *multiinsertL(list[1:], new, old)] if list[0] == old
                else [list[0], *multiinsertL(list[1:], new, old)])

Add a /ping route to your services

You have to rely on something to check if our services are up and running. Wether it’s a monitoring tool, a loadbalancer checking for healthy endpoints, …

I recommend using a a route named /ping and use good old http request for checking.

This way – imho – you have a stronger guarantee that your service is up and running.

PS: Don’t forget to disable logging for this route 😉

 

Microservice Development Environment on OSX

If you are a Mac user who likes the feeling of deleting stuff and have drunken the docker inc. kool-aid (i.e. implementing microservice architecures on top of the “docker-toolbox”) this just might mean a breath of fresh air for you as well:

  1. uninstall vagrant
  2. trash your “favourite” hypervisor (vmware, virtualbox, etc) with it
  3. learn about the existence of the lean xhyve built on top of Apple’s own hypervisor framework (only on OSX 10.10+)
  4. dlite and docker-compose your docker development containers
  5. docker-compose up  yourself towards getting some programming done again

Update:

Post by dlite creator Nathan LaFreniere – Simplifying Docker on OS X

How to fix skewed system times on multiple vagrant instances

I’m having this problem with my local dev ceph cluster where the clocks on all my nodes would get heavily skewed after a while so rather than researching what’s going on here with virtualbox I just hit the problem with the unix hammer. So, were the guest tools installed? I don’t even know nor care.

Virtualbox is usually not my first choice with vagrant but https://github.com/ceph/ceph-ansible didn’t work out of the box with the vmware-fusion provider so I’m sticking with it for now.

Click to view gist

Boot2docker and inotify

I recently ran into a problem with a compile-on-filesystem-change application on boot2docker. Due to the layered structure of boot2docker (Host->VM->docker) the mechanics required for inotify are not working.

Luckily there exists a solution: https://github.com/brikis98/docker-osx-dev

I use docker-compose – so after installing docker-osx-dev, just run it in the folder containing the docker-compose.yml and docker-osx-dev finds the correct folders to watch.