Deploying Bitnami Stacks on Windows Azure In this whitepaper we walk you through the process of setting up a Bitnami cloud image stack on Windows Azure and look at the advantages over other deployment methods. B itnami packages popular open source software, such as web applications and development stacks, as installers, virtual machines and cloud images. You could, for example, download, install and deploy the Bitnami WordPress installer, which would include all servers (for databases and web), other dependent packages, and preconfigured configuration files, and install everything in one fell swoop. This avoids both long and cumbersome installation processes and error-prone configurations. Figure 1: Bitnami offers server software stacks that need little Figure 2: Windows Azure is a cloud platform that allows users to easily build and deploy virtual machines. or no configuration. Azure is a cloud service created by Microsoft that allows users to, among many other things, easily build and deploy virtual machines ("cloud images"). These can then be used to host applications including web appliances. Azure simplifies the hosting and configuration of virtual machines and offers a professional hosting service and assuring a high SLA (Service Level Agreement) of 99.95%. It stands to reason, therefore, that by combining Bitnami stacks with Microsoft's Azure cloud service, the task of installing, configuring and deploying server applications should be easy, fast and afford an enterprise level of high availability with minimal hassle. With this in mind, Bitnami has created a range of Images for each of their applications and made them available through Azure's Virtual Machine Depot. -1-
In the following pages we look at how you would deploy a Bitnami image stack in Azure and the advantages over other deployment methods, while also examining the caveats. We will use as an example the Bitnami WordPress cloud image. Pre-Installation Before being able to set up your Azure account, Microsoft requires you have a Microsoft Account [3] (formerly known as Windows Live ID). You may use an existing account you created for other Microsoft services, such as Outlook.com, SkyDrive or Windows Phone; or register a new one (with a different email address) just for this service. Figure 3: You are required to have a Microsoft Account before accessing Windows Azure. Figure 4: Sign into your Windows Azure account using your Microsoft Account credentials. The process of setting up a Microsoft account is mostly straightforward: You fill in some personal information, provide an email address and set a password. Microsoft will then send you an email containing a link to click on to confirm your registration. To access Microsoft services, including Azure, from then on, you use the email address and the password you provided when creating your account. Setting up an Azure account is equally straightforward. Log in using your Microsoft account username/email address and password, fill in a form, receive a code on your cellphone, fill in your payment information, and click the Sign up button at the bottom of the screen to activate the account. In the next screen, click the big blue Portal button in the upper right-hand corner to access your dashboard. -2-
Figure 5: Much of the Azure registration form is filled in for you from your Microsoft account. Figure 6: After receiving an SMS code, you are required to provide your payment information. Figure 7: Click on the big blue Portal button in the upper righthand corner to access the Azure dashboard. Figure 8: Azure gives you a resource selection bar down the left-hand side of the screen; an action/status bar along the bottom; and two menus, one for internationalization and another for your account setting, in the top right-hand corner. The central pane is reserved for the resource display and workspace area. Installing a Bitnami image For this example, we will install the Bitnami WordPress [4] image. This process is carried out in two steps, both from within the Azure environment: First you must create the image of the virtual machine using the Bitnami package, and then you create and run a virtual machine using the image. To create the image, first pick VIRTUAL MACHINES from the vertical menu on the left and chose the IMAGES tab in the central viewport. Click BROWSE VM DEPOT. -3-
Figure 9: Choose VIRTUAL MACHINES from the resource selection bar on the left. Figure 10: Pick the IMAGES tab in the resource area and then BROWSE VM DEPOT. A window to the VM Depot wizard will open. Scroll down until you see the Bitnami WordPress images (recognizable for being enclosed in a round-cornered hexagon). TIP: You may want to click UBUNTU in the filter list on the left to narrow down your options. Click on the version you want (for example, we chose WordPress 3.8.1-1 on Ubuntu 12.10). Click on the right pointing arrow in the bottom right-hand corner of the wizard window to move onto the next step of the wizard. Choose the geographical region where you would like to host your machine. If you have chosen a geographical region where you haven't hosted any prior machines yet (or this is your first machine), you can set the storage account name or choose one from the accounts you have already set up. -4-
Figure 11: Choose the Bitnami WordPress package that you need in the first screen of the wizard. Figure 12: Choose the geographical region where you want to host your site and give the new storage account a name. Click the tick in the bottom right hand corner of the wizard window to finish the process. Azure will start creating your image. Note this may take a while. When the process has finished, click REGISTER in the action bar at the bottom of the screen. Figure 13: Azure then creates the image you will later install in your virtual machine. Figure 14: Once generated, you will have to register the image before using it. -5-
Figure 15: You will be asked to give the image a name, which, in turn, generates a virtual hard disk URL. Figure 16: After the registration process has completed, the image becomes available to be used in a virtual machine. Recap: Creating the Bitnami Stack image 1. Click VIRTUAL MACHINES in the vertical menu bar on the left. 2. Click IMAGES in the central workspace. 3. Click BROWSE VM DEPOT in the central workspace. 4. Select a Bitnami WordPress image from the list. 5. Click on the right pointing arrow in the bottom right-hand corner of window. 6. Fill in the form (Image Region, Storage Account, New Storage Account Name). 7. Click on the tick in the bottom righthand corner of window. 8. Click on REGISTER in the action bar at the bottom of the screen. Setting up your Virtual Machine Now the image has been created, you can deploy it in virtual machine. Once you have registered your image, click +NEW in the action bar at the bottom of the screen, and pick COMPUTE > VIRTUAL MACHINE > FROM GALLERY. This will open the Choose an Image wizard. Pick MY IMAGES from the menu on the left and then the WordPress image you just created. Click the arrow pointing right in the bottom right-hand corner of the wizard window to go onto the next screen. -6-
Figure 17: Pick COMPUTE > VIRTUAL MACHINE > FROM GALLERY to create a virtual machine based on your image. Provide a name for the machine, set the number of cores and the memory size, a username and password and click on the arrow pointing right in the bottom right-hand corner of the wizard window. On the next page, set the DNS name, the Region/Affinity Group (see the What are Affinity Groups? box for an explanation of what this does) and whether you want the machine to belong to an Availability Set (see the What areavailability Sets? box on page 8 for an explanation of what this does). Click the arrow pointing right in the bottom right-hand corner of the wizard window. Figure 18: Pick your image from the MY IMAGES section. What are Affinity Groups? Affinity groups allow you to group your Windows Azure services to optimize performance. All services within an affinity group will be located in the same data center. An affinity group is also required in order to create a virtual network. Access with SSH key You may also configure access to your machine using an SSH key. This is optional, but more secure than a username/password combo. In the Virtual Machine Configuration, apart from SSH, you will want to add HTTP and HTTPS to the endpoints table so your WordPress blog is accessible over the web. Click the tick in the bottom right hand corner of the wizard window and Azure will create and boot the machine. -7-
Figure 19: Give your virtual machine a name, chose the number of cores and memory size, pick a username and a password. Figure 20: Set the cloud service and the regional affinity group and availability set. Figure 21: Set the endpoints (ports) you need on your virtual machine. Figure 22: After closing the wizard, the image is installed and your virtual machine boots. Recap: Creating the Virtual Machine 1. Click +NEW in the action bar at the bottom of the screen. 2. Choose COMPUTE > VIRTUAL MACHINE > FROM GALLERY from the action bar at the bottom of the screen. 3. Click MY IMAGES from the menu on the left. 4. Click your WordPress image. 5. Click the arrow pointing right in the bottom right-hand corner of the wizard 6. 7. 8. 9. window. Fill in the machine name, architecture, username, password fields. Click the arrow pointing right in the bottom right-hand corner of the wizard window. Add HTTP and HTTPS endpoints for applications with web interfaces. Click the tick in the bottom right-hand corner of the wizard window. -8-
Accessing Your Application Unless you have configured more than the default endpoint, the only way by default of accessing your virtual machine is via SSH. On Unix-like systems (such as Linux or MacOS X) you can achieve this by opening a terminal and typing $ ssh yourusername@dnsname at the prompt, where yourusername is the user name you set on step 6 in Creating the Virtual Machine and DNSname is the name shown in the DNS NAME column of the VIRTUAL MACHINE INSTANCES tab. The system will then require the password you set on step 6 in Creating the Virtual Machine. You will then see something like what is shown Figure 23. From a Windows machine you will need an application like PuTTY [7], a free implementation of the SSH and TELNET protocols for Windows. Figure 23: You can access your machine through SSH from a Linux or MacOS X terminal, or using PuTTY on Windows. Figure 24: The so-called endpoints are the open ports on your machine. In this case, port 22 (SSH) and 80 (HTTP) are both open. If your server has web interface, you should open an HTTP and HTTPS endpoint when you are ready to go into production. You can do this by clicking VIRTUAL MACHINES in the vertical menu bar on the left, choosing VIRTUAL MACHINE INSTANCES in the central resource area and then clicking on the name of the virtual machine you want to add an endpoint to. What are Availability Sets? Availability Sets allow you to increase the availability of your service. Michael Washam notes [6] that "creating two or more machines that serve the same purpose and grouping them into the same availability set, guarantees that your VMs are spread across multiple racks in the Windows Azure Data Centers. This means redundant power supply, switches and servers." Also it will avoid the Azure Fabric Controller from taking down all your machines simultaneously for, say, host OSs updates. Availability Sets are also used to increase the SLA (Service Level Agreement) up to the 99.95% guaranteed by Windows Azure. -9-
Figure 25: You can access your machine through SSH from a Linux or MacOS X terminal, or using PuTTY on Windows. Figure 26: The so-called endpoints are the open ports on your machine. In this case, port 22 (SSH) and 80 (HTTP) are both open. In the central resource area, choose the ENDPOINT tab and click on ADD in the action bar at the bottom of the screen. In the first screen of the Endpoint Wizard, choose ADD A STAND-ALONE ENDPOINT and click the arrow pointing right in the bottom right-hand corner of the wizard window. In the next screen, choose HTTP from the drop-down list and click the tick button in the bottom right-hand corner of the wizard's window. Figure 27: Start the endpoint wizard by clicking on ADD at the bottom of the screen. Figure 28: Chose the endpoints you need to open from the dropdown list. You can now access your virtual machine via the web visiting DNSname.cloudapp.net, where DNSname is the name shown in the DNS NAME column of the VIRTUAL MACHINE INSTANCES tab. - 10 -
In the case of the Bitnami WordPress application, you will see something like what is shown in Figure 26, the Bitnami introduction page to your site. To see the wordpress site itself, visit DNSname.cloudapp.net/wordpress. To log into your WordPress site for the first time, use user as your username and bitnami as your password. You are advised to change these credentials as soon as possible after deploying your site. Conclusion It is beyond the scope of this paper to examine other ways of installing and deploying WordPress, but for the sake of thoroughness, we have also installed the Bitnami WordPress stack on a standard standalone Linux server and also installed WordPress, from source as it were, on Azure and then also on a standalone server. Bitnami Servers Regardless of whether you are installing a Bitnami app on a virtual machine in the cloud, or on physical server hardware, you will find all Bitnami servers and dependencies in the /opt/bitnami directory and you can manage the servers using ctlscript.sh tool. We must note that, that the time to set up a standalone server apart from including the system installation itself, must include the time spent acquiring and preparing the installation media (i.e., downloading a Linux distribution image and burning it to a DVD) and the time spent consulting documentation for the WordPress pre-installation setup, both of which, we found, were substantial. An experienced Linux sysadmin will have little difficulty with the OS installation and application setup, however the simplicity of the combined Bitnami/Azure setup means that even an inexperienced user can deploy complex combinations of applications with little trouble. It is also worth noting that most of the time spent with the Windows Azure installation is actually spent waiting for the Azure system to carry out automatic configurations of the software, most of which can be left unsupervised. Plus Azure is perfectly capable of carrying out various tasks simultaneously, so if you were to install two instances of WordPress at the same time (say, to increase the guaranteed availability), the installation times for each would, to all practical effects, be halved. All the configuration decisions within the Bitnami/Azure combo are guided, documented, substantially less complex, and more easily rectified than the ones you have to make during an install from scratch. This makes the process much less error-prone. Combined with the other advantages of the Bitnami/Azure combo, such as the high availability guarantee and that you can access a public a web interface immediately, makes for the most convenient way of deploying web appliances of the four methods examined. [1] Bitnami website: https://bitnami.com/ Resources [2] Windows Azure: http://www.windowsazure.com/en-us/ [3] Microsoft Account: https://login.live.com/ [4] WordPress: https://wordpress.org/ [5] WordPress download: https://wordpress.org/download/ [6] "Understanding and Configuring Availability Sets" by Michael Washam: http://michaelwasham.com/windows-azure-powershell-referenceguide/understanding_configuring_availability_sets_powershell/ [7] PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/ - 11 -