.NET Oxford Meetup XII: 12 Factor Apps


Last week we had our 12th .NET Oxford, and this time, our guest speaker was Ian Cooper - Lead Application Architect at Huddle, owner of the open-source Brighter, and regular conference speaker.

It was also quite a nice coincidence that a talk on 12 Factors Apps happened to fall on our our 12th meetup too!

cover picture cover picture

Intro Talk

Normally, either Matt or myself (whoever's doing the intro talk), would start off talking about what .NET Oxford is all about. We started doing this each meetup, as we had feedback saying that it might be confusing for new members otherwise. However, we're both finding this a bit monotonous, and we've since had feedback from a couple of regulars saying the same thing. When it comes down to it - it's a .NET user group - it's fairly obvious what it's all about. So we're going to cut this bit out, as it was adding a few minutes to the intro talk each time. We still went through who we are - ie. organisers and sponsors - as especially for the sponsors, this is obviously quite important.

After that, I then went through the news items and did the prize draws - details of which can be found below.

I also had an idea that I wanted to try out. I got this idea from the OGN meetup in January. At the start, they had asked if anyone wanted to do a pitch at the end. Each pitch would be a maximum of 30 seconds, and it was a fast turnaround - so each person handed the mic straight to the next person. A lot of people got up, and it seemed like quite a nice way to get more people involved. However, it did turn into a bit of a recruitment drive - which (a) isn't what I want .NET Oxford to be about, and also (b) has a conflict of interest with our sponsors, Corriculo Recruitment. So I had the idea of doing dev tips, instead of pitches. Anyone who wanted to do one, would come to the front at the end of the meetup. Fast turnaround - max 30 seconds - each member passing the mic to the next. We did this at the end (see below for the tips!), and this actually worked really nicely! We had great feedback afterwards, and this is definitely something we'll continue to do moving forward. If you're reading this, and will be at our next meetup, then it's time to get your thinking caps on! Your dev tip doesn't to be ground breaking - just one of those nuggets you've collected along the way :)

News Items

.NET Core 2.1 Preview 1

Whilst the title says '.NET Core' - this actually is about .NET Core, ASP.NET Core, and EF Core. All have had their 2.1 versions released as preview. Last month in the intro, one of the news items that Matt mentioned was that Microsoft announced the 2.1 roadmap for these technologies. This time, they've released the preview so people can play around and provide early feedback.

AppVeyor for Linux

We've all heard of the AppVeyor, the CI solution which is very popular in the open source space, as it's completely free for open source projects. Up until recently, they've only supported the Windows platform. Last week they announced that they're now also supporting the Linux platform.

VSCode Update

Okay, so VSCode has regular updates anyway. But there were a few really nice things that went into this update - so I thought it worth mentioning.

My favourite is the new Centered Layout. I use the fullscreen zen mode distraction-free layout quite a lot. I feel much more focused in this mode. However, because I want the code more central - not starting at the very left of my screen - I tended to always have the explorer pane open just for this very reason. The new centered layout provides a resizeable horizontal margin. See here for their description together with an animated gif.

They've also added improved markdown scrolling, and a brand new notification UI, plus much more!

Seq on Docker - Developer Preview 1

This one was a last minute addition when I saw a tweet by Nicholas Blumhardt about this. I'm a massive fan of Serilog, which adds structured logging to our application logging. Seq is a platform which collects and stores your logs, and also provides a UI for viewing a filtering them. A lot of people have asked about a Docker image so they can incorporate this into their own container based architectures. So they've now added this. Their announcement can be found here.

DDD South West

The final news item was about the DDD South West conference next month. I will most certainly be there, and am hoping for a good .NET Oxford turnout too! Registration will open on the 24th March.

Corriculo Recruitment

Our amazing sponsors Corriculo Recruitment where on hand being awesome as usual!

They've been our sponsors from the very beginning, and I really cannot thank them enough! They've not only helped us out financially - covering the venue costs, and providing plenty of liquid refreshments at each of our events - but also, helping us out welcoming everyone in, with marketing and promotion, feedback and advice, and much more.

