Windows Azure Companion for PHP - Source code Study
Once you have download the the WindowsAzureCompanion-Source-Sep2010CTP.zip from the link below it is good to take a look at 5 source code location described in this blog:
https://code.msdn.microsoft.com/azurecompanion/Release/ProjectReleases.aspx?ReleaseId=4956
Here I will show you a 5 source locations which are important to understand the solution architecture. You can make necessary modifications in these areas if you wish and add little extra code to get more from the solution. These 5 sources locations are described as below:
1. Azure Companion Administrator Application:
WorkerRole\WorkerRole.cs
// Start ASP .NET Admin WebSite
private void StartAdminWebSite()
2. Running PHP in Hostable Web Core:
VMManagerService\WindowsAzureVMManager.cs
public static string HWCForPHPProcessName = "HWCForPHP.exe";
VMManagerService\WindowsAzureVMManager.cs
// setting the file name and arguments
hwcServerProcess.StartInfo.FileName = Path.Combine(approot,
WindowsAzureVMManager.HWCForPHPProcessName);
hwcServerProcess.StartInfo.Arguments =
Path.Combine(configPath, "php_applicationHost.config") + " "
+ Path.Combine(configPath, "php_web.config");
hwcServerProcess.Start();
// Start the asynchronous read of the output stream.
hwcServerProcess.BeginOutputReadLine();
Trace.TraceInformation("Started Hosted Web Core Server for PHP Applications
on port {0}", endpoint.Port.ToString());
3. Performance Counter for RAM utilization:
WorkerRole\WorkerRole.cs
// Add performance counter monitoring
cfg.PerformanceCounters.DataSources.Add(
new PerformanceCounterConfiguration()
{
CounterSpecifier = @"\Processor(_Total)\% Processor Time",
SampleRate = timeSpan
});
cfg.PerformanceCounters.DataSources.Add(
new PerformanceCounterConfiguration()
{
CounterSpecifier = @"\Memory\Available Mbytes",
SampleRate = timeSpan
});
cfg.PerformanceCounters.ScheduledTransferPeriod = timeSpan;
4. Cloud Drive is created and backup.vhd is mounted:
VMManagerService\WindowsAzureVMManager.cs
// Get Windows Azure Drive container and blob names from service configuration file
string xdriveContainerName = RoleEnvironment.GetConfigurationSettingValue("PHPApplicationsBackupContainerName");
string xdriveBlobName = RoleEnvironment.GetConfigurationSettingValue("XDrivePageBlobName");
5. Modifying Cloud Drive name, size etc:
ServiceConfiguration.cscfg
<!-- Settings for Windows Azure Drive used for durability -->
<Setting name="PHPApplicationsBackupContainerName" value="phpapps" />
<Setting name="InstallationStatusConfigFileBlob" value="status.xml" />
<Setting name="ProgressInformationFileBlob" value="progress.xml" />
<Setting name="XDrivePageBlobName" value="backup.vhd" />
<Setting name="XDriveSizeInMB" value="2000" />