Apr 6, 2018

Docker on Windows: drives sharing hint

Related to Docker for Windows (as far as I know), short hint for drives sharing: if you use AD account to secure workstation, after password change drive sharing stops working. You need to go to Docker settings, un-share drives, Apply, then share them again (providing new credentials). Weird, does it store my password somewhere in it's guts? PS: eventually you may need to remove the image you were using and download/rebuild it again.

Apr 3, 2018

Runnning .NET Core app on Amazon EC2, part 2

I am running .NET Core apps on Amazon EC2 new images, the part 1 is here.
In Part 1 I got the app running using simple Nginx configuration, but apart from Nginx, there are other options. This should not be full web server, since all the requests are processed by Kestrel already, so just a proxy or load balancer could fit. I was told Traefik is a good option, so let's try it.
Traefik is a dynamic load balancer that integrates with different infrastructure orchestrators, but we need only simplest static config and that's quite simple to do - go get the Traefik:
sudo wget -O /usr/local/bin/traefik "https://github.com/containous/traefik/releases/download/v1.6.0-rc3/traefik_linux-amd64"
Make it executable:
sudo chmod +x /usr/local/bin/traefik
Create config file:
sudo mkdir /var/traefik
cd /var/traefik/
sudo nano simple.toml
And put following content in it:
[entryPoints]
        [entryPoints.http]
        address = ":80"
[file]
[backends]
        [backends.back1]
                [backends.back1.servers.s1]
                url = "http://localhost:5000"
[frontends]
        [frontends.front1]
        backend = "back1"
        [frontends.front1.routes.site]
        rule = "Host:ec2-34-241-215-56.eu-west-1.compute.amazonaws.com"
Create and start .NET Core application as daemon (described here)
And now it is left to start reverse proxy, it also could be run as daemon but I'll simply run from console:
sudo /usr/local/bin/traefik --configFile=/var/traefik/simple.toml
And that's it! Additional perk of Traefik is its Let's Encrypt integration, but I was not able to configure that for my EC2 instance-based app despite spending a couple of hours, so maybe that's the quest for the next time. Don't forget to stop/terminate EC2 instances after trying, or that may cost you some money if you are above the free tier or not using it.

Apr 1, 2018

Runnning .NET Core app on Amazon EC2, part 1

Recently, Amazon announced a new AMIs with .NET Core, based on Amazon Linux 2 and Ubuntu. Those come pre-configured with .NET Core 2.0, PowerShell Core 6.0, and the AWS CLI.
I was curious, how hard it is to use them to host web applications built using .NET Core?
The thing with .NET Core web apps is that you need a reverse proxy to serve the app, which runs in Kestrel. In this part I will be using Nginx as a reverse proxy and will try to do that with both Amazon Linux 2 and Ubuntu.