MySQL Group replication check

Running MySQL in a Kubernetes environment means that as soon as the container is started the Service will start using it. With Group Replication enabled this means it will start using the instance while its still ‘recovering’ . So I made this little bash script which you can use as a Readiness probe. It checks two things with one small sql query. First if its online, and second if there are 2 or more members (hopefully preventing split brain scenarios). |
#Pass "password" as parameter
ip=$(ip route get 1 | awk '{print $NF;exit}')
state="$(mysql -N -B -p@1 -e "SELECT * FROM performance_schema.replication_group_members WHERE MEMBER_STATE='ONLINE'" 2>/dev/null)"
if ([ "$(grep -c "$ip" <<< "$state")" -ge 1 ]) && ([ "$(grep -c '^' <<< "$state")" -ge 2 ]); then
exit 0
exit 1

Little update on the infra

Kubernetes is awesome. This is what makes containers shine. Sure you have loads of yaml files but this also makes it real easy to rebuild, try out and restart. Which is great for the phase the project is in right now.

So how far is the infra:

  • Kubernetes with as overlay network (This adds the benefit of encryption between the nodes)
  • The MySQL Group replication with automatic scaling. Easy to scale up/down and the container automatically joins the replication group via a startup script.
  • Redis in a master-slave configuration. I was not aware I needed redis sentinel, but I did 🙂
  • Amazon S3 as a storage for objects.
  • The app is running after some DNS issues. Ubuntu 17.10 which is the OS on the nodes uses netplan with systemd. Now netplan hijacks the /etc/resolv.conf file which confuses the Kubernetes DNS, but we have a solution:

In  /etc/systemd/system/kubelet.service.d/10-kubeadm.conf



to the  KUBELET_DNS_ARGS like this:

Environment=”KUBELET_DNS_ARGS=–cluster-dns= –cluster-domain=cluster.local –resolv-conf=/run/systemd/resolve/resolv.conf”

Restart and now DNS is working inside the pods.

Currently working on getting the application running in the final configuration. For now I am using a workflow from test -> accept -> production. Where test is just to develop, fix and run and Accept is the final configuration on Kubernetes before production. Might switch to OTAP but since my develop and test is in my own hands I currently do not need it.


Infrastructure for the project

I now have arrived at the moment I need an infrastructure for the production environment. As a technology for deployment I already decided on containerisation with Docker. This seems the most portable and manageable way to deploy and update the platform. I have been looking at hosting companies with Docker support, and although al lot of the hosters talk and know about Docker, almost everyone is just giving you a Kubernetes (later on that) environment deployed on the same VPS we have been renting for years now. IBM Cloud/Bluemix and Digital Ocean are the exceptions. IBM is way to expensive, but Digital Ocean seems like a really good place to go the Container only way. To stay flexible I will start designing the platform infrastructure based on three VM’s and will try to keep in mind Digital Ocean if I want to reduce complexity.

Now on Kubernetes, when building an infrastructure for Docker all arrows are pointing to Kubernetes as the orchestration layer. For such a small platform Kubernetes might be overkill, but looking to the future and wanting to learn about Kubernetes I will use it as the Orchestration layer. So to visualise the infra I made the following picture.

Most hosters provide a Load Balancer and a Storage service, so I won’t deploy those myself. That leaves me with getting Docker and Kubernetes to run. And as a next big step, creating a MySQL cluster. Not sure about the solution for that, Persona XtraDB, Group Replication, Single master etc…Gonna be looking into that as the next step.

Bootstrap 4

Not happy with the responsive handling of the app in the browser I decided to go the Bootstrap route. So I have been busy the last weeks going from a custom html/css interface to a bootstrap interface. And I am very happy with the result. Custom theme via SASS works very wel, and for those little things I really want to customise I just left it in a separate css file.

Did some customisations for the bootstrap modals because I wanted to have multiple layers of modals :

$(document).on(‘’, ‘.modal’, function () {
var zIndex = 1040 + (10 * $(‘.modal:visible’).length);
$(this).css(‘z-index’, zIndex);
setTimeout(function() { $(‘.modal-backdrop’).not(‘.modal-stack’).css(‘z-index’, zIndex – 1).addClass(‘modal-stack’);
}, 0);

This handles the z-index of the modals and nicely adds them on top of each other. So all in all, lot of work but a much better user experience.  (Source : )


Datepicker without dependencies

I was searching for my current project for a nice javascript date picker. I tried a lot of them, so many that I actually started to hate datepickers: The jQuery ones, the bloated too many function ones, the ones that mess with your css. I was almost giving up and thinking about writing one myself when I ran into this one :  , a datepicker that fits right into my project. No crazy dependencies, no bloat, just a datepicker. I love it. I did ran into an issue, but after contacting the developer Aaron Cordova via Github he was quickly able to solve it. So thanks again for that Aaron.

I hope to launch VOTAVI soon so everybody can enjoy it. 😀

BumpyWheels new gameplay mode

A new release of BumpyWheels is coming soon and we are very excited to introduce  a new gameplay mode.

One Button gameplay. We replaced the current controls with a one button style gameplay. Accelerate  by pressing the button, slow down by releasing it. And although it sounds simple, the challenge and fun is much bigger than the traditional controls. We have lots of fun testing the new gameplay.


Of course if you want you can still play in classic mode via a switch in the options screen.

iOS Universal links

Implemented Universal Links today. I think this is essential for a platform in which you can share content through links like you will be able to do with Votavi .

It was actually a pretty simple implementation, the biggest challenge is getting AppDelegate to perform the open action in the right viewcontroller. By using this piece of code you will be able to return to the rootviewcontroller, in our case this is the mainViewController.

if let mainViewController = navController.viewControllers.first as? mainViewController {
navController.topViewController?.dismiss(animated: false, completion: {
navController.popToRootViewController(animated: false)

Where navcontroller is the UINavigationController via :

(if let navController = window?.rootViewController as? UINavigationController {)

This will get you to the mainViewController which is the root viewController.


Current project entering new fase

Upgraded to Laravel 5.2.  Moderation, management, security are now all implemented on top of the basic functionality. Performance looks good. Now adding Facebook and Twitter integration. Look and feel of the HTML views are done. Next step; the iOS part. The framework is prepared to spit out json data, so the app will just be a frontend with some content adding facilities. As I will be writing the iOS stuff, I will also document the json output so it will become a fully documented API. Than we can outsource the Android part …

questionmarkHint 😉