RSSAmplifier

Blog

Roger Welin

Recent content on Roger Welin

rogerwelin.github.ioRSS feed ↗20 posts

Latest posts

PostgreSQL Bloat Is a Feature, Not a Bug

Introduction Your PostgreSQL database keeps growing, even though the number of rows stays roughly the same. Disk usage climbs, queries slow down, and you wonder what the heck is happening. It’s not a bug - it’s called bloat and it’s baked into the core design of Postgres. To understand why it happens we have to follow the lifecycle of a row from the moment it’s written to a…

Implement GitOps on Kubernetes with ArgoCD and Kustomize

GitOps is a term first coined and popularized at Weaveworks. GitOps can in it’s most concise form be described as a philospohy or a workflow on how infrastructure and application code changes/deployments should be applied to a desired state where Git is the single source of truth. GitOps is not limited to Kubernetes but in the Kubernetes ecosystem we have specialized tools that can easily…

Build an external api with auth using Traefik and Go

In this post I will show how to easily build an external api with authentication with help from Traefik. The usecase is the following: you want to make an external api only authenticated users can access. In this solution the authentication will be a token which clients will supply as an HTTP header. We will leverage Traefik to make the auth server and underlying api services loosely coupled. Our…

Build a serverless website from scratch using S3, API Gateway, AWS Lambda, Go and Terraform

In this guide we will leverage AWS to build a completely serverless website (frontend and backend api) using S3, API Gateway and Lambda. We will use Terraform to set up our AWS resources and we’ll use Go as our programming language for the lambda function. For the frontend we will write a static html and javascript/jquery file (stored in S3) that will communicate with our lambda function.…

Traefik tutorial - dynamic routing for microservices

Traefik is an awesome reverse proxy (and load balancer) with lots of backend supports. So why do we need another reverse proxy? (we already have nginx and haproxy that are stable and performant). Don’t get me wrong, nginx and haproxy are awesome, but the problem with them is how to manage configuration. In a microservice world configuration are not stable, services come and go and…

Concurrency in Go - Fundamentals

In this post we will delve into the fundamentals of Go’s concurrency features, the target audience are readers familiar with the language; however no prior knowledge of concurrency is required. In this post we will talk about: brief discussion of Go’s concurrency features goroutines WaitGroup:s (from the sync package) Mutex (also from sync package) channels (buffered & unbuffered)…

Using websockets in golang with gorilla-websocket

This will be a tutorial in how to implement websockets in Go using the excellent gorilla/websocket package. We will build a backend server in Go that accept json from the user and pushes that data on the websocket channel; the frontend will be a simple html file with inline javascript (for simplicity sake) that connects to the go backend and listens on data and updates the html in realtime. Brief…

Write and configure custom sensu handlers

Sensu is a decent monitoring platform compared to nagios, since the configuration is more flexible (and a lot more config mgmt friendly) and the platform is also easier to scale and customize. In this post I will demonstrate how easy it is to configure cusom handlers on checks and how to send notifications to a chat. Setting it up What I’m trying to accomplish is the following:

Distributed tracing with Zipkin and springcloud-sleuth

Microservice architecture is a common architecture pattern that favors small services that’s independantly deployable which communicates with each other most often with a HTTP api. This architecture pattern has been very popular in our industry and is heavily favoured in opposition to build big monolithic systems that are hard to develop in cooperation and deploy. However the microservice…

Convert markdown to confluence markup

I recently did some investigations at work on how to keep documentation up to date. I guess we’ve all been in the situation that the documentation we have is drifting from how the actual systems/applications look like. I believe that it’s easier to keep the documentation close the the actual code, e.g by README’s in markdown, than by have them as separate confluence pages that no…

Springboot - change loglevel at runtime

Both devs and ops care a lot about logging. For devs it gives them a way to peek into the behaviour of the application once it’s running and way to debug, and for ops it’s the first thing they go to for troubleshooting incidents in production. Because logging is such an important troubleshooting source it’s really important that we can change logelvel on the fly when the default…

Jenkins 2.0 - Next Generation of Pipeline as Code

I’ve recently been working with the new pipeline plugin dsl in Jenkins 2.0 and the more I work with it the more I like it - I truly believe that it’s the next generation of pipeline as code even though it has several limitations and gotchas that I will describe. A brief history of pipelines and job generation in Jenkins Pre Jenkins 2.0 was simply not designed for complex Continuous Delivery…

Testing Ansible Playbooks with Docker

As long as I have been working with configuration management tools (puppet & ansible) there hasn’t really been a good way to test the units you’ve been written. Up until recently my experience has been something like this: working on a feature on the master branch, in best case someone will lend their eyes to look at the changes, run changes directly on the target environment and hope…

Develop custom Ansible modules

One thing that I really think is neat with Ansible is that when you need functionality that are not part of the Ansible core (let’s say you need to integrate Ansible with bigip F5 load balancer) you can just turn to Python (or any other language for that matter) to write your own modules that you later can use in the regular playbooks. This is a really neat functionality, you are not tied…

Creating helpful command line applications in ruby

So what makes a good and helpful command line application? I think these three point are important: easy to use helpful play well with others Bash is commonly used to write command line apps, but I can never shrug of the feeling of shame of writing a bash script with more than 30 lines. That’s why I’m shaking things up here and showing how to use ruby instead. I’ll be using the…

rpmbuild tutorial - Elasticsearch source rpm

First let’s set up our build rpm environment by installing the following: [ bob@vagrant-centos65 ~ ] $ sudo yum install -y rpmdevtools rpmlint Then we’ll set up the folder structure with the rpmdev-setuptree command. It will create tbe rpmbuild folder and it’s subfolders as shown below. [ bob@vagrant-centos65 ~ ] $ rpmdev-setuptree [ bob@vagrant-centos65 ~ ] $ tree rpmbuild/…

rpmbuild tutorial - how to build rpm packages

Welcome to the first part article on how to build rpm packages. Here I will walk you through how to build a rpm package and how to work with the tools you will need. Let me just first start off with saying that I don’t consider myself an expert at rpm packaging but blogging about a topic forces you to graps the subject you are writing about better. With that being said this first part will…

Rubygems made easy with bundler

One thing with Ruby I don’t quite like (and many with me) are the Ruby gems. The one thing thats great with gems is that it’s almost as with CPAN, if you have a problem - there’s a gem for that! But I don’t like the idea of installing libraries system-wide. If installed with sudo it’s a security risk. And my belief is that libraries are supposed to be used by demand…

How to install and run Kibana4 on a elasticsearch tribe node

Not long ago Kibana 4 was released and I think it’s a major improvement in relation to the previos version of Kibana. Some changes worth mentioning is that Kibana 4 now runs a node js web server, Express, while Kibana3 was just plain js files that you had to serve in a httpd or nginx. This really is a great improvement! In kibana3 elasticsearch web port 9200 had to be reachable by the…

About

15+ years of experience building distributed systems and scaling infrastructure. Expertise: Go (Golang), AWS, Kubernetes, PostgreSQL optimization, observability & networking Open Source: Active contributor and creator of networking/dev tools. Writing: Deep-dives into systems engineering