What does my blog run on?
The basis
As a starting point for my blog I used Mads Kristensen MiniBlog. It is a nice little C# .NET blog project with all the important things in it. At the moment I'm using it, .NET 8 has already been released the first thing I did was upgrade it, which was quite easy. I also configured it to run in a container, which is helpful when developing with Visual Studio on Windows and debugging and testing with Docker Desktop on Linux.
Things I've removed
- The Azure.ImageOptimizer package. I've replaced it with a logic that, when saving a blog, checks the images used in the HTML and makes sure there is an optimised image for it. I'll do a blog about this in the future, I just have some ideas on the roadmap to improve it a bit more.
- The WilderMinds.MetaWeblog and therefore the MetaWeblogService. It is my personal blog and I plan only to maintain it only from the site itself. To keep it smaller and simpler I've removed the MetaWeblog API implementation.
Styling
Default SCSS was already used for styling, I've updated the stylesheets to my personal taste. By default it also includes the LigerShark.WebOptimizer and LigerShark.WebOptimizer.Sass libraries for bundling and minifying CSS and JavaScript. The Sass library adds a SCSS to the CSS compiler, making using SCSS just as easy as using CSS.
Scripts
By default it doesn't use any JavaScript frameworks such as Angular, React, Vue and even old school JQuery. This saves a tiny bit of time loading and parsing a large javascript library before rendering the page. When I've added the AspNetCore.Identity for the logins I've got on these default views also JQuery, in the near future I'll fix it so that JQuery isn't needed anymore. There are a few custom JavaScripts in the project, they are only a few kb's big. There are also a few specific libraries are used:
- TinyMCE, the WYSIWYG that is used to write the blogs. By default it was using an older version 4.8, I've updated it to a more recent version 7.4. I also customised the add image button. It now has a popup where I can upload, browse and select images.
- PrismJS, when you notice a block of source code in a blog, PrismJS highlights the syntax. It's a standard TinyMCE plugin, it was also using an older version 1.15, I've updated it to version 1.29. Also added SQL and PowerShell to the options that can be selected from within TinyMCE.
- Cropper, when you create a login you can add a profile picture. Cropper is used to edit your profile picture. Creating an account wasn't possible in the default version. Maintaining a profile picture wasn't possible either, gravatar.com was used instead. I chose to require a login because it is an easier way to block bot comments, and limit the amount of emails to verify the user/comment. I could still use gravatar.com, but using Cropper was more fun for me.
Libraries
A lot of standard .NET libraries of course, its so boring to mention those. A few of the libraries I added extra are:
- Html Agility Pack, I use it when saving a blog to update the img tags in the HTML. For example, TinyMCE applied a width and height attribute after scaling the image, then the page wasn't resposive anymore. Now it changes it to a max-width and max-height and applies a CSS class that is used to override the float behavioir with a media query. It also updateds the url to fetch an optimised image for the correct dimensions.
- Microsoft.EntityFrameworkCore, not really special and worth mentioning. By default the MiniBlog uses just XML on the disk. I decided to use a database and used EF as the ORM. Its not really my preferred ORM, I like SQL and like having more control over the queries. For a small blog EF generates queries that are more then fine, also nice to keep my knowledge of EF a bit up to date.
- PhotoSauce.MagicScaler is used to generate the optimised images. Because my project runs on Linux, I'm using prereleased versions for the supported file types. I like this library because of the performance and the memory consumption. I don't mind the risk of using a prerelease version, I haven't encountered any problems, if I do I will figure it out or work around it.
- ZiggyCreatures.FusionCache after seeing the video on the .NET YouTube channel this year I was sold. Things like the protection for cache stampede, fail-safe and more control over timeout makes it a better choich then using standard MemoryCache. It even has a lot of extra nice features that I dont' use.
What is it hosting on?
Its running in Azure and using these services, I use a lowest possible specs to save the costs:
- Azure Web App for Containers in a Linux Basic B1 App Service plan.
- Azure SQL Database its a single database on the Basic tier
- Azure Blob Storage in LRS on the Hot Access tier
- Application Insight to monitor for errors and see if the performance isn't that terrible while using the lowest possible specs.
Comments
Register or login to leave a comment