Football Pontoon Azure Architecture

As you may have seen from my recent posts on LinkedIn, I have been creating a new website called FootballPontoon.  It is a game you can play with your friends or work colleagues where each player picks a unique team from the Football League, pays a weekly ante and the first team to get to 21 wins the cash.  At that point, you all go back to zero and the next round starts.

It is a good game to play and can even attract people who are not into Football as it is pretty much set and forget.  It was a game my wife's work played and I was always interested in her teams performance.  After hearing that it was managed manually (yep, someone has to manually enter scores for each team into spreadsheet each week!), I thought that it could be done better.

So I created something pretty good which used Google Sheets to auto download results, calculate scores and then used Google Scripts to send out weekly updates and check for winners.

Look at that formula!

This worked really well and meant I had pretty much zero work to do each week.


During my recent journey to pass my AZ-300 and AZ-301 exams, I did wonder if I had a proper application to develop, it would be easier to learn lots of the Azure technologies and how they connect together.  Following walkthroughs and tutorials is fine, but sometimes it can feel as though as though you are blindly following instructions without challenging why certain things are done.

Now, don't get me wrong, docs.microsoft.com is an absolute treasure trove of amazing documentation and in the last few years has seriously ramped up in quality and quantity.

My background is primarily in Operations and End User Compute, so software development is very new to me.  I decided to re-engineer what I had in Google and do it within Azure.  And this is what I ended up with

https://footballpontoon.uk

Current Scores

Previous Round

The architecture is as follows.




Azure Automation
So I am using Azure Automation RunBooks for some activities.  I could have used Azure Functions, but I am more comfortable with PowerShell.  I have three Runbooks.  One that will download the latest score information and update my SQL database, one that will check each night whether a team has won and if so to create the new round and lastly a RunBook which will post a tweet of the latest scores via If This Than That (IFTTT).  It also uses a service called ScreenShot Machine.  This takes a picture of the current scores table on the website and adds it as an image to the Tweet.   

The Runbook which checks the latest scores is triggered by a logic app.  The reason for this is that a standard Azure Automation schedule can do a maximum of once an hour.  During the periods where there are lots of games (Saturday 3pm-5pm) I wanted the website to be updated much more frequently.  Logic Apps give you this flexibility, so I have it initiated every 5 minutes during the busy period and every 8 hours otherwise.

Database
I have a basic SQL database with 5 tables in total (rounds, currentscores, previousrounds, teams and matches).  I won't go into too much detail about the relationships, but I will say that the DB design was the most important step in creating this.  I spoke to a friend of mine who is a SQL expert (Daniel O'Reilly) and he told me to spend some time to map it all out up front.  This certainly helped out a lot further down the line.

WebApp
I created a basic Azure WebApp in C# to display the information from the SQL database.  I am using DevOps as source control and have configured Continuous Integration to automatically build a new website on newly pushed code.  The following PluralSight course was really useful on getting me up to speed.

ASP Fundamentals

Cloudflare
I am using Cloudflare for DNS and HTTPS for the new site.  In Azure, you can add custom domain names and SSL/TLS for WebApps, but only if they were a certain tier.  I am using my VS subscription credits for this service and didn't fancy spending £50 a month just to support a custom domain name for TLS.  Cloudflare gives you this capability at their free tier and is something I use for this blog.

Other bits
I used Azure Bastion quite a lot to connect to a developer VM with Visual Studio and SSMS.  This was really useful as it meant I could get access to my tools from whatever machine and connect to the VM from within a browser (no fancy port opening needed!)  Azure Bastion costs about 7p an hour regardless if you are using it or not and it is not possible to turn it off.  For this reason I would delete it and use Azure RM templates to recreate it whenever I need it.  This would say a lot of money on my VS subscription.

Next Steps
I would like to investigate the possibility of people being able to create their own leagues.  This does pose a number of challenges.  I haven't had to do anything on authentication at all and data privacy would be a big concern.  I don't want to hold user information until I am more confident with c#.

I may look at Microsoft Flow as an alternative for IFTTT going forward.

I want to update the site to asp.net core 3.0 at some point, but at this moment in time, it is not supported for Azure App Services.

Conclusion
Let me know what you think and if you have any ideas.  This process has been really useful to learn new things and will help me going forward when using new features.

Comments

Post a Comment

Popular posts from this blog

Assigning Windows 10/11 Enterprise Subscription Activation Licences to Hybrid Azure AD Joined Devices

Power Automate: Get first item in output

De-selectable radio buttons - Power Apps