IaaS to PaaS: Migrating to Shopify & Webapps


I’ve been quite busy the past few weeks, contributing only minimal structural changes to the WTF project.
Given the expected traffic and cost considerations, I decided to move away from the Azure B1M VM setup I had configured last year.
At my current job, I’ve gained more experience with Azure and realized that Static Web Apps could be a more suitable alternative to self-hosted VMs and scaling.

Comparison Old vs. New

I also decided it would be smarter to integrate the shop via Shopify into my regular website hosted on GitHub Pages, which is also static, replacing WooCommerce and eliminating the WordPress overhead. This transition posed some challenges, as I still need backend server capabilities for things like generating access keys, tracking and activating them, and managing a ban list. I initially considered using Azure Functions as a cost-effective serverless solution.

Previous PHP Code

I believe this new setup is a significant improvement over the old WordPress PHP integration. I also strongly prefer C# over scripting languages, as it gives me a reason to use Visual Studio over Visual Studio Code, which always feels like a more powerful tool.

Shopify C# Hook

I reworked the old PHP logic into Azure Functions and linked it to a Storage Account Table where keys and bans are stored.

Azure Storage Account

Thanks to this change, I was able to retire the PHP code and adjust all the JavaScript that interacted with it. Fortunately, the logic transferred to the C# Function App 1:1 without any issues, and it integrated smoothly with Shopify order manipulation via Meta-Fields.

Shopify Key Generation

I’ve integrated the shop into my homepage and set up a webhook so that whenever a sale occurs, a generated key is attached to the customer’s order. This new setup is not only faster but also cheaper and more secure.

Shopify WebHook

Deploying the Static Web App integrates tightly with GitHub Actions, which was a big plus. I had to make some adjustments to my deployment pipeline’s .yaml script.

With no more need for SFTP access and folder permissions, I restructured parts of the pipeline.
It eventually worked, though I couldn’t use the Free Plan, as the current size of the WTF project exceeds its limits. Still, the Standard Plan comes with extra benefits, and at €9/month, it’s affordable.

Deploying Static WebApps

I find the tight integration with the Microsoft stack, particularly Azure, very appealing.
The Static Web App can be upgraded to Enterprise Edge if needed, which is reassuring, and I believe it will easily handle significant traffic. In the past, with the VMs, I had used Long-Term Reservations to cut costs, but the new setup is even cheaper. I’ve now managed to keep all components under €25/month.

Azure Front Door

Initially, I integrated with Azure Front Door, and while it worked well, I later realized it was too expensive.
So, I implemented the same subdomain forwarding using code and a Public DNS Zone.
I might revisit AFD in the future since it offers robust routing and filtering features, but for now, I’m not willing to pay €30/month for redirects on a low-traffic site.

Azure Public DNS Zone

Overall, this has been a great exercise in exploring various Azure Core functionalities. You can checkout this new setup at the Shop next to this Blog where i also recommend some of my favorite Amazon products.

Buy a Key
comments powered by Disqus