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 WindowsFew 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 WindowsDocker basic commandsCreate ASP NET Core application1. Install Docker on WindowsThe 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 d1725b59e92d: Pull compl…

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

Setup Continuous Integration and Deployment for dotnet library with Appveyor and FAKELast 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 AppVeyorFAKE1. Configure AppVeyorConfiguring 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 environmentbuildtestartifactdeployThe 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/**/* - '**/*.md' - .gitignore pu…

Versioning for open source library

Versioning for open source libraryFew 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 versioningBranching strategy and CommitsContinuous Integration and Releases1. Version with Semantic versioningSemantic 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 patch is not risky and is u…

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 PollyFew 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 HttpClientInstall Polly extensions for ASP NET CoreSetup Polly policies1. Setup a simple service using HttpClientIn 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; public ApiClient(Http…