Posts

Showing posts from April, 2018

Healthchecks in ASP NET Core

Healthchecks in ASP NET Core Healthchecks are used to assess the health of an application. There are multiple level of checks which can be implemented, the first level being whether the application is itself running. The second level being whether the application dependencies, services, databases, files, are accessible by the application. Last level being whether the process itself is healthy, consume a reasonable amount of CPU/RAM. Today we will see how we can implement a simple healthcheck middleware for ASP NET Core in three parts: Define the usage Build the framework Sqlite Healthcheck extension 1. Define the usage ASP NET Core is cooking a healthcheck framework but the nuget package hasn’t been created yet therefore only the codebase is available. The framework in this post is a simpler version inspired by the official healthcheck framework. We will be creating a framework allowing us to register comprehensive healthchecks. public void ConfigureServices(IServiceCollecti...

Semantic versioning for dotnet application

Image
Semantic versioning for dotnet application Versioning application allows us to know which features are currently available in the environment where we deployed but when our application is composed by multiple webservers, it becomes tedious to maintain the versioning. On top of that with the dotnet core movement, management of versioning has changed. Today I will show a way to automate the versioning using Gitversion and how it can be used for dotnet core and dotnet framework. This post will be composed by 3 parts: Version assemblies Semantic versioning Gitversion 1. Versioning assemblies In dotnet, assemblies are versioned via the AssemblyInfo.cs file. This file contains the metadata used by the compiler to populate the information about the assembly like the title, the author, the copyrights and the version. It is handle via attributes. Here is an example of an assembly info file: using System.Reflection; [assembly: AssemblyTitle("HelloWorld")] [assembly: Assembl...

Microsoft Project Orleans ClientBuilder and SiloBuilder

Microsoft Project Orleans ClientBuilder and SiloBuilder Prior 2.0.0 stable, we used to configure client and silo using ClientConfiguration and ClusterConfiguration . I was hard to understand how to configure those as many options were available. Moving forward to 2.0.0 stable, ClientConfiguration and ClusterConfiguration no longer exist! It has now been replaced by a ClientBuilder and a SiloBuilder (notice there is no cluster builder). The shift toward builders makes life easier to us to configure client and silo. Today I want to take the time to explain how the migration between beta 3 and stable can be done in three parts: Configure ClientBuilder Configure SiloBuilder 1. Configure the ClientBuilder A client needs to connect to a cluster. The only configuration needed for the client is therefore: the id of the cluster the id of the service where to find the cluster During beta this used to be configured in ClientConfiguration , it is now done using the ClientBuilder :...

Hashicorp Vault behind IIS

Image
Hashicorp Vault behind IIS Last week I talked about Hashicorp Vault and how it could be used to store secrets . Today I will continue on the same line and show how we can host Vault behind IIS and use what we learnt in the previous post to retrieve secrets from ASP.NET Core. Setup Vault Read secrets from Vault from ASP.NET Core 1. Setup Vault Vault is a webserver which comes with a complete API. In this example, we will show how to setup Vault and proxy calls from IIS to Vault. 1.1 Boot Vault To begin with, we can follow the same steps described in my previous post - Hashicorp Vault and how it could be used to store secrets . As a quick overview, here are the steps to be executed inside Windows Server: download Vault create the config.hcl file run the command vault.exe server -config=config.hcl In config.hcl, we configured Vault to listen on http://localhost:8200 so the next thing to do is to proxy calls from IIS to Vault process. 1.2 Configure IIS to direct calls to...