This guide will walk you through the initial Azure Portal details needed to get your Linux VM created so that you can then follow the regular cloud install guide that is web host agnostic.
1) Create a Resource Group
Before even creating the VM I like to create a Resource Group. This is where everything related to your VM will live like your storage disks, networking, security groups, etc. To create a Resource Group click the green plus sign and select Resource Group, then fill our the “Resource group name” field, select your “Subscription”, and your “Resource group location”, then press “Create”.
2) Create A Linux VM
We are going to create an Ubuntu 16.04 LTS VM for this guide, to do that click the green plus sign again and then search for “Ubuntu Server 16.04 LTS” and it should show up as one of the available VM’s.
Select it, and then make sure the deployment model is on “Resource Manager” and then click “Create”
3) Configure basic settings
Now give your VM a name like “Discourse”, fill out the linux username, and upload your ssh public key. Then select the existing Resource Group we already created, select a Location, and then press OK.
4) Choose virtual machine size
Unless you want to pay for a machine with 128 cores, the first thing you should do is adjust the slider on the top right so that our available vm’s are filtered by only 1 or 2 vCPUs. There that’s better.
For the bare minimum you will need to select the “B1ms” option with 2GB of ram. The “B1s” even though it says it has 1GB you only get like 800MB of ram at the OS level there just isn’t enough left over to really run Discourse well. The “B1ms” will cost $17.11 per month.
5) Configure optional features
Choose the default 30GB OS disk size. Which should be more than enough to host a Discourse site especially if you are going to use the Azure Blob Storage Plugin right?
All the other defaults are also fine. I did turn off “Boot diagnostics” monitoring, but it is totally fine to leave on.
Select “OK”. Now verify everything is good on the Summary page and then let’s get this vm created.
6) Adjust networking settings
Once you VM has been created (which can take a few minutes), select it, then click on the “Networking” section:
and then select “Add inbound”. Right now your VM can only be access through port 22 for ssh, but we need it to be web accessible via ports 80 and 443.
Change the “Destination port ranges” to “80,443”. Then fix the “Name” field to “Port_80_443”. Everything else can stay on the default settings. Then click “Add”.
7) SSH into the VM
In the azure portal on the main page for the VM we just created you should see the IP address list. Open your terminal and ssh into the VM with the username we specified in step 3 of this guide.
8) Setting up Swap
Each azure VM comes with a temporary disk separate from your OS disk and is usually mounted at
/dev/sdb1. You want to make sure you swap is setup on this temporary disk and not your OS disk because:
This temporary storage drive is present on the physical machine which is hosting your VM and hence can have higher IOPS and lower latency when compared to the persistent storage like data disk. - Understanding the temporary drive on Azure Virtual Machines
/etc/waagent.conf file and update the following lines:
ResourceDisk.Format=y ResourceDisk.EnableSwap=y ResourceDisk.SwapSizeMB=2048
Note: If you already have a swap setup on the OS drive (maybe because
./discourse-setup configured it for you) you can turn it off by commenting out the
/swapfile line in
Then restart your vm with
shutdown -r now.
To verify you swap you can type
swapon --show and you should see something like:
root@azure:~# swapon --show NAME TYPE SIZE USED PRIO /mnt/swapfile file 2G 780K -1
Notice that the swap file is located inside of
/mnt this is good because this is our temporary drive.
You can also type
free -h and see something like:
root@azure:~# free -h total used free shared buff/cache available Mem: 1.9G 1.2G 118M 26M 521M 304M Swap: 2.0G 780K 2.0G
The swap should have something in the total column which means it has been setup.
This is where we part ways because we now have all the Azure specific bits out of the way and you can continue setting up Discourse by following our Official Cloud Install Guide. Once you are done with that guide be sure to setup the Azure Blob Storage Plugin.