Home > Blogs > VMware vApp Developer Blog > Monthly Archives: December 2009

Monthly Archives: December 2009

Updates for VMs created with VMware Studio 2.0

Introduction to appliances and updates

VMware Studio builds VMs. As
a part of VM building, VMware Studio 2.0 embeds an in-guest agent also known as
VAMI (Virtual Appliance Management Infrastructure) for Linux VMs, this in-guest
agent allows users to configure system parameters, example: timezone, configure
networking parameters, example: specifying ip addresses, and optionally update
the VM.

A VM with update agent
installed/enabled is considered to be a virtual appliance, and the user of the
appliance can update the appliance with a single-click. The update model
provided by VMware Studio for appliances is a pseudo-firmware model, where a
single update will update all the components (application packages) in the
virtual appliance. The update includes both OS updates, and updates for the application,
this ensures that an update applied to the appliance doesn’t break the
application.

Appliance builder can publish
updates easily using Studio 2.0, updates are published to an update repository as a part of an appliance
build. An update consists of a set of packages that are in native package
formats (i.e. either rpms or debs based on the Linux flavor), as a result
updates can be tracked using existing package managers, and as an appliance
builder updates for non-application packages (OS updates) are easier to find.

Publishing Updates for your Appliance

Updates are published during build

During the creation of a
build profile to build a VM, the appliance author specifies the list of
application packages and OS packages that are to be installed for the
appliance.

When Studio builds the VM, it
can determine all the packages that were installed on the appliance, Studio
uses this information to create an update repository as a part of the build.
The update repository contains a manifest file which lists all the packages
that were installed and a pool of packages. This update repository can then be
used for testing updates and once tested it can be published externally, so
that the appliances in the field can get their updates.

Enabling updates in Studio UI

While creating the build
profile for your appliance you can add the update management service to enable
updates for your appliance, once this service is enabled the build profile
wizard will ask you to enter additional details.

Note: To publish to the same update repository the appliance version needs to be incremented.

a) Repository Access Methods

Repo_settings
The appliance will use either a CD-ROM or will connect to
the specified URL to obtain updates. Later
on, the appliance user can also point to a local (alternate) repository to
obtain updates, this can be configured by the appliance user using VAMI web
console.

b) Repository Server Settings

Repo_server

As a part of the build, Studio will
create an update repository at the specified location using the SCP information
entered. Repository server is usually the staging server (see next section for
more information) for the appliance updates.

c) Repository Export Settings

Repo_export

If you’d like to save a copy of the
update repository in either zip format, or create a CD-ROM based repository that
can be used to update the appliance it can be specified here.

Please refer to Studio
Developer's Guide documentation for more information.

Staging Server

A staging server is usually a
location within the organization. This location is used by Studio to publish
the updates during appliance build. This repository can also be used to test
the update before releasing the update.

Advanced Option – Update scripts

Studio provides ability for
the author of the appliance to specify scripts that can be run before or after
installation of packages (i.e. rpms or debs). A good example of such a script
would be: deletion of a package which already is present in the VM and would
cause conflict with a package in the update.

To edit these scripts, open
the build profile using an XML editor (located at
/opt/vmware/var/lib/build/profiles directory in the Studio VM), and change the
default content of <vadk:PreInstallShellScript> and/or  <vadk:PostInstallShellScript> under
section “vadk:UpdateSection_Type”.

Note: Scripts added will
have to be XML encoded to ensure that it is valid XML.

Updating your Appliance

The appliance can be updated
by the appliance user using either the VAMI Web Console, CLI on the appliance,
or using vSphere Client/vCenter.

Web Console

Using the VAMI web console,
the appliance user can check for updates, update the appliance, schedule
automatic updates, and specify alternate methods of obtaining updates.

If updates are being received
from an external repository then the user simply clicks on the Check button to
query if any updates are present, and if there are any updates present user
clicks on the Install button to update the appliance.

If an update is received as a
CD-ROM ISO file, then the user can attach the ISO file to the CD-ROM device of
the appliance, and run check/install operations as a user would for an external
repository.

CLI

Studio in addition provides
vamicli, a command line tool on the appliance, using which the appliance can be
updated.

Please refer to Studio User’s
Guide
for more information.

