Docker, Golang and sqlite3

Mindfulness

Today I concentrated mostly on development so I will get the other stuff out of the way. I completed one of the Great Courses – The Science of Mindfulness. This was a course on mindfulness. So what is mindfulness. It is hard to describe. Mindfulness is training your mind the same way you exercise your body, you exercise your mind. You train your brain to contemplate the thought process itself. You are already using your mind all the time but you never trained it. So one day your mind tries to lift “Something heavy man!” and it fails you. You get anxious or angry you react without thinking. Mindfulness is understanding that just like a muscle, if you train it, it can handle a lot more, so can your mind. If you learn to observe yourself thinking you can take a moment to think about your thoughts and learn to live in the moment. Like I said it is hard to describe but I have been doing meditation or mindfulness training for several months now. I can say I have gotten better at understanding that my thoughts are passing before me, but it is still easy to get caught up in reaction instead of mindfulness.

Wow I don’t know what I just wrote. I also did a little work in blender towards the end of the day, just to make sure I kept working on it. Here is what I have so far on a vertex by vertex creation of a model. I am not sure exactly where it is going but I guess we will see.

Blender model created vertex by vertex.

Development

Back to development. As I said yesterday I finished the website, or thought I did, more on that later. I searched the web to find out how to install docker and after a couple of commands in linux boom it was installed. This should be easy I thought. But, my usual mantra is “nothing can ever be easy.” I figured as long as this was going to be easy I might as well skip ahead and get the Android Studio up to date. After futzing with that trying to get it to download the latest gradle and update the Android tools. I turned back to the docker implementation. I had attended a lecture on docker at “CodeMash” a few years ago, so I thought I knew what to expect. This is why learning by doing is more important to me than lectures. Yes, setting up docker can be easy but, “nothing can ever be easy.”

So I thought “Hey I just have to create a docker container with the binary and support folders and contents.

But,

It did not work, because the golang binary was compiled with dynamically linked libraries.
Okay, I just have to compile it statically.

But,

Because I used sqlite3, more specifically – “github.com/mattn/go-sqlite3“ , I could not compile it statically.
Okay, I could just create a container based on ubuntu.

But,

That would mean the container would be over 500MB. Not good. I want a small foot print not half a gig! So after some digging I found you might be able to get by with “BusyBox
Yeah!

But,

Busybox did not include the libraries I needed.

But,

Busybox-glibc does.

But,

Not all the ones I needed.
Okay now what?
I found this web page
Creating Minimal Docker Images
I could add the libraries I needed to the docker container and it was only 22MB.
Woo Hoo!
Now I could create a container!

But,

To make sure the data is persisted I needed to create a volume mount point.
Now I can make sure if the container goes down the database is persisted.

But,

No more buts it actually worked.

But,

So, I was wrong.
During testing some of the early functionality, it failed. Regression reared its ugly head. The error presented outside the docker container so, it looks like I broke something along the way.

 

This is an example of stuff I did not count on. If some project manager whipper snapper asked me how long it would take to get all this done, I would have told them, ‘It depends”  and I would be right. I could give some SGWAG (Super Galactic Wild Ass Guess) but in the end I would still not know and neither would they. I  would have to pull some time frame out of thin air and then double it and add 30.