Moodle + Office 365: Better together


Deploying the core Azure-based environment



Download 345.09 Kb.
Page6/13
Date29.07.2017
Size345.09 Kb.
#24227
1   2   3   4   5   6   7   8   9   ...   13

17.Deploying the core Azure-based environment


By following the instructions outlined hereafter, you should be able to successfully prepare your Azure-based test lab environment for the Moodle platform. As stated before, the Moodle platform will be based on individual virtual machines (VMs) running the Ubuntu Server 14.10 distribution.

Important note Individual virtual machines (VMs) are needed to separate the services provided on the network and to clearly show the desired functionality. This being said, the suggested configuration is neither designed to reflect best practices nor does it reflect a desired or recommended configuration for a production network. The configuration, including IP addresses and all other configuration parameters, is designed only to work on a separate test lab networking environment.

Any modifications that you make to the configuration details provided in the rest of this document may affect or limit your chances of successfully setting up the Azure-based test environment that will serve as the basis for the Moodle with Office 365 integration. We recommend following this guide as-is first to familiarize yourself with the steps involved, before attempting a deployment on an environment with a different configuration.

Microsoft has successfully built the suggested environment with Azure IaaS, and Ubuntu Server 14.10 virtual machines.

For greatly ease the deployment of a typical Moodle environment, and rather than creating all of the above resources manually from the Microsoft Azure management portal40, we will use a PowerShell script that will perform all of the required actions automatically for.

The script New-MoodleEnvironment.ps1 provided with this paper (file Moodle-Office-365-Setup-Guide-(PS-Scripts).zip, available for download) can be used to deploy your own environment to host Moodle in Microsoft Azure. This sample script is inspired by the scripts available in the Script center41.

To execute the script, connect your PowerShell session to your Azure subscription and execute the following command:


.\New-TestLabEnvironment.ps1 -ServiceName "o2m-contoso" -Location "North Europe" -MoodleServerName "o2m-moodle" -MoodleVMSize "Medium" -MysqlServerName "adfs1" -MysqlVMSize "Medium" -VNetAddressPrefix "10.0.0.0/16" -Subnet1AddressPrefix "10.0.1.0/24" -Subnet2AddressPrefix "10.0.2.0/24"
The main actions taken by the script are described in detail in the following sections.

18.Creating the virtual networks


XML configuration files containing all the network configurations of a subscription are used to create virtual networks in Azure.

The configuration procedure is as follows.



  1. Export the network configuration of the subscription, if virtual networks have already been configured.

  2. If the exported file is empty, create the basic structure of the XML configuration file.

  3. Check that the virtual network to be created does not already exist.

  4. Add the information on the virtual network to the XML configuration file, with the configuration of the sub-networks.

  5. Import the configuration file into the subscription to update the configuration of the network.

The network configuration is exported by executing the following Get-AzureVNetConfig command:
Get-AzureVNetConfig -ExportToFile C:\temp\azure-vnet.xml
The configuration file for the virtual networks required by our Moodle platform is as follows:














10.0.0.0/8







10.0.1.0/24





10.0.2.0/24












The subscription is configured with the complete XML file by executing the following Set-AzureVNetConfig command:
Set-AzureVNetConfig -ConfigurationPath C:\temp\azure-vnet.xml

19.Creating the affinity group


The affinity group is created by executing a simple New-AzureAffinityGroup Power Shell command, as follows:
New-AzureAffinityGroup -Name $AffinityGroupName -Location $Location -Label $AffinityGroupName -ErrorVariable lastError -ErrorAction SilentlyContinue
The variables $AffinityGroupName and $Location must be entered before executing the command.

In the proposed script New-MoodleEnvironment.ps1, these values are automatically generated according to the input parameters of the script.


20.Creating the Cloud service


The Cloud service that will contain our virtual machines for the test lab environment is similarly created by executing a PowerShell command.

It is important to properly attach our Cloud service to the affinity group that we have just created using the AffinityGroup parameter.


New-AzureService -ServiceName $ServiceName -AffinityGroup $AffinityGroupName -ErrorVariable lastError -ErrorAction SilentlyContinue