Testing Updates

It is recommended that the
author of the appliance, test updates before releasing the update to the
appliance users. In order to test the appliance which is built with an external
repository URL, the author can deploy the appliance inside the organization,
and change the repository URL to the staging server URL or use a CD-ROM based
update using the VAMI web console.

Integration with vCenter for centralized update
management

VMware vCenter Update Manager
a vCenter plugin allows users of appliances (built with VMware Studio) to
update their appliances. The remediation process during which the appliance is
update can either be started manually or as a scheduled task. With Update
Manager multiple appliances can be updated at the same time, when an appliance
boots up VMware Update Manager automatically discovers that the VM has VMware
Studio’s update agent in the VM and allows users to scan and remediate
appliances. 

Users can also define
baselines. Baselines are rules that the administrator of an appliance can
define using Update manager, an example would be: an appliance must always be
at the latest version. Using baselines the administrator can check appliances
for compliance.

More information on how to
use Update Manager can be found in the Studio User’s Guide.

Have fun publishing updates for your appliances!

 


Introduction to the Eclipse plugin in VMware Studio 2.0

There are many steps in developing, building and testing VMs and vApps using VMware Studio.  To make it easier Studio 2.0 adds a new tool to help, the VMware Studio Eclipse plugin. The plugin makes life simpler to many users by adding simple ways to package applications and build the application along with the VM or vApp, all in a single click.  To demonstrate the simplicity, in this blog entry, I will walk through an example of how to develop a simple web-based VM or vApp.

To follow along you will already need to have VMware Studio running and will need to set up an Eclipse development environment.

To get started I downloaded the Eclipse IDE distributed by Aptanu at http://www.aptana.org/ and installed the optional Aptana Aflax feature by going to Help->Install Aptana Features then selecting Ajax Libraries->Aflax and then clicking install.  You can also select the editing tools that you want to use for your app.

I then installed the VMware Studio Eclipse Plugin by following the guide at http://www.vmware.com/support/developer/studio/studio20/eclipse_plugin.html.

Now the normal application development tasks take place, I will just use a sample project that is provided by Aptana as my application.  If the Samples view is not open in your environment, then you can open it by selecting Window->Show View->Other…->Aptana Views->Samples then clicking OK.  Once the view is open, I will find the sample named spirograph, right click on it and select Import Sample as Project...

Once the project is opened I used the Project Explorer view to create a new directory named html and moved all the web files into it.  I then created a VMware Studio Package for Linux (.vsp) in the project and called it mypackage.  To created the vsp file, right-click on the project name and select New->Other…->VMware Studio->VMware Studio Package for Linux .

You can use the Eclipse tools to further test and develop this web app.  Open the index.html file and modify the source or preview the changes.


Once you are satisfied with the app, it is time to package it.  Open the mypackage.vsp file and fill out the package details.  This application requires a httpd server with php on the VM which is provided by the operating system, so add them to the dependencies line.

Now set up the file mapping.  The file tree on the left represents how the files will be laid out in the VM after it is built.  The source location is where the files are on your local machine.  For this application, we will just set the top level html directory, Eclipse will recursively go through all the files and automatically add them at build time.



This application needs the web server to automatically start when the VM is booted.  To make this happen, we edit the post-install script for vsp.



We are almost done!  Now we just need to set up a VM build profile on VMware Studio.  For this blog I chose to use CentOS and keep the default configuration for everything except setting the root password and editing the settings for the provisioning engine.

You can create the profile directly in Eclipse by clicking on VMware Studio Web Console in the VMware Studio Explorer view.  Create the profile then save and close it.

Then when you are ready, click on Build Package… in the vsp editor.  The first time you may be prompted to create a package repository, just accept the default by clicking Yes then OK.  Select the VM profile to add this package to, and enable Automatically start VM build.  Then click on Finish.

A new Eclipse job is started, which monitors the build, and will notify you when it is finished.  You can monitor the status of the build by opening the Progress view.


Once the build is done you can deploy the VM to test it.




That is all that is needed.  Easy!  Your VM is now ready to be shipped.

The Eclipse plugin provides several other feature, like looking at the build logs, and creating default service packages to extend the VAMI framework.

Please leave comments and let us know how this went for you!