I'd like to give a special shout out and thank you to both Megan and Alice from Corriculo, who are at pretty much all of our meetups and are always extremely cheerful and helpful to all our members - even though being non-developers themselves - the topics must be rather boring for them to sit through! Both definitely being recognised by all as core a part of the .NET Oxford team. It wouldn't be the same without them - so a massive thank to them both.

combo combo

Prize Draws

As usual, we had our three prizes for our amazing prize draw sponsors - JetBrains, Manning Publications, and Oz-Code.

Jetbrains

Congratulations to Andrew Smith for winning a year-long Jetbrains product licence! He hasn't yet choosen his prize, but we'd obviously recommend the Resharper + Rider combo!

Manning Books

Congratulations to Steven Dawkins for winning a Manning ebook of his choice! He's not yet chosen, but he has the choice of any of the awesome Manning ebooks from their website!

Remember that we have our special Manning coupon code (ug367) which gives all of our members a 36% discount on any of their e-books! They've also asked me to share a link to some of their new courses for their LiveVideo system.

Oz-Code

Congratulations to Stuart Nichols for winning the Oz-Code licence!

If you haven't checked it out, definitely download the trial and have a play. All our member get a free 3 month trial licence (see below) or 50% off a full licence! To claim, you can visit this link to pick up your licence!

prizesponsors

Ian Cooper - "12 Factor Apps"

I was really impressed with Ian's talk - and based on the feedback we received afterwards, I most certainly wasn't the only one! He covered a lot of different topics, but the resounding theme was definitively around containers, and how they are transforming the way we architect our applications.

He started off talking about Cloud Native, and how in the past, a lot of companies had their own data-centres and had to manage purchasing hardware, etc - and how nowadays, for most cases it makes much more sense to move to the cloud. This gives us a lot of benefits. We obviously don't have to worry about purchasing hardware, but also the cloud is much more than just somebody else's servers - it gives us the ability to scale both on demand, and providing a very "spin me up one of those" way of doing things. To quote one of Ian's slides ...

"By cloud, we mean any computing environment in which computing, networking, and storage resources can be provisioned and released elastically in an on-demand, self-service manner." (Migrating to Cloud-Native Application Architectures, Matt Stine)

Ian then talked about how Cloud providers use very cheap commodity hardware, and allow for failure, meaning that they can buy lots of hardware, and just swap them out when they fail. They then ensure that their architecture can handle failover in a way to make this a non-issue. Our solutions still need to handle failover and resiliency though - especially when designing for the Cloud.

Next up, he spoke a lot about containers, and technologies like Docker and Kubernetes. We've already had talks on both of these technologies at .NET Oxford, so hopefully most of the audience now feels comfortable with the topics. Ian works at Huddle, and talked about how it used to be a very big job to get a new developer set up - getting all the different bits and pieces of the codebase setup and installing the various different dependencies. They had scripts, but things changed that fast, that there were always additional steps that had been added, but not to the scripts. This is something I'm sure most of us can relate to! He then said how they'd switched over to Docker, where the entire architecture is defined in a much more declarative manor, and source controlled together with their source code. This now means that new devs can just install Docker, then do a docker-compose up, and the entire architecture can just spin up locally, without requiring a whole bunch of other dependencies to be installed.

Ian then went through the different Factors. He said that in earlier versions of his talk, he had gone through each Factor one at a time - whereas he now found it made more sense to explain them in a more logical order, intertwined with his demos.

For his demos, he had a Hello World app, which wasn't your typical "Hello world" app! It was a Hello World Server, and whilst he wanted quite a simple problem which was easy to understand and explain (ie. Hello World), he also needed to incorporate more complicated concepts for demonstration purposes. The source code for this can be found here. Note that you'll have to pick a particular branch to see the code, as he switched branches to add different concepts to his demo/explanations.

The app consisted of an API, a worker console app, a MySQL database, and a RabbitMQ instance. He used a library called Brighter, which is his own open-source project to keep the API controllers very thin, and also handle communication between the API and the worker process via RabbitMQ.

Ian covered a lot of different concepts in his talks - from using queues, to storing configuration correctly. I'm not going to cover every little aspect of his talk in this post, as if you do a video search on Google, he has plenty of talks online covering the 12 Factors, and this post is getting long enough as it is ;)

