IAFilm Productions

Independent Alternative Film
  Home > 3. Tech

"Green Computing"

01 Jun 2023
The article below describes an experiment that has now ended.

For over a year, this website ran successfully on a Raspberry Pi ultra micro computer. This demonstrated that Microsoft DotNet Core 6 code can run on the Pi as a very low power consumption ""boutique server"".

In 2023 the physical location hosting the Raspberry Pi has become unavailable and this website has moved to a "VPS" (Virtual Private Server) which is a setup where many customer systems can share 1 physical machine. This is also economical on power use although probably not as good as the Pi. Online searches suggest 7.5 to 50W depending on the configuration and usage.

29 Jun 2021

When this website becomes its own story:

When I retired from Manukau Institute of Technology in 2020, they gave me a present of a "Raspberry Pi" ultra micro computer. The "Pi" is well known to educators and engineers as a "robot brain" device. This however is the latest version 4 which with 4 cores and 8 Gb of RAM can take on the "mini server" role. I therefore set out to migrate this website on to the Pi. It was on a PC with some green quality because it was recovered from recycled parts - but this PC idled at 40 W power consumption, and Pi idles at 4 W. "Idle" is relevant because websites like this typically have only small bursts at the moment of visitor connection with little or no load while a visitor reads a downloaded web page.

The Pi is small enough to hold within the palm of my hand.
In this photo I have created my own enclosure for it adapting a plastic container and adding a small cooling fan.

This website was a challenging candidate for migration to Pi because the tech was "Microsoft WebForms DotNet Framework" which is very much Windows tech. In programming terms this this about the most distant we can get from Pi and its Linux operating system.

In brief, what worked was a radical migration to "DotNet Core 5" which is a major reinvention of DotNet programming including making it Linux-friendly. Which means it can run on a Pi.

My old website had a "Microsoft SQL Server" database. Microsoft has recently released a version that can run on Linux including Ubuntu. I could not install it and on much searching discovered that it is incompatible with the "RISC ARM-64" CPU silicon chip at the centre of the Pi. The fix for that was a database migration to "Sqlite".

I went at first with a migration using "mono" to run on the "pi". "mono" is an system that duplicates most of the functionality of "DotNet Framework" for Linux and some other non-Windows systems. This worked well but while it required minor code changes, I found the configuration and setup on Ubuntu to be hard work.
My other programming is all on the latest "DotNet Core 5" and most of my programming community has also moved on to that leaving only a small population interested in the framework version of mono. I therefore took on the next level challenge and "got current". Fortunately my website makes only limited use of "WebForms" which are not supported in "DotNet Core 5". I was able to replace them with "Razor Pages" which have a similar arrangement where we build 1 web page as 2 files: a "client side" page based on html, and a "server side code behind" page in the "C#" ( c-sharp) programming language.

I tried a little trick that worked, which was to keep the old aspx extension as part of the new name.

e.g. an old page with files "NoticeEdit.aspx" and "NoticeEdit.aspx.cs" becomes new files: "NoticeEdit.aspx.cshtml" and "NoticeEdit.aspx.cshtml.cs". The extensions "cshtml" and ".cs" get hidden under "DotNet Core 5" so the effective names are the same as before and the old menus still work.
We may need to change the razor home directory from "Pages" to "wwwroot" so that html and cshtml pages can co-exist. If most of the pages are .aspx webforms then "Pages" is OK with its security advantage of being a step removed from the visitor-accessible wwwroot.