Sahan Serasinghe
597 FOLLOWERS
Howdy, I'm Sahan Serasinghe, a Software Consultant based in Adelaide, Australia. I mainly work with .NET technologies at Telstra Purple. I'm currently pursuing my Master of Data Science degree with University of Illinois Urbana-Champaign, USA. This space is my personal blog, where I share my thoughts and experiments with tech.
Sahan Serasinghe
3M ago
This blog post kind of different from my usual ones since this is based on a recent talk I delivered at the Adelaide .NET User Group on the 09 Dec 2021.
The slides can be found at my SpeakerDeck profile.
The GitHub repo for the demo code can be found here
The talk is structured in to 12 sections,
Getting Started
Variables
Modules and Packages
Slices and Loops
Conditionals
Functions
Pointers
Structs
Unit Testing
A Simple HTTP Service
Adding JSON to our HTTP Service
Multi Arch Deployments with GitHub Actions
Conclusion
Hope this will help if you are planning to learn Go as a .NET developer ..read more
Sahan Serasinghe
1y ago
Introduction
In this article, we will look at how to build a simple web service with gRPC in .NET. We will keep our changes to minimal and leverage the same Protocol Buffer IDL we used in my previous post. We will also go through some common problems that you might face when building a gRPC server in .NET.
Motivation
For this article also we will be using the Online Bookshop example and leveraging the same Protobufs as we saw before. For those who aren’t familiar with or missed this series, you can find them from here.
Introduction to gRPC
Building a gRPC server with Go
Building a gRPC server ..read more
Sahan Serasinghe
1y ago
Intro
If you have built RESTful or other OpenAPI-like APIs for some time and wondering what’s next for you, then you have come to the right place. This article series discusses leveraging gRPC to build your next API, even multiple services. We will initially look at the main concepts from a high-level view and then move on to the implementation aspects of it.
Motivation
There are many tutorials on getting started there. But the main issue I faced was that they even made me more confused as there was a lot of contexts lost in the process and brought in way too many third-party libraries or expl ..read more
Sahan Serasinghe
1y ago
In this article, we will be looking at how we can automate most of the steps involved in installing a Raspberry Pi+K3s cluster by using Ansible.
I explained how to set up a Kubernetes cluster on a Raspberry Pi in my previous article. In case you missed it, you can find it from the following link:
? Building your own private Kubernetes cluster on a Raspberry PI 4 with K3S
If you have a fresh bunch of Raspberry Pis, you might want to follow Step 0 through to Step 8 in the above. However, it’s a one-off setup, so please proceed to the following sections if you already have done them.
In a nutshe ..read more
Sahan Serasinghe
1y ago
In my previous blog post, we looked at how commands and args work in Docker. If you missed that one, the link is down below.
A closer look at commands and args in Docker containers
Today we will be looking at the same but in Kubernetes. To get started, we will be building on top of the following Dockerfile.
FROM debian
ENTRYPOINT ["printf", "Hello from %s\n"]
CMD ["Name Printer"]
This would simply print out Hello from Name Printer when you run it.
As a time-saver, I have already packaged up the image. You can have look at the image layers in Docker Hub.
You could run this with Docker li ..read more
Sahan Serasinghe
1y ago
In this article, we will look at setting up your own private Kubernetes cluster on a Raspberry Pi using K3S in your home Wi-Fi network! Our setup will be pretty simple - single master and a single worker node. You can always add more nodes if you like.
Here’s a diagram to give you an idea of what we will be building today.
Topology of what we'll be building today
Basically, we’ll be tying two Raspberry Pis together with K3S and connecting them to a local WLAN. We can then deploy our workloads using a client (your laptop) which will be talking to the Kubernetes API just as you’d normally with ..read more
Sahan Serasinghe
1y ago
I recently passed the Certified Kubernetes Application Developer exam and thought to share some tips and tricks that might come in handy if you are also planning to take the exam in the future.
? Background
About a month ago, I decided to learn more about Kubernetes as it would be really useful for the stuff I’m working at GitHub daily. Prior to that, I was always fascinated by Kubernetes but never got the chance to work on an actual system that used it. I knew how it worked from a 10,000 feet view, but didn’t have an idea of core components, basic constructs and literally to be able to do any ..read more
Sahan Serasinghe
1y ago
Recently I started looking into Elastic Enterprise Search’s Elastic Workplace Search offering. The configuration was not quite obvious when I first started off with the Docker version of it. The goal of this blog post is to walk you through the process of setting it up with Docker for local development.
? Note: This is only meant for local development. Consider their cloud offering for production use.
Prerequisites
Docker Desktop
Docker Compose
Allocate docker memory to more than 4GB (really important to check this)
tl;dr
If you are looking for something to get started quickly, all you hav ..read more
Sahan Serasinghe
1y ago
Today we will be looking at how we can make use of commands and args in Docker to run our own processes when we spin up containers. This could be useful if you want to run one-off tasks without having to create your own images.
Let’s imagine that we want run a bash command. What’s the easiest way to do this? Just by spinning up a container using a lightweight image like busybox, ubuntu, debian? For instance, let’s say we use Debian as our base image.
docker run debian echo hello
We will get back “hello”, which is expected. What would happen if we check if the container is running?
The cont ..read more
Sahan Serasinghe
1y ago
When you are developing a project where you have multiple services talking to each other, it would be hard to see their service health instantly.
This article will look at how we can configure ASP.NET Core health checks and look into what kind of different metrics we can gather from it.
? Follow along with the code samples for this blog post from this repo.
The setup
I will be using ASP.NET’s MVC and template, as most of you are familiar with it. However, you can also use other project types such as API, Console or even Blazor.
Let’s scaffold an MVC app.
dotnet new mvc -n Monitor
dotnet ne ..read more