How to Serve Static Files (CSS, JS, Images) in Express JS?(Digamber Rawat) - I just recently start using Express.js and it's been a joy. A very well done package. This post explains a way to structure your server for static content.
The DevOps Handbook - The Technical Practices of Flow (Coding Blocks) - A very long but funny and interesting episode about DevOps. They will review The DevOps Handbook, sharing some experiences, and explaining why they like dislike agree or disagree.
Every Monday, I share my reading notes. Those are the articles, blog posts, podcast episodes, and books that catch my interest during the week and that I found interesting. It's a mix of the actuality and what I consumed.
Myself: It's not weird at all (Hanselminutes - Fresh Talk and Tech for Developers) - I nice episode much longer than the usual, but the guest is also special... It's Scott. During a Live Stream on Twitch it the Live Coders... People suggest making a podcast episode of the interview... I couldn't agree more.
The Power of Humor in Tech with Chloe Condon (Screaming in the Cloud) - Very refreshing episode with the awesome and very colorful Chloe. Nice show that goes to fast. Very interesting discussion about the non-traditional way to technical work, and its success.
Gather Your Community or Get Left Behind—Mighty Networks and More (The Smart Passive Income Online Business ) - Nice episode that talks about what comes after blogging... The alternative to Facebook community and different opportunities to answer our graving of community and feeling of appurtenance.
Every Monday, I share my reading notes. Those are the articles, blog posts, podcast episodes, and books that catch my interest during the week and that I found interesting. It's a mix of the actuality and what I consumed.
Generating Images with Azure Functions (Aaron Powell) - Brilliant usage of Azure function and its the first one I see in F#! All the code is available in GitHub, definitely worth the detour.
Programming
A WebAssembly Powered Augmented Reality Sudoku Solver (Colin Eberhardt) - This is sick! I'm very impressed by all that work and of course by the result! A great post that explains all the steps to get that working.
Use MongoDB in Your C# ASP.NET Apps (Terje Kolderup) - This is a very complete tutorial the shows all the code and explains step by step how to add, configure and use MongoDB.
Podcasts
SPI 401: Jesse Cole—The Yellow Tux Guy (Jesse Cole) - Wow! Great show, if you don't feel pumped up and 200% motivated after listening to this show... We might be in Zombieland already.... 😜.
Miscellaneous
Is that position available for remote? (Mark Downie) - A very interesting post that, I think, explains well the 'behind the scene' of the response we can get when asking the remote question.
Serverless Deployment Best Practices (Fernando Medina Corey) - A nice post that shows some of the best practices for serverless and how AWS implements them.
Why jQuery is Obsolete and Time to Stop Using It (Chris Love) - Great post. I was a big user of jQuery, and these days I do less front end stuff, so it is nice to see how things have evolved and to understand the impact jQuery had.
GitHub stars won’t pay your rent (Kitze) - What a great story! This is an awesome journey of a developers who worked hard, took some risk and... Got result. All developer should read this.
Blazor – on the server or on the client (Christian Nagel) - A great post about blazor that explains very well the current status of this very promising tool.
How to become a Git expert (Aditya Sridhar) - A very nice post that explains how to fix common mistake users does and also explains how to keep our history clean.
Web Architecture 101 (Jonathan Fulton) - This is a very complete article that does a tour of every piece of a web solution.
Ghost Contact Form with Azure Functions (Tom Faltesek) - Being myself a user of both Ghost and Azure function I'm very excited about this new series of posts.
Building offline Blazor application (Gunnar Peipman) - A very interesting post about an experience done with Blazor. It's usually during those that I learn the most.
Introducing the Cake.Discord Addin (Gary Ewan Park) - A few weeks ago I used cake to deploy in Azure and I was very impressed by cake. Its great to see this project continues to evolve and get new addin is very cool.
Marking up the Web with ASP.NET Core and Markdown (Rick Strahl) - So many great ideas and cool projects in this article. If you use Markdown it's a must. If you are not using markdown, hmmm... what?!
Fast Focus (Damon Zahariades) - Great short book. Not like the other of his kind, this book goes right to the point and offers actionable item. It's very practical and accessible to everyone. At the end of the book, you know what to do to get started and improve your focus.
elementary OS 5 Juno is Here – elementary – Medium (Cassidy James Blaede) - ELementary was already one of my favorite Linux distribution. With this new version named Juno it's just... Hmmmm so smooth and beautiful. Try it you will see.
Creating the perfect MVP Summit (Charles Sterling) - The MVP summit is a very special event. However, these suggestions are also applicable to other technical event.
For a project I have, I wanted to validate if containers were easier to use compare to regular code with services in Azure. I needed to refresh myself with Docker, so I decide to do what I thought would be a simple test: Create an Asp.Net Core web site in a container and access it on my machine.
This post is about my journey to finally achieve this goal, as you may guess it didn't work on the first attempt.
The Goal
One reason why I was looking at containers, it's because it's supposed to be working everywhere right? Well yes but sometimes with a little of effort. The goal here is to be able to run the same container on my main PC, my surface, a Linux VM and of course in Azure.
The context
I have a different setup on my main machine and on my surface. On my PC, I'm using VirtualBox for my VMs so I'm not running Docker for windows, but Docker Toolbox. This flavor (older version) of Docker will create a VM in VitualBox instead of Hyper-V. I couldn't use Docker for Windows like on my Surface, because the two virtualization softwares don't run side by side.
I also wanted to use only tools available on each of this platform, so I decided not to use Visual Studio IDE (the big one). Moreover, I wanted to understand what was happening so I didn't want too much magic involve. Visual Studio is a fantastic tool and I love it. :)
Installing Docker
I needed to install Docker on my Surface. I downloaded Docker Community Edition (CE), and because Hyper-V was already installed everything ran smoothly. On Windows, you need to share the "C" drive from the Docker setting. However, I was getting a strange "bug" when trying to share mine. It was asking my to login with AzureAD and was ignoring my request by letting the share drive unchecked.
Thanks to my new friend Tom Chantler, I did search for too long. See the thing is I'm using an AzureAD account to login, and something is not working right at the moment. As explained in Tom's post: Sharing your C drive with Docker for Windows when using Azure Active Directory, to walkaround this situation, I only had to create a new user account with the exact name as my AzureAD account, but without the AzureAD prefix (ex: AzureAD\FBoucher became FBoucher). Once that was done I could share the drive without any issue.
Let's get started with the documentation
The HelloWord container worked like a charm, so I was ready to create my Asp.Net Core website. My reflex was to go on docs.docker.com and follow the instruction from Create a Dockerfile for an ASP.NET Core application. I was probably doing something wrong, because it didn't work. So I decided to start from scratch and do every step manually... I always learn more that way.
Let's start by the beginning
Before moving everything in a container, we need a web application. This can be easily done from the terminal/ command prompt, with the commands:
dotnet new mvc -o dotnetcoredockerappservicedemo
cd dotnetcoredockerappservicedemo
dotnet restore
dotnet publish -c release -o app/ .
Here we create a new folder with a website using the mcv template. I then go in that new folder and restore the Nuget package. To test the we site locally simply use dotnet run. And finally, we build and publish the application into the subfolder app.
Moving to Docker
Now that we have our app it's time to containerize it. We need to add some Docker instruction in a dockerfile. Add a new file name dockerfile (no extension) to the root folder and copy/paste these commandes:
To start Docker with Docker Tool just start the Docker Quickstart Terminal
This instruction will specify how to build our container. First, it will download the image microsoft/aspnetcore or microsoft/dotnet:2.1-aspnetcore-runtime. We specify the work directory, then copy the app folder to app folder inside the container. Finally, we specify the entry point of our application telling it to start with dotnet.
Like Git and it's gitIgnore file docker has the same thing with .dockerignore (no extension). Add that file into your folder to ignore the bin and obj folder.
# .dockerignore
bin\ obj\
Now that the instructions about how to build our container are completed, we can build our container. Execute the following command:
docker build -t dotnetcoredockerappservicedemo .
This will build dotnetcoredockerappservicedemo from the current folder.
Running Docker container locally
Everything is in place, the only thing missing is to run it. If you want to run it locally just go with this command:
docker run -p 8181:80 dotnetcoredockerappservicedemo
On my machine, the port 80 is always used. So I remap the port 80 to 8181, feel free to change it at your convenience. The website will be available at localhost:8181
If you are running Docker Tool (older version of Docker), you need to get the IP of your VM. To get it do
docker-machine ip
Running in the cloud
To run our container into Azure you will need to publish it to the cloud first. It could be on DockerHub or in a private registry on Azure. I decided to go with Azure. First, we need to create a registry, then publish our container.
az group create --name dotnetcoredockerappservicedemo --location eastus
az acr create --resource-group dotnetcoredockerappservicedemo --name frankContainerDemo01 --sku Basic --admin-enabled true
az acr credential show -n frankContainerDemo01
The last command az acr credential show will provides information to tag our container with our repository name and also gives us the credential to be able to push. Of course, you could go to the portal.azure.com and get the information from the Registry's Access Keys blade.
docker tag dotnetcoredockerappservicedemo frankcontainerdemo01.azurecr.io/dotnetcoredockerappservicedemo:v1
Let's connect our docker to our registry, and then push (upload) our container to Azure.
# The https:// is important...
docker login https://frankcontainerdemo01.azurecr.io -u frankContainerDemo01 -p <Password_Retreived>
docker push frankcontainerdemo01.azurecr.io/dotnetcoredockerappservicedemo:v1
Great the container is in Azure. Now let's create a quick webApp to see it. We could also use the Azure Container Instance (ACI) that would be only one command, but because the demo is a website, it won't make sense to use ACI for that.
To get an Application service, we need a Service plan, and then we will create an "empty" webapp. To do that we will specify the runtime without providing any code/binary/container. I wasn't able to create a webapp from a private Azure registry in one command, so this is why I'm doing it in two.
az appservice plan create --name demoplan --resource-group dotnetcoredockerappservicedemo --sku S1 --is-linux
az webapp create -g dotnetcoredockerappservicedemo -p demoplan -n frankdockerdemo --runtime "DOTNETCORE|2.1"
On Windows, I got the following error message: '2.1' is not recognized as an internal or external command, operable program or batch file. The PowerShell command line escape "--%" solves the problem: az --% webapp create -g dotnetcoredockerappservicedemo -p demoplan -n frankdockerdemo --runtime "DOTNETCORE|2.1"
If you check the website right now you should have page saying that the site is up but empty. Let's update the container settings with our registry and container settings.
az webapp config container set -n frankdockerdemo -g dotnetcoredockerappservicedemo --docker-custom-image-name frankcontainerdemo01.azurecr.io/dotnetcoredockerappservicedemo:v1 --docker-registry-server-url https://frankcontainerdemo01.azurecr.io --docker-registry-server-user frankContainerDemo01 --docker-registry-server-password <Password_Retreived>
It's works of course!
Conclusion
It's only four steps: create the .Net Core application, package it into a Docker container, publish our container into our Azure Registry, and create an application service base on that container. However, because all this tech are cross-platform, sometimes you get some little tiny differences between the platform, and those could become time-consuming. It was a great little project that turned out to be a lot more than expected, but I learn so much!
I'm very happy with the result... expect more of Docker in the future!
How to use Visual Studio Code (Flavio Copes) - Another post that confirms that VSCode definitely worth our attention. This post gives examples, and shows deferent extensions... If you don't know vscode... Yep start here.
[Invisible Ink: A Practical Guide to Building Stories That Resonate] (Brian McDonald) - We all know it, a story is the element that will give that little plus to our post, and video. This short book explains how to really make an effective one talking about the not visual things... Really interesting.
Exploring the Azure IoT Arduino Cloud DevKit (Scott Hanselman) - This is an excellent post to know where to star with arduino and make your mind of what to expect in terms of effort vs result.
Creating a Minimal ASP.NET Core Windows Container (Jeffrey T. Fritz) - This is an amazing post that shows how to optimize our containers. It may be about Asp.Net Core but it applies to any containers. It also shows one of the big improvements with .Net Core...
Why I won't be switching to VSCode any time soon - A geek with a hat (Swizec Teller) - I was surprised when I saw the title of this post, how could you not like VsCode? However, after reading it, I understand. Through preferences are personal, VSCode does a lot and needs a bit more than few minutes to be tame. I got also overwhelmed when I started using it. The secret is the documentation... and sometimes. Then it becomes whatever you want.
You might be a creative if … (docjamesw@gmail.com) - A post to read in the morning. It's like a little pill of energy.
You’re doing it wrong: Demos (Gil Zilberfeld) - Nice quick post that helps us to definitely pick a side when the question "Should we demo that?" popped.
Happiness is DevOps’ Cornerstone (Alexandre Brisebois) - Interesting post that asks a lot of questions... I would like to see some graph or pie chart about our answers.
5 Habits that Help Code Quality (View all posts by Erik Dietrich) - Yet another post about how to code better, but this one is refreshing. It explains why the opposite would be harmful and also give us a training plan for better chance of success.
What’s in your highlights folder? (Marc Gagne) - Because life is not only mistakes and bad luck.Here good tips to help you giving some sunshine into your life when needed.
But Why Do You Trust Your Data? (Buck Woody) - I consider this post as a really great teaser. After ready his post most chances are you will check the video it recommended... and next give a shot to Azure data Catalog.
Analyzing your Azure Search traffic (Berni Torres Garayar) - Great post that explains how to improve our services by listening to our client's search requests, leveraging the new Azure Search Analytics and PowerBi.
Miscellaneous
Give yourself permission to have work-life balance - In a connected world, it's easy not to slow down a moment and raise our head to look around us. Interesting post to read before you win the race to the burnout.