Monday 28 September 2020

A dockerized web application, first steps

Developing a web application is no triffle even if you have the luxury of using images from a public Docker registry, so lets have a look at what we are trying to achieve.

My primary goal is to get familiar with Docker and to do this I want to create a small web application that allows me to manage my book collection. Most of it will be written in Python and use mature frameworks like SQLAlchemy and Falcon to quickly assemble something that is usable.

Now if we really would want to expose all of this to the internet, make it multiuser and scalable, things would quickly get out of hand and become too big for this experiment. So instead of trying to create everything in one go, I'll focus on the core object server with its database back-end along with the server that will augment any book data present in the object store with additional info (the idea is that the front-end of the book app allows you to enter just the ISBN of a book and additional info like title and author will be added by a background process). So from the full solution sketched below, I will omit the containers inside the dashed areas.

Even nginx can be added later and the static content of the web app can be served by the object store as well: purists may find this horrible, but eventually nginx can cache static content so performance wise there is nothing against this.

Without authentication of any sort we obviously cannot deploy this to any internet accessible enviroment but that is not a goal per se.

Another thing to note is that I am not altogether happy with MySQL: Although easy to use it is not truly FOSS in my opinion but that might be solved by swapping it for MariaDB. It also not so easy to scale it, but that is true for many relational databases. To solve that CouchDB might be a better choice, but that's something for later.

Finally, as you can see from the design, metrics are important so Prometheus, and possibly Grafana, will be part of the implementation.