Hosting Apache Tomcat on a Linux VM on Microsoft Azure

Powered By Apache Tomcat LogoApache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed under the Java Community Process while Tomcat is developed at the Apache Software Foundation (ASF). Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. It is an ideal candidate to run on Microsoft Azure. In this tutorial, we will demonstrate how you can quickly deploy a pre-baked Apache Tomcat Virtual Machine Image from VM Depot from your own Microsoft Azure account.

If you do not already have an active Microsoft Azure subscription, you can sign up for a free trial in order to follow along with this tutorial. If you have an MSDN subscription then you are probably aware that you have Azure credits included. If you have not activated those credits yet you can do so now, see Microsoft Azure Special Pricing: MSDN, MPN, and Bizspark Benefits. To learn more about Azure, see What is Azure?

There are many ways to deploy a Virtual Machine from VM Depot to Microsoft Azure. In this tutorial, we will focus on a feature called VM Depot Easy Deploy. This method is available within VM Depot and is designed for those new to VM Depot and Microsoft Azure. If your knowledge of Azure is more sophisticated, you could also opt to run through this process using the Cross Platform Command Line tools or the Microsoft Azure Portal.

First time Set-Up

The first time you deploy an image using Easy Deploy, it you will need to provide your Azure subscription details. This information can be readily obtained from Azure once your subscription has been activated., as your browser will cache this information locally. This local caching of your Azure publish settings means that while your first use of the Easy Deploy feature is simple, subsequent uses will be even easier. Note, however, that because the details are stored in your browser you will need to reconfigure them on each browser you use. If, for any reason, the authentication information contained within these settings are invalidated, the Easy Deploy web tool will prompt you to update them. You can also remove these settings from your browser cache, should you wish to do so.

The Deployment Process

For this exercise, we have elected to use a Tomcat v7 Virtual Machine image provided by Bitnami. Many other Tomcat are images available on VM Depot - including v8. This latest version is still in development but may be useful for testing. The deployment process for any Virtual Machine image is the same regardless of which one you select.

Once you have identified a VM Depot image that you would like to deploy, click "Create Virtual Machine" (see highlight in the image below).

Screenshot of VM Depot showing Apache Tomcat images

As discussed above, the first time you use the Easy Deploy feature, you will need to provide your Azure Subscription profile settings. Simply drag and drop the appropriate file (download it from Azure) onto this page (or click to browse to the file). A link to download your publish settings file will also be conveniently provided on this page should you need to re-download this information at any point in the future.

If you have previously provided your publish settings file, you will bypass this step and be directed straight to the deployment configuration page:

Upload Publish Settings

On the deployment configuration page, you will be required to provide a password for the default "azureuser" account and accept the terms of use. On this form you can also see (and change) values for the DNS name and username. You will also see a default VM name (the name used in Azure to manage the image), VM Size and deployment region, if you want to change these simply click them to expand the advanced options form.

An important item to call to your attention: the username specified here is not the username for the Tomcat application; it is the default user on the Linux VM. This means that you will use this username to login to the Linux box. The image description on VM Depot contains the Tomcat username and password will be contained within the image description on VM Depot; in this case, these will be “manager” and “Bitnami”, respectively.

You may also click on the “Advanced” link to access additional configuration options. More information about these options is detailed in the next section of this tutorial.

Easy Deploy Configuration

After you have read and accepted the terms and conditions, you should click “Create Virtual Machine” to schedule the creation of your VM image. Doing so will generate the following confirmation page, which also includes status information. Once you arrive at this page, you have completed all the deployment steps. An email will notify you when your VM is ready to be used (usually within 15-25 minutes).

Easy Deploy Status

For the curious, the confirmation page shows real-time status updates pertaining to your deployment. You may return to this page at any time by selecting "VM Deploy Status" within the "My Account" sidebar menu on the left side of the screen. This page will tell you the current status of your VM both during and after deployment. That is this page will later be used to review which VMs are running.

 

Advanced Configuration Options

As noted above, you may also take advantage of several advanced options. You can change the default settings before launching your image by clicking on the “Advanced” link on the configuration page. The screenshot below illustrates the available options:

Easy Deploy Advanced Configruation Form

Most users will only have one subscription associated with their account. If you have a Microsoft account with multiple Azure subscriptions enabled, each will be listed within the dropdown at the bottom of this section. It is advisable that you first make changes to this, if you plan to do, as many of the other options depend on the selection here. If you wish to use a subscription not listed, then select the “Use another Azure Profile” link to remove the current settings from the cache and provide a new Azure Publish Settings file, as described above.

The “VM Name” field defines the name assigned to the VM in Azure. The portal and other management tools use this value to identify the VM to the user. The default names provided may not be very descriptive, but they are often sufficient for a small number of VMs. For any who wish to do so, you may configure VM name here.

“VM Size” refers to the size of the Virtual Machine you create, in terms of processor, memory, disk size and maximum IOPS. Descriptions of the codes used within this field are available in the Azure documentation on Virtual Machine Sizes for Azure.

The “Region” field specifies which data-center you specify for deployment. The dropdown contains all valid regions for your deployment.

The default “Storage Account” is the first attached to your subscription. If you prefer to use a different account, simply select it from the options provided within the dropdown menu. Alternatively, you may create a new storage account using the text box provided.

Lastly, VM Depot Easy Deploy will automatically open any “Endpoints” defined by the publisher as being necessary. In the majority of cases, this setting will remain unchanged. If you have specific requirements, you have the option to add or remove endpoints, as needed.

Conclusion

Using the VM Depot Easy Deploy feature will enable you to deploy a community provided Virtual Machine image, such as Apache Tomcat v7, in minutes. Once your virtual machine has started, you can then login to the Tomcat manager application in order to publish your application on the server. You will also be able to use an SSH client to connect to the virtual machine and manage it from there.

For information on working with Apache Tomcat, see the Tomcat documentation pages.