If you have been attentive (and I wouldn't blame you if you haven't), you may have noticed that this blog was quite silent for the past few months. Apart from a blog post around the Microsoft Build timeframe, I didn't do much here. There are multiple reasons for that (aren't there always...), but the main one was that when I joined Microsoft a year ago, I also undertook a fairly big task on my free time: I decided to port my website and my blog to Azure.
When I joined the Cloud Developer Advocates team (part of APEX, Azure Platform Ecosystem and Experiences), I didn't know very much about Azure. The extent of my experience had been to create virtual machines when I wanted to try new technologies. When I discovered all the services that we have, I was very tempted to explore and use some of this goodness for myself. The first thing that came to my mind was porting some websites I have to Azure App Services. Before that, I was using DiscountASP.NET and I must say I was always happy with their services. I was using a medium tier and I never minded paying for the services and the excellent support. But of course the attraction of Azure just cannot be resisted, together with the joy of trying new features.
Porting the website
Porting the website was not a huge deal. The hardest part really was to decide what to keep and what to remove. I still had quite a lot of legacy pages that I was keeping mostly for sentimental and historical reasons. Removing them and adding some redirects where needed was fairly easy. I'll write more about this in a future post. A really nice thing with ASP.NET is that it is quite easy to configure redirects so that old links continue to work, or direct the user to a landing page explaining gracefully why the link they clicked doesn't work anymore.
Apart from that, my website continues to use the same technology as it did before: I am using Razor pages as the front end with lightweight C# code as the back end. I decided not to go for a full blown ASP.NET MVC site because even though I love the MVC approach, it felt too complex for a simple personal site. I am really happy with the way that my site turned up. More about that in future posts.
One immediate change I made after porting to Azure was to add an SSL certificate to my site and to enforce HTTPS everywhere. I was very late to do that (I really wanted to finish the port to Azure first), and every site should enforce HTTPS, period. This is done now, enough said.
I will show how to add an SSL certificate to a website on Azure in a future post. In the meantime you can check this article.
Porting the blog
Porting the blog was a different beast altogether. When I started blogging in 2006, I was using the GeeksWithBlogs platform. My friends Jeff Julian and John Alexander created a really welcoming environment with good SEO and this led to me getting my first MVP award a few months later.
Years later however, I took the decision to place my blog content on a self hosted WordPress instance, running on the same server as my website at DiscountASP.NET. This decision was mostly due to me wanting to "own" my content completely and have total control over everything (call me control freak if you want...). WordPress was fun and all, and I even coded a few features in PHP (which was a first for me). This worked pretty well and apart from the fact that templates are relatively complex to edit, I didn't have complaints about WordPress or about running it on the DiscountASP.NET servers. Things were running well.
When I decided to post everything to Azure, I was faced with a choice however. The alternatives were as follows:
- I thought of leaving the blog on WordPress at the DiscountASP.NET platform, at least temporary. This would have been a complex redirection scenario however, since my website is http://galasoft.ch and the blog is http://blog.galasoft.ch. Running these two instances on completely different servers sounded really complicated. In addition it would have been temporary anyway since the ultimate goal was always to get everything on Azure.
- The next logical thought was to install WordPress on Azure, since we are able to run PHP applications on Azure. I even installed and configured an instance, got it running and started looking into importing my old WordPress content into the new instance. But then I stopped and started to think... was that really the best solution? Did I really need WordPress for my blog? I was not sure that this was a great idea.
Later on I had a discussion at a Swiss technical event with Marc Müller, a member of our community and an MVP, he mentioned using static websites with the Jekyll platform. I took a quick look and thought that I could totally do that, but I didn't even want to take a dependency on Jekyll. What I wanted was so simple that it was super easy to code it myself.
- For old existing blogs, I simply scraped the HTML (using a custom built console app) and saved everything as HTML fragments in a folder.
- For new blogs, I wanted to write them using Markdown. Then a simple line of code generates the corresponding HTML code to the static HTML fragments folder, using MarkdownSharp.
- Finally when a user wants to read one of the blog posts, I simply load the corresponding fragment into my razor layout.
There are multiple reasons why one would want to use Markdown for a blog post. For me the most compelling was that Markdown is also used by Microsoft for our documentation platform. This is a really simple way to create and edit documentation and posts with simple tools such as Visual Studio Code on PC or QuickEdit on Android.
I will write more about my editing process on Android in the future post
In addition, Markdown is also used to create documentation on Github, in the famous Readme.md and other files. For me, using the same tool chain for my own blogging than we use at Microsoft and on Github was a huge advantage. No more context switching, no more cumbersome tool like Open Live Writer (which was awesome in the days, but feels too complex (and Windows only) nowadays).
Every time that I speak at a conference, I add a new page to my Presentations section. This is where the participants (or other interested persons) can find the slides, links to the corresponding Github repos, and additional material. Earlier, I was using JSON files to store the information for these sessions. Recently however I modified them to use Azure Tables instead. This gives me more flexibility to create a Xamarin.Forms client for my Android phone and my Windows 10 tablet. This client is still a work in progress but now that the site has been published to Azure, I should have more time to invest in it.
This client also does other things such as managing my "gslb.ch" short links such as gslb.ch/cda.
In order to avoid waiting times when loading the data from the Azure Tables, I am still using static JSON files which are created when needed (such as when I add or edit an existing presentation). This all happens automatically on the website. As mentioned, I will write more in details about this process in a future blog post.
For the next steps, I have a few things I want to improve:
- Change the Podcasts and Articles sections to use the same mechanism as the Presentations section, with Azure Tables and static JSON files for caching to improve the performance.
- Continue working on the Xamarin client for the short links, Presentations, Podcasts, Articles.
- Add a page about my upcoming and past conferences. At the moment you can access past conferences through the side bar but this layout will probably change quite a lot in the future. I want a dedicated page for that.
- Add a mobile layout. Again, this is something that has been a long time coming (apologies for that). Now that everything is in place, and that the blog uses the exact same layout as the rest of the website, this should be easy to do.
- Revamp the site's design. I get sometimes comments about how it looks like a 2000' website :) Personally I like it but I agree that it's time to make changes. When and if I have time ;)
I am really excited to be able to blog more often now, and will get started on the series about the long journey that took me about a year to port everything. In the meantime, happy coding!