Posts

Showing posts from September, 2018

Deploy ASP NET Core application on Docker Linux container

Image
Deploy ASP NET Core application on Docker Linux container from Windows Few weeks ago we saw how we could run ASP NET Core application on Ubuntu . This proving that a .NET Core Application can run on a Linux system, today we will be taking it a step further and see how we can deploy our application in a Docker Linux container. This post will be composed by three parts: Install Docker on Windows Docker basic commands Create ASP NET Core application 1. Install Docker on Windows The first step is to go to the official site, sign up and download Docker CE . Once downloaded, install Docker. After being installed you should be able to right click on the icon > Settings on the Docker notification icon and see that Docker is running by checking the status at the bottom left, it should say Docker is running . Open PowerShell and type docker run hello-world . $ docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world

Setup Continuous Integration and Deployment for dotnet library with Appveyor and FAKE

Setup Continuous Integration and Deployment for dotnet library with Appveyor and FAKE Last week we saw a flow to manage versioning and releases . As a continuation of last week, today I will show how we can setup versioning and releases for open source projects by configuring Appveyor and using FAKE to setup a build script. Configure AppVeyor FAKE 1. Configure AppVeyor Configuring AppVeyor is done via a yaml file appveyor.yml at the root of the repository. Then from the site https://www.appveyor.com/ , we can sign in with our GitHub credentials and add the repository to the AppVeyor projects. All the settings in the settings tab can be configured in the yaml file. appveyor.yml settings can be seen in multiple sections: global environment build test artifact deploy The global configuration is where we configure the context of the build, # 1. version: '{build}' image: Visual Studio 2017 skip_branch_with_pr: true skip_commits: files: - docs/**/* - 

Versioning for open source library

Versioning for open source library Few weeks ago I explained how Gitversion can be used to apply semantic versioning to projects based on commit and tag history. Today I will dive deeper in the purpose of versioning and introduce a flow which can be followed to version open source project libraries by looking into four important parts in the lifecycle of an open source library. Version with Semantic versioning Branching strategy and Commits Continuous Integration and Releases 1. Version with Semantic versioning Semantic versioning is ideal for versioning libraries. It is formed by three numbers {major}.{minor}.{patch} . Each number is used to indicate to the user the level of safety for upgrading the library. Upgrade of the major is risky and has chances to contain breaking changes, therefore looking at release notes or looking for migration would be recommended. Upgrade of the minor has lesser risk and can be used to show availability of new features. Upgrade of the pat

Implement timeout and retry policies for HttpClient in ASP NET Core with Polly

Implement timeout and retry policies for HttpClient in ASP NET Core with Polly Few weeks ago I explained [how to use the new HttpClientFactory . This freed ourselves from managing the confusing lifecycle of a HttpClient and at the same time allowed us to setup commmon options like base address for all HttpClient injections in our classes. Today we will see how we can setup timeout and retry policies for the HttpClient in in ASP NET Core using Polly . Setup a simple service using HttpClient Install Polly extensions for ASP NET Core Setup Polly policies 1. Setup a simple service using HttpClient In the previous blog post we saw how we could setup a HttpClient and register it to the service collection. Here is a simple service client which will be injected throughout the application: public interface IMyApiClient { Task<HttpResponseMessage> Get(); } And here is the implementation: public class MyApiClient : IMyApiClient { private readonly HttpClient _client;