RSSAmplifier

Blog

Devopsian

Recent content on Devopsian

devopsian.netRSS feed ↗23 posts

Latest posts

Understanding Go’s Supercharged Map in v1.24

Go 1.24 introduces a new map implementation, inspired by Google’s Swiss Tables , which brings significant optimizations and performance enhancements to the language’s built-in map type. While Go’s previous map implementation was already efficient, the new design takes it a step further by introducing a clever approach to data organization and access. To help digest this complex…

Handling Retries When Sending Files in Go: Lessons Learned

If you’ve ever implemented a file upload feature in Go, you might have run into a peculiar issue when retrying HTTP requests. I certainly did. This blog post is a deep dive into the problem I faced, why it happened, and what I learned about the io.Reader interface. The Problem: Retrying Sends an Empty File In my Go application, one part of the functionality involves reading a file from disk and…

Why I Switched from Makefile to Taskfile

Introduction Software projects involve several phases, including building, testing, and deploying code. For instance, compiling Go source code results in an executable, while frontend frameworks compile into HTML, CSS, and JavaScript files. Testing is crucial before merging changes or releasing new versions. Deployment scripts often ship software to production. Each phase requires different tools,…

The value of API-First design on side-projects

Intro Lately, I had a chance to try out the API-First design approach. I had never written an OpenAPI document before, so I had no real knowledge of its benefits. It always seemed like too much prep work. As developers, we often prefer writing code to writing documentation. We dive straight into coding, eager to see our project in action. However, I recently discovered a game-changing approach…

Inside EKS Networking: Decoding the Service IP Journey

Intro Have you ever found yourself deep in the trenches of Kubernetes networking, only to be surprised by a hidden quirk that challenges your understanding? In this blog post, I unravel the mysteries behind Kubernetes networking in Amazon EKS, shedding light on the intricate journey of a packet from the client through the NLB to an ingress controller pod. This blog is a story about a change in…

How to Structure a Go Project: Start Simple, Refactor Later

Once upon a codebase, in a kingdom of endless debates, a lone developer pondered the age-old question: “What’s the perfect project structure?” Spoiler alert: there isn’t one. Let’s embark on a quest to discover the charm of simplicity and the art of Go project structuring. The perennial question about what directory structure should I use echoes across various social platforms…

This is how you want to manage your Terraform modules

What if I told you there is a way to manage all your private terraform modules, in a mono-repo, with independent versioning, without using git tags? After researching for a proper open-source tool, I found the right one for the job. Intro A private registry is needed. I looked for a way to manage private terraform modules like public ones. In my company, we write tailor-maid modules that describe…

Go templates: customize your output using templates

Go templates are a powerful tool to customize output the way you want it. It’s a builtin package implements data-driven templates. Templates are executed by applying them to a data structure. While there are articles covering the basics, I had a hard time findings material on more advanced use-cases, such as looping over complex structs or using a function in the template. This post aims to…

Archives

A deep dive to Canary Deployments with Flagger, NGINX and Linkerd on Kubernetes

Intro Lately, I’ve been checking on progressive delivery tools. The two stars are Argo Rollouts and Flagger . Both projects are pretty mature and widely used. After researching the two for a few hours, I found out that — like most things in Kubernetes — there is more than one way of doing it. You can enable it with an ingress controller. Or a ServiceMesh. Or both. As of the time of writing this…

Terraform: why data sources and filters are preferable over remote state

Quite often you need to share data or output resources between your Terraform modules. Fundamental modules that build the infrastructure have no dependencies. As your infrastructure grows, the dependencies are inevitable. A frequently used module is the VPC. Almost every resource (if not all of them) requires a VPC to be placed in. When you look up how to share resources between your modules,…

Practical unit-testing web client in Go - part 2

Testing webserver with TLS In the previous post , I overviewed how to practically test web client in go. The next step, I want to test a web server with self-signed certificates. To cover this use-case, we need to: Create self-signed certificates, with SAN property of 127.0.0.1. Start the testing webserver using this certificate. Configure my client to trust the RootCA. Most of the people, when…

Practical unit-testing web client in Go

I’ve started a Go project, a lightweight Hashicorp Vault 1 client with no dependencies, and a simple API (for the user). Part of the reason I use no 3rd party modules is, I want to better understand Go internals, structure, and improve my skills. In this post, I’ll conduct a practical example of how I ended up testing it. The project’s name is libvault , and it’s my first…

How to use SED in a Jenkins Pipeline

Have you ever encountered the need to modify a single line in a file? While there are various utilities for this task, I consider sed to be superior to other alternatives. sed is a stream editor , with which you can modify files. It’s a great utility in your toolbox. If you’re unfamiliar with it, here’s a link for a quick intro. I had to use it in one of my Jenkins Pipelines.…

How to share persistent storage volumes in Swarm

Docker swarm is an orchestration tool, similar to Kubernetes, but simpler to set up and manage. A swarm consists of multiple Docker hosts which run in swarm mode and act as managers (to manage membership and delegation) and workers (which run swarm services). A given Docker host can be a manager, a worker, or perform both roles. The docker swarm feature is embedded in the Docker Engine (using…

Docker healthcheck experiments with Go web app

One good way to monitor your container status is to use Docker’s HEALTHCHECK feature. As part of testing the followed actions upon an unhealthy container, I had to experiment how this works. I wrote a small Go app that replies to /health requests, and the status it responds is configurable. The webserver listens on $PORT (defaults to 8080). To change its status, simply make an api call to…

How can Stackoverflow make you a better developer

“Time is the most valuable resource because you cannot get more of it.” There isn’t a single developer who doesn’t use Stackoverflow. Most of us use it daily. How many times a day have you googled an error, and reached Stackoverflow? It is such a valuable resource that improves productivity every single day. Consider the amount of debugging time it saved you. Yet, the…

nginx config template with environment vars

Until nginx v1.19, you had to either bake in the image a ready configuration file or mount it at runtime. Often, you would need to template the nginx config file. This was made possible since v1.19 in a convenient way using environment variables. First, you need a template to copy. Create default.conf.template file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 server { listen 80 ; server_name ${ NGINX_PORT }…

If you don't use a secret management tool, you're doing it wrong

Secrets management refers to the tools and methods for managing digital authentication credentials (secrets), including passwords, keys, APIs, and tokens for use in applications, services, privileged accounts, and other sensitive parts of the IT ecosystem. While secrets management is applicable across an entire enterprise, the terms secrets and secrets management are referred to more commonly in…

Go's method receiver: Pointer vs Value

The topic is large, and there is plenty of information online. This blog tries to keep it short and concise, and useful for experienced programmers that are new to Go. Coming to Go from Python introduced me to a new concept I didn’t have to put thought into. Python is a pass-by-object-reference language. You have no direct control over that. What this means is, when you pass an object…

How to run your own docker registry with password, SSL and S3 backend

I remember the day I started using Docker. The simplicity was overwhelming. I went over the official docs which are very good, and looked up some 101 tutorials to get started. I had successfully made my first image. Now that I have one, I want to deploy it over my servers. The first option was DockerHub , but a free account obligates you to share the images. If you need to keep them private, this…

About

Who am I? I’m Chen, a self-taught engineer with 13+ years of experience in system administration. This blog is my digital notebook, where I share real solutions to problems in projects, thoughts about cloud-native, software architecture, devops principles, reliability and software engineering. I pen down and share my challenges because someday, you might encounter them too, and finding these…

Search