WordPress on OpenStack: Murano App vs Glance Image
What we're looking at here is the difference in working with Murano apps versus Glance images for the developers who create those apps and images for end users, but rather than actually create a new app, we're going to use WordPress as an example. Why WordPress? Because, as a complete content management system (as opposed to just a blogging platform) it's used by many top brands, including The New York Times, CNN, Forbes, Reuters, General Motors, UPS, eBay, SONY, GigaOm, TechCrunch, Samsung, and Mashable. In fact, W3Techs reports that 58.7% of websites, whose content management system they know, use WordPress. That includes large companies who can use OpenStack to easily scale WordPress, and small bloggers who can use the Community App Catalog to easily install WordPress in the first place.
In future articles in this series, we'll go into the details of creating Murano applications and Glance images for use with the Community App Catalog, but for now we're just going to look at the two processes from a high level so you know which you'd rather pursue.
(In some cases you might not have a choice as to which method to use. For example, if your application needs to be deployable without Murano, then you will need to use a Glance image. On the other hand, if your application will need more than one VM, it will generally be more convenient to use a Murano App, particularly if you need to run some other workflow-like task to complete application setup.)
Building a Murano applicationBuilding a Murano Application basically consists of assembling resources and configuration files into a specially constructed *.zip file. You can find the project's official wiki page here, but before we get into the details, let's just look at a few terms:
Murano package: A zip archive. It must contain:
- manifest.yaml file: the entry point of application.
- Classes folder: contains MuranoPL class definitions.
- Resources folder (optional): contains execution plan templates and the scripts folder with all the files required for application deployment.
- UI folder: contains the dynamic UI yaml definitions.
- logo.png file: an image file associated with your application. This image is displayed in Murano as part of the application description.
- images.lst file (optional): a list of images required by an application.
StepsIn a future article, we'll explain in detail how to create a Murano Application, but the basic steps are:
- Create the application classes and specify the workflow MuranoPL, then place both in the Classes folder.
MuranoPL is a special programming language used by Murano to deploy applications. The language is represented by easily readable YAML and YAQL languages, and is executed on a controller node.
- Create execution plan templates with scripts and place them in the Resources folder.
An execution plan is a set of special constructions (represented by YAML and bash scripts) used by the murano-agent running on the virtual machine (as opposed to the workflow, which runs on the controller) to execute actions implemented in application classes. The plan may include parts written in different programming languages -- for example, some parts of the plan may be shell scripts, others written in puppet, and so on. The simplest example of an execution plan would be a single shell script.
- Create the UI definition and place it in the UI folder.
The UI definition is a YAML file describing set of parameters required by applications. Defining the UI enables Murano to request those parameters in the dashboard user interface.
- Create the image.lst file.
The image.lst file specifies the images required by the application.
- Create or choose and add a logo to your project.
Murano is a very UI-oriented service; having some sort of image as a logo helps users identify your packages.
- Create the manifest.yaml file.
The manifest.yaml file describes the metadata of the application to Murano.
- Create a zip file of the entire file structure.
The zip file is what you will import into Murano.
DocumentationMurano is a relatively young project, but the documentation provides complete information about the steps for composing an application, including numerous examples. It's enough to quickly learn how to create a Murano app using a simple application such as ApacheHttpServer.
Time requiredDevelopment time for a Murano application is directly related to the complexity of the application's functionality and the complexity of the scripts needed to configure applications on the virtual machine. For example, if the application just installs a package on the VM using apt-get install, putting it together can take just a few minutes, whereas an application that installs multiple applications and links them together can take significantly longer to develop and test.
TroubleshootingBy default, Murano sends logs to stdout, but it can be configured to save logging information to specific files to ease troubleshooting.
Building a Glance imagePerhaps the most familiar way of creating an application is simply to create a Glance image, such as this one.
- Install the latest diskimage-builder utility.
Diskimage-builder is a special utility to build cloud-ready images with the required software configuration. You can install it using python-pip:
sudo pip install diskimage-builder
- Write (or download) an element that installs the WordPress and related software.
An element is a simple Shell script that simply executes Bash commands. To make things simple, you can get the required element for WordPress from my Git repository:
git clone https://github.com/velovec/UsefullElements elements
- Run the disk-image-create utility from the diskimage-builder package.
Execute the command
disk-image-create -t qcow2 -o wordpress vm ubuntu wordpress
where ELEMENTS_PATH is an environment variable that points to the folder containing our element. The -t option defines the format for the newly created image; qcow2 is the most common. The -o option defines the name of our image. The last three parameters describe which elements should be used: vm and ubuntu are internal elements describing the image type and operating system, and the last one, wordpress in this case, our element from the second step.
DocumentationThe Documentation for creating an image is good enough, but describes methods less efficient than we're looking at here.
Time requiredDevelopment time depends on your shell scripting skills and required functionality. In most cases, creating the image will take something more than the minimum of 30-40 minutes. Also, the process of actually building images takes at least 10 minutes, and depends on Internet bandwidth and the number of required packages.
TroubleshootingInformation required for image troubleshooting can be found in the disk-image-create log. In some other cases, you can also get useful information from the cloud-init logs from a VM running the final image.
How to use a Murano App or Glance Image from the Community App CatalogNow that we've created these apps, what's involved in actually using them? Once they're uploaded to the Community App Catalog (which we'll discuss in a later article) the user can import them into his or her own environment and run them based on the type of application.
Using Murano Apps from the Community App CatalogInstalling a Murano App from the Community App Catalog is pretty straightforward:
- Copy the name of the app
- Open your Horizon dashboard
- Navigate to Murano -> Manage -> Package Definitions
- Click Import Package
- Choose Repository as the package source and paste the name of the package in the respective field. (This enables Murano to also install any dependencies required by the app, such as the Apache murano app and the MySQL murano app. This way you have all the building blocks to compose your Murano Wordpress Environment.
- In your Horizon dashboard, navigate to Murano -> Application Catalog -> Environments
- Create a new Environment
- Drag the WordPress app to the new environment
- Follow the instructions in the dialog window. You will be asked to configure WordPress, Apache and MySQL parameters along the way.
Using Glance images from the Community App CatalogInstalling a Glance image from the Community App Catalog is even more straightforward:
- Copy the URL of the image you want to import
- Open your Horizon dashboard and navigate to Project -> Compute -> Images
- Click Create Image and paste the url into the «Image Location» field. Glance will download the image for you.
- Go to the image list page (if you're not still there from adding the image)
- Choose the Launch action for your image to bring up a standard glance “Launch Instance” dialog, which enables you to set standard parameters such as flavor, and networking.
ConclusionLet's overview what we've learned.
|Murano App||Glance Image|
|Number of steps to create||7||3|
|Time to develop||less than an hour||30 - 60 mins|
|Completeness of documentation||Docs provide full information about steps for composing an app, and contain numerous examples.||Docs are adequate, but somewhat incomplete and outdated|
And then, of course, there is the matter of complexity. A Murano App can span several VMs; a Glance image, by definition, is limited to one.
So as always, the answer to "which is better" is "it depends".
Next time we'll go into more detail on how to create a Murano app and deploy it to the App Catalog.