This is Part 1 of a 3 part tutorial which deploys a Ghost blog onto an Azure virtual machine scale set instance, and directs traffic from a domain name (purchased on Google Domains) to the newly created Azure instance.
For this tutorial, we will deploy a single instance Azure virtual machine scale set. If we wish to add more capacity in the future—e.g. when millions of people read this article ;)—we can scale out with a few clicks of a button.
We will deploy an open source blog platform called Ghost onto a single instance of an Azure virtual machine scale set (VMSS). Ghost has the benefit of being extremely low-code. Once configured, you can log in and visually manage all of your posts, tagging for posts, etc.
Best of all, it is a content management system that will allow you to easily collect payment, monitor traffic, and more.
Do not pass go
With robust design tools like Webflow, it is becoming less compelling to need full control over a website's design, deployment, and codebase. At $20 / month / website (or a discounted $16/month if you pay yearly), most individuals should consider building and deploying with Webflow, and not on Azure.
In the world of WYSIWYGs—i.e. "what you see is what you get" no-code website builders—Webflow is amongst the most mature. Before proceeding, consider reviewing some of Chris Do's video tutorials on Webflow to see if it might be an easier option than deploying your own server.
1. When considering solutions, I am primarily considering cost, simplicity, and ease of maintenance for custom blog setup and deployment. I manage 7 different websites, so am also looking for an affordable solution to maintain them. These sites get cumulatively about 1,000 unique visitors per month, but I'm also considering which solutions can handle increased traffic with time.
2. Most websites I manage are simple, static HTML—either custom or customized from a template on ThemeForest.
3. Some websites I manage are blogs on the open source platform Ghost—a no-code (or low-code) platform that we will deploy in this tutorial. This article was deployed with Ghost.
Before continuing, it is important to consider some alternative services that might be better fit for your use case:
1. Azure Container Instance requires that you have Docker experience and package your website(s) up as containers. You publish your container(s) to Azure Container Registry (or Docker Registry). ACI is compelling if you plan to scale your web application later (using AKS or similar). Plans start at about $32 / month when running continuously, and containers have tremendous benefit over a typical virtual machine when it comes to scale. This article also does a great job comparing ACI vs. virtual machines.
2. Azure Storage with Azure CDN allows you to host any static HTML website at extremely affordable rates, but for any server side code—e.g. a simple contact form or a blog content management system—you'll be out of luck. If you are deploying basic HTML code and nothing else, consider this tutorial.
3. Azure Virtual Machine is a basic server that requires manual connection, opening of ports to the Internet, and deployment. You can host static or dynamic web applications on a virtual machine, and pricing starts at about $15 / month. For possibilities of scaling, Microsoft recommends Azure Virtual Machine Scale Sets, which when deployed with one instance, is effectively identical to a virtual machine—but provides you more options for scale.
Setting up an Azure virtual machine scale set
1. Go to portal.azure.com and create or log in with a Live ID or GitHub account.
2. Once logged in, search for "virtual machine scale set" in the search bar:
(New users on Azure will be presented with three options, the first of which will require your credit card information prior to proceeding, though you will start with a $200 free credit and Azure will not automatically charge you. Select 'Start', and once you have accepted the terms and conditions, an Azure "subscription" will be created for you and you will be redirected back to the Azure Portal. For a walkthrough, start with these docs. Come back to this tutorial and search again for "virtual machine scale sets" once you are signed up.)
4. This brings a browse view of your existing scale sets. Select 'Add'
5. At this point, you'll be prompted for some basic information. You'll want to name your scale set and select a Size.
6. For Size, you can sort on cost. For anything less than 2 vCPUs, you'll likely get away with 3-5 users accessing a basic HTML site simultaneously, but will need to increase size should you wish to download large files, packages, or updates on your virtual machine. Select a B2s or higher for minimal disruption. The blogging platform Ghost recommends at least 1GB RAM.
(AWS offers cheaper options using its click-to-deploy option Lightsail, and there are many private hosting providers that will offer considerably cheaper prices. Microsoft does not win on pricing at the time of this post.)
7. Leave the rest of Basics blank, and proceed to Disks, where depending on your needs you can add a single data disk, or consider ephemeral disks in advanced settings which might save you money. Ephemeral disks are not supported on all sizes, but I suggest enabling if the size you chose is supported. Else, you can leave this section blank and add disks after creation as necessary.
8. On the Networking tab, you'll want to edit the default network interface to by pressing the pencil to the right.
9. 'Static IP addresses' are necessary for mapping your domain name to your virtual machine. You should also allow traffic to Port 80 and Port 443 so that your website can be reached at http://yourname.com and https://yourname.com. We'll configure SSL on the server directly later on. Press OK once these changes are made.
(You can also select Port 22—the port used to connect to an instance via SSH. We will enable this port later on for specific IP addresses by adding a security group rule, rather than expose it to the entire Internet).
10. On the Scaling tab, reduce the 'Instance initial count' to 1. This way you start out with a single scale set instance. Should you wish to expand later on, you'll be able to do so.
11. Optionally, you can enable 'Automatic OS upgrades' on the Monitoring tab so that Azure will keep your operating system up to date. You'll also have to enable application health monitoring on the Health tab.
12. No need to configure anything in the 'Advanced' or 'Tags' tabs. Click on 'Review + create', and then 'Create'. You will be prompted to download a private key. Download it and store it in a safe location, as it is how you will access your virtual machine.
Connecting to your virtual machine scale set
13. Click go to resource once your deployment succeeds.
14. Select the Instances menu item and then click on your VMSS instance.
15. Select the 'Networking' menu item, and then 'Add inbound port rule'. We'll be adding a rule for Port 22, which will enable us to connect to our instance.
16. Before adding your inbound port rule, you will need to find your IPv4 address, which you can get by typing 'my IP address' into Google or going to whatismyip.com. Select Source of type 'IP Addresses', paste it into the 'Source IP addresses/CIDR ranges' field, and configure the fields as shown below. Then press 'Add'.
17. Now that you have allowed your network to access your Azure instance, Select the 'Connect' menu item and then the 'SSH' tab.
18. Open up 'Terminal' on a Mac, 'PowerShell' on a PC, or an SSH client of your choice. Recall where you saved your private key,and navigate to that directory. For example, if your private key is called azureuser.pem and is located in your user's Downloads folder, you can type on separate lines:
chmod 400 azureuser.pem
(You might need to right click and run your application as an Administrator, or type ‘sudo’ prior to setting the above file permissions. The chmod command will grant read access to owners-only.)
19. Steps 3 and 4 in the Azure portal should walk you through the next command which combines your username and public IP address for the instance in a final command to execute, ultimately granting you access to your virtual machine:
20. Once you run step 4 (above), you should be successfully connected to your instance!
In the next part, we'll install the underlying components necessary for a Ghost blog, we'll purchase a domain name, we'll purchase and attach a domain name to your instance, and we'll successfully create your blog! Go to Part 2