Non-blocking stdin with python using epoll

I was playing with epoll and was curious whether I can use it to monitor sys.stdin. The biggest issue was that sys.stdin.read() is blocking and I had no way to figure out whether I read the descriptor fully or not (making the epoll useless pretty much). Until I changed it to non-blocking with fcntl.

Keep reading

LinuxCon ContainerCon Europe 2016

Here are my assorted notes from some ${subject} talks.

Keep reading

Flock 2016: my notes

Last week we were at Flock 2016 which was held in Krakow, Poland. Awesome event, lots of news, great people, plenty of conversations and fun.

Here is a list of my notes:

Keep reading

Handling secrets when building docker images is easy

So you wanna build a docker image. And you need to fetch your application sources from git. Which is guarded by ssh. And you don’t want the ssh key to get leaked into the final image. Bummer.

Unless…

Keep reading

Download manifests from Docker Hub

So we needed to fetch manifests of repositories from Docker Hub today. It’s not that hard. 30 lines of python can do it. But at the same time, you need to read docs with all the specs.

Keep reading

Simple way to check for race conditions

Today was a fun day. We were working on a piece of code which interacts with PostgreSQL database. One function was reading from database and based on the query result it inserted some data afterwards. The thing is that it wasn’t done in a transaction so I suspected there could be a race condition. But how to test such case? My requirements for such test were obvious: I wanna spam the server with streams of requests and check logs if the server is able to handle it.…

Keep reading

Automatic mounts with systemd

So I wanted to setup automatic mounting (read as autofs) with systemd, without using fstab.

Unfortunately, the man page didn’t have any examples so it wasn’t that easy to figure out. Luckily there is an excellent guide at RHCSA course [1].

Tl;dr

Keep reading