Kuberentes Vagrantfile for VirtualBox (on Windows)

Recently I’ve been completing the Linux Foundation Kubernetes for Developers and Kubernetes Fundamentals online and since I did want to open any free tier on GCE or AWS account to deploy Kubernetes, I created a Vagrantfile to use with VirtualBox on my own Windows machine. There is basically the Vagrantfile which will spin up two machines: one master and one minion. Then there is a shared script/prepare.sh bash script and two specialized scripts: scripts/minion.

.NET Core coverage with coverlet

#static-analysis #code-coverage
At work we work mainly with Microsoft technologies, so I’m being exposed to things like C#, .NET Core, .NET Framework, Azure, etc. So I’m vesting more time learning tools and processes around Microsoft tools. This post is a kind of recipe to get started into .NET Core 3.1 with coverage and SonarQube to keep track of metrics. Pre-requisites First of all I consider that… You have .NET Core 3.1 installed Docker way: you will need Docker installed, Docker Desktop or Docker Machine if you do not have Windows Pro Java way: we will install Java 11+ (so do not worry) to run SonarQube on top of Windows Create the project Let’s start by creating two projects: the program itself and the test one.

Ansible IV: Managing variables and facts

- Updated
#it automation #configuration as code
In the last post we created three machines using Vagrant and VirtualBox. Those machines correspond to the database, backend and frontend in our system. In this fourth entry we will configure the database, taking a look at how variables and facts work. Note: we are working both in PowerShell and in the WSL. Everytime you encounter an “bash” code box and you are in Windows, you should be running it inside the WSL.

Ansible III: Multiple machines, multiple playbooks

#it automation #configuration as code
Here comes the third post of the Ansible series. This time we expose a scenario that will serve us through all the series. I had been wondering how this scenario should look like, but since I’m not an expert we will use a simple scenario: frontend + backend + database. Later you can expand this scenario to include cache, load balancing, service registry, vault, etc. Let’s dive in! Note: we are working both in PowerShell and in the WSL.

Ansible II: playbooks, containers and inventory

- Updated
#it automation #configuration as code
Welcome to the Ansible series! This is the second article in which we will start by creating our first SSH Docker container to simulate one remote machine, write an inventory and build a simple playbook to use against. UPDATE: I found that in the Docker for Windows approach you can’t use the containers IP to connect to them. Source in the documentation. I added new sections using Vagrant and VirtualBox which will represent better a real scenario.

Ansible I: Concepts and Installation

- Updated
#it automation #configuration as code
With this post we start a series about Ansible, the IT automation tool. This first article introduces the basic concepts of Ansible and its installation. Also we will install VirtualBox and Vagrant which will help us to practice Ansible in a more realistic scenario without exiting our computer. UPDATE: I found that in the Docker for Windows approach you can’t use the containers IP to connect to them in the documentation.

Transforming a RDKit depiction function into a Web API with Flask

#Web API #Chemoinformatics
RDKit is a widely used toolkit to work with molecules in different languages. Web APIs are interfaces that work with request-response message systems, commonly implemented in HTTP and accessible over the internet. Here we will take the RDKit’s function responsible for creating 2D molecular depictions and expose it over the internet, via HTTP, with a request-response system with the help of Flask and Python. We will be able to send molecules in SMILES format and our server will send us back the SVG representation of that molecule.

Django: basic auth with django-allauth

#web framework
Django is a web framework that comes with a lot of stuff built for you, so you can focus on building your application instead of a web framework. Django also has a large ecosystem of apps that you can use with your Django project! Here you will use the django-allauth package which will handle the authentication processes for you. You will have a running Django website with authentication in no time!

Go - Types, variables, functions and classes

#programming language #programming basics
When learning a new programming language, I think that knowing its types is very important. They are the tools that you be working with, and you should know them: strengths and use cases, conventions… Among other things, variables and functions are basic too, even if they can get complex. Then we can find some ‘advanced’ concepts in classes and testing, for example. And which I think it makes a lot of difference is to know about the standard library, there is so many power in there… Here we will start to look at types, variables, functions and classes in Go: how we define them, how we assign them, etc.

Go - Hello world, linting and build problems

#programming language #programming basics
Go is a programming language that is compiled, statically typed, expressive, concise and clean. It throws away things like inheritance in favour of composition. Its efforts at having a unified style caught my attention and made me eager to learn Go. It’s time to act! I will be learning Go and posting those things I think are worth sharing. Installing Go This way of installing Go will enable you to have multiple versions at the same time and switch between them using environment variables.

Parallel Python - Standard Library

#Parallelization #APIs
If you need to process items in a list and each is independent from the others, you probably benefit from parallelism. To parallelize you split the work in multiple tasks and execute them at the same time. There are two ways of doing paralellism: threads and processes. I always parallelized with Pools, so I discovered other interesting ways of using pools and other parallelization tools. However, we will start with Pools and move to other topics later.

Load balancing with Consul & Nginx

#Load balancing #Service registry #Containers
The last few weeks I played with Docker, Consul and other tools, so I tried to load-balance multiple Docker containers with an API. I decided to share with you how I built the system so I wrote this blog post. I hope you find it useful in some way. We will use Consul, Docker, Docker compose, Nginx, Python and Supervisord to create a load-balancing system that gets its configuration updated when the group that load-balance scales up or down.

Idiomatic Python - Adapter Pattern

- Updated
#programming patterns #chemoinformatics
Writing idiomatic Python (also known as Pythonic code) is a skill that is greatly appreciated, since it improves both readability and maintainability of the code. Using a non-Pythonic ported from C++ I propose you how to adapt it using the Adapter design pattern. The non-Pythonic API RDKit is a widely used toolkit to work with molecules. With it you can compute properties, build molecules, fragment them, etc. The core data structures and algorithms are written in C++ and the Python wrappers are built automatically using Boost.