Prologue
I am a software developer and an avid enthusiast of everything related to it (capitalization optional) - languages, frameworks, methodologies, operating systems, servers, etc. It is worth mentioning that having been an enthusiast for little over a decade, I’ve come to prefer languages to other languages…
So, similar to at least several other people in this world, I’m driven by the possibility of working for myself - a free man in a free world with currency to spare, able to pick and choose what I dedicate my (valuable) time to.
The beginning
Our adventure begins in September 2021, when I’m approached to request help setting up and maintaining a project - let’s name it PictureView.
PictureView is a project where people can take pictures and send them for other to look at. It was already written by an organization X quite some time before I was approached. PictureView consists of five components - an Android application, an iOS application, a webservice to service those apps, a different webservice to display a pretty…, a functional…, a UI to view those pictures, and, of course The Database.
The deal was simple: I host and maintain PictureView’s stuff, upload the apps to their respective app stores, and in return receive currency in amounts that my young self had never seen before in one place. I was thrilled, because for that much currency, I was happy to do anything! foreshadowing…
We signed a contract and I got cracking.
This is a good place to shed some light on the technology behind PictureView. The two webservices were written on .NET Framework v4.5 (M$’s website lists publish date as 2012). The two mobile applications are actually a single Xamarin.Forms app with Android and iOS targets. And The Database was MS SQL.
The ordering of the last two events is correct. My young self wasn’t too worried about the tech in PictureView because, again, currency.
- Xamarin was Microsoft’s solution to write cross-platform apps in .NET. In addition to Android and iOS, it allowed creation of native Windows, macOS, and Linux desktop apps (native here meaning “not a glorified web browser” - looking at you, Electron…) with a rather high degree of shared code.
- Note: Xamarin reached EOL in May 2024 and is replaced by MAUI
- .NET Framework is Microsoft’s implementation of CLI
- MS SQL is Microsoft’s… SQL server…
Getting the webservices up and running
Working in software dev, I’ve come to love reproducible workflows - build pipelines, deployment pipelines, scripts, infrastructure as code, etc. By that time I was already heavy into Linux and dailying some distro or other, can’t remember anymore. But as PictureView’s services were .NET Framework, it meant two things: a Windows host (yuck) and IIS (yuck). Now, for those of you who don’t know, both of those things mean endless menus, settings, clicking, specific (and often magic) folder structure. And those of you who do know, glory to Bash, PS has no place here!
Dear Jod, was I in for a ride! (Jod is a whole different joke on gif vs jif)
Being a Linux man,
… I struggled with Windows - everything needs to be done by clicking; IIS looks horrible; and the worst part is that I’m constantly comparing the process to doing the same on Linux: “could’ve used this script here”, “could’ve deployed that software there”. I really wanted to automate everything I did on the way so that I’d have concrete steps in place should I need to do this again. I did not get to this… All I have are some notes and screenshots…
Being a Java dev,
… I struggled with Visual Studio. I cannot fit this in my head how a whole ecosystem is designed around a single, magic box of an IDE and half of the world’s devs are fine with it.
It also appears that it is absolutely expected to publish your work directly from Visual Studio to IIS or to a ZIP package. The msbuild
tool seems to be either secondary or buried deep into VS’ guts.
In the end,
… my deployment consisted of GitLab’s CI using Windows runners to compile the code and an IIS host to deploy the code onto. Now, getting to code from GitLab to the IIS is an adventure on it’s own. Next to the Windows host sat an Ubuntu VM which mounted a network share from Windows. The deploy process was that GitLab made a tarball and scp
-d that onto the Ubuntu’s mounted directory, from which a deployment script did some more magic to make IIS eat the new version. Horrible, I know, but that’s what I got working. I was afraid to touch it any more…
Note on containers
I did try containerizing the webapps, but being .NET framework v4.5, i.e Windows only, I had to use Windows containers. Windows containers make the images huuge, as in 11GB huge for a simple webservice?! There was also the issue of Docker’s Windows compatibility starting with Windows Server 2019, which is not Windows Server 2016, the latest Win Server I got the services working on.
Regardless
… I got the services working and everything seemed was fine for some time.
The re-beginning
Summer of 2023 - how PictureView becomes a ticking time bomb. Android API level, Xamarin support my fear of not being able to restart the service should it crash
Having let the services and servers be for nearly 1.5 years by themselves my consciousness started waking up. “Should the servers go down, I might not be able to get them up again. I cannot even remember how I set them up…”. I contacted the client to let them know, saying I cannot continue with the current state of the codebase after our contract ends at the end of the year. I let them know that they’d either have to find someone else to take over maintenance and hosting of the services or we sign a new contract to update the project.
I was starting to really sweat about not being able to get the services up again in the event of a crash. All I had were some vague pointers in my notes along with some screenshots. I think I didn’t get to the documentation part because setting up was so painful that I couldn’t remember what exactly made any exact problem go away. Sometimes I would progress, and sometimes changing the same setting would regress me past the point I was at before…
We agreed on me updating the services. Why? Remember the part about currency? Yeah…
The deal?
Everything to at least .NET 6 - which makes the services cross-platform so I can finally start working on the code on Linux (yay!) Additionally, the apps need updates as Google introduced a requirement that starting on 31st of August, 2023, all updates to apps need to target API level 33. PictureView’s app targeted API 24… crap…
The end
Spring of 2024
Developing a Xamarin.iOS application is weird, because you can have multiple targets live together in the same code base. Not a monorepo directories for different projects - a shared lib and two targets depending on that lib.
Android
I discovered that since I hadn’t updated the Android app for long enough, Google was threatening to close my account because
Google Play Developer accounts are intended for developers who actively publish and maintain apps.
Thus began the race to push an update before the deadline, the 8th of March. Basically every dependency needed updating and every single link in the chain was fighting back to me. Need to pull an update from NuGet? NuGet is down. Need to follow functions through code? Visual Studio has crapped itself and needs a restart. (By the way, similarities between Windows and VS are striking, you can tell they’re both from Microsoft - an almost illegal amount of answers on StackOverflow suggest restarting VS.) Need to test you application on a device? Suddenly there are no emulators installed on your PC. I was constantly reminded about the approaching deadline with emails and an almost flashing notification in Google Play Developer Console. The deadline came and went and on the 9th of March I was still able to log on, surprisingly, despite the threat of my account being closed on the 8th if no update is pushed. “Cool” I thought. I still had time. I eventually got to a working build that day and pushed an update that night.
Well, I thought wrong. On the 10th I received an email about my account having been suspended and informing me that by Google’s terms the only way I could publish apps was to create a new account. Dang it, 25 USD wasted.
iOS
Things were not much different with the iOS part of the app. I don’t think I’ve ever said this, but VS does actually have a good(-ish) feature. As iOS applications can only be compiled on a Mac, you can actually pair your VS on Windows to a Mac, which lets VS compile your app on the Mac and brings the outputs back to Windows. There’s also the feature of streaming the image from an iPhone simulators running on the Mac back to Windows. But don’t get your hopes up, as the Win -> Mac connection works about 50% of the time. Other times it’s either stuck on a connection loop or straight up erroring that could only be solved by restarting the Mac, restarting your VS, and praying to whichever benevolent being you happen to recognize.
The aftermath
I now have two Docker containers for both of the services. I have a build pipeline for the services, and in addition for the Android app. I have a deployment system in place utilizing render.com (not an affiliate link). Only the iOS application requires manual uploads.
Epilogue
Every single step of this journey was laborious and tiring. It was a race against time to get reasonable updates out, before the tools lose support and sink to oblivion.
Xamarin reached EOL in May, which means no meaningful updates and is slowing falling behind newer versions of Visual Studio.
By the way, who the crap thought it was a good idea to design a whole dang ecosystem around a single, magic box of an IDE? And why are half of the world’s devs like “yeap - looks fine to me ¯\_(ツ)_/¯
”?
Maybe some key learnings here are the following (without any particular order):
- Keep your stuff updated. It’s much easier to keep your things continuously tidy than to let them rot and then one day take on the Grand Cleanup
- Make sure you know and understand what you’re getting yourself into. Things are never as easy as they seem
- Currency is cool, but sanity is cooler
This whole journey has been pain on every step of the way, and looking back at it, absolutely not worth the currency… I did get to buy cool stuff, though…