21.Creating the storage account


The storage account is created by the command New-AzureStorageAccount.

Here again, it is important to specify the affinity group to which our storage account must be linked.


New-AzureStorageAccount -StorageAccountName $StorageAccountName -AffinityGroup $AffinityGroupName

22.Deploying the MySQL virtual machine


For the deployment of the virtual machines, the proposed script New-MoodleEnvironment.ps1 starts by asking for the identification information that will be used for the local administration account of the virtual machines.
$credential = Get-Credential -Message "Please provide the administrator credentials for the virtual machines"

$username = $credential.GetNetworkCredential().username

$password = $credential.GetNetworkCredential().password
Then, a sequence of PowerShell commands:

  1. Create the virtual machine envelope with the command New-AzureVMConfig,

  2. Personalize the virtual machine with the command Add-AzureProvisioningConfig,

  3. Connect the VM to the right sub-network with the command Set-AzureSubnet,

  4. Add an additional 100 GB data disk with the command Add-AzureDataDisk.


$mysqlServerVM = New-AzureVMConfig -Name $MysqlServerName -InstanceSize $MysqlVMSize -ImageName $image.ImageName |

Add-AzureProvisioningConfig -Linux -LinuxUser $username -Password $password |

Set-AzureSubnet -SubnetNames $subnet2Name |

Add-AzureDataDisk -CreateNew -DiskSizeInGB 100 -DiskLabel 'mysqldatadrive' -LUN 0
Finally, the virtual machine is created with the command New-AzureVM, by specifying:

  • The Cloud service in which the machine is deployed,

  • The configuration that we have just created,

  • And the virtual network to which this virtual machine must be connected.


New-AzureVM -ServiceName $ServiceName -VMs $mysqlServerVM -VNetName $VNetName –WaitForBoot



23.Deploying the Moodle virtual machine


The same operations are repeated for the virtual machine that will host the Moodle Web site.
$moodleServerVM = New-AzureVMConfig -Name $MoodleServerName -InstanceSize $MoodleVMSize -ImageName $image.ImageName |

Add-AzureProvisioningConfig -Linux -LinuxUser $username -Password $password |

Set-AzureSubnet -SubnetNames $subnet1Name |

Add-AzureDataDisk -CreateNew -DiskSizeInGB 100 -DiskLabel 'moodledatadrive' -LUN 0

New-AzureVM -ServiceName $ServiceName -VMs $moodleServerVM -VNetName $VNetName -WaitForBoot

24.Creating the HTTP (80) and HTTPS (443) endpoints


Endpoints in Azure allow certain services available on our virtual machines to be exposed directly on the Internet.

Since Moodle is primarily a web site, the HTTP and HTTPS services must be exposed for our Moodle site to be accessible over the Internet.

By default, on Linux machines, Azure creates an endpoint to expose the SSH services on the Internet. This provides access to the Linux environments hosted in Azure, without having to install a VPN infrastructure with Azure, by passing directly over the public IP of the Cloud service.

Perform the following sequence of actions to create the endpoints on a virtual machine:



  1. Retrieve the required virtual machine by executing the command Get-AzureVM.

  2. Add the endpoint with the command Add-AzureEndpoint.

  3. Update the virtual machine with the command Update-AzureVM.

In the proposed script New-MoodleEnvironment.ps1, all of these actions are performed by the following command block:
Get-AzureVM -ServiceName $ServiceName -Name $MoodleServerName |

Add-AzureEndpoint -Name "HttpsIn" -Protocol "tcp" -PublicPort 443 -LocalPort 443 -LBSetName "MoodleWebFarm" -ProbePort 80 -ProbeProtocol "http" -ProbePath "/" |

Update-AzureVM
Once all these actions have been completed, our Azure environment and our virtual machines are ready to install Moodle and the MySQL database.


Download 345.09 Kb.

Share with your friends:
1   2   3   4   5   6   7   8   9   ...   13




The database is protected by copyright ©ininet.org 2024
send message

    Main page