I'll leave you with a list of the 12 Factors ...

  1. One codebase tracked in revision control, many deploys​
  2. Explicitly declare and isolate dependencies​
  3. Store config in the environment​
  4. Treat backing services as attached resources​
  5. Strictly separate build and run stages​
  6. Execute the app as one or more stateless processes​
  7. Export services via port binding​
  8. Scale out via the process model​
  9. Maximize robustness with fast startup and graceful shutdown​
  10. Keep development, staging, and production as similar as possible​
  11. Treat logs as event streams​
  12. Run admin/management tasks as one-off processes​

Again, a massive thank you to Ian for joining us - a thoroughly enjoyable and extremely informative talk.

Ian's slides (and the slides for his other talks too) can be found here. And the code from his demo can be found here.

intro

Dev Tips

As mentioned above in the intro talk section - I had an idea of ending with a short "dev tips" section. So whoever wanted to, could get up and do a 30-second dev tip. Fast turnaround, with each person passing the mic to the next person. I thought this a nice fun way to end the meetup, and also get more people involved.

This first time was just an experiment to see if it works and members liked it - and we received very positive feedback - so we'll be continuing doing this moving forward. So if you're attending our next meetup - make sure that you get your thinking caps on and get involved next time with your own dev tip! Remember that it doesn't have to be ground breaking - just one of those little nuggets that you've found along the way.

This time we had four dev tips ...

James World - Read Those Error Messages!

When we run into an error in our programs, we often do one of two things: We try the same thing again hoping for a different result, or we make hasty unfounded assumptions and jump straight into the source code to make irrelevant changes or vainly scan the code hunting for a problem. My tip is this: Stop! Take a breath and really read the error message or stack trace. Try to deduce the problem from the information in the message - or at the very least narrow down your search area. Error messages usually tell the truth and lead us straight to the problem, if only we would stop and think for a moment!

Frans Lytzen - Virus Scanning files in apps

Virus scanning a file in apps has traditionally been very difficult. You could use ClamAV or a 1990's era unreliable COM API on Windows. This is ever more prevalent with the move to the cloud where you usually store uploaded files in special blob storage and not on disk, meaning uploaded content is rarely scanned. In Windows Server 2016 and Windows 10 a new AntiMalware Scan Interface (AMSI) was introduced, allowing you to scan a memory stream for malware using the installed version of Window Defender or other virus scanners. See here for the C API. If you want to use it in a .Net API, you can use this wrapper. Just be aware the Azure App Services do not have Windows Defender - or indeed any virus scanner - installed so you have no ability at all to scan for viruses on those (vote for it to be added here).

Dan Clarke (me) - Learning Docker/Kubernetes with Katacoda

I changed my planned dev tip at the last minute after hearing Ian wrap up his talk recommended playing around and learning Docker locally - even if you don't intend to use it quite yet for a production app. This made me think about the awesome KataCoda website - which is a fantastic resource for learning Docker, Kubernetes, and other technologies right in your browser. Under the hook, it uses containers to give you a hosted CLI in your browser where you got follow along the different scenarios - learning by doing. This has been created by Ben Hall, and is even now embedded in the official Kubernetes documentation!

Ian Cooper - Learn Unix via the Windows System for Linux

Ian's tip was to learn Unix via the Windows Subsystem for Linux, to help you learn by administering your Windows box via Linux, rather than having to download and install VMs just to play around with Linux.

Pub!

As usual, our regular pub visit afterwards was at the Royal Blenheim, just around the corner. It was good to be joined by Ian before he headed back. I also got chatting to one of our members, Guy, who is a previous Jetbrain's licence winner. We were chatting about Rider, R#, then got chatting about LINQPad. I always love it when I'm chatting to a .NET dev who doesn't use LINQPad, and see their eyes light up when I explain what it can do! Based on his reaction - I'm guessing I just sold a licence. I really should be on commission! :)

Upcoming Meetups

We have some fantstic means coming up - we even have one in July about quantum computing! Below is a link to all our announced upcoming meetups ...

Upcoming Meetups

Hopefully see you there! :)


Please retweet if you enjoyed this post ...

Search


Recent Posts


Featured Posts


.NET Oxford Links