Jump to: navigation, search

Heat/Prebuilding-Images-From-Templates

< Heat
Revision as of 23:30, 17 February 2013 by Ryan Lane (talk | contribs) (Text replace - "__NOTOC__" to "")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Background

Launching complex stack based on JEOS images can take a long time. Whenever we launch a new instance, all the necessary packages must be installed and set up before the instance can be configured and ready.

We can do a lot of that work only once -- at image creation -- and then use the init scripts for configuration that can't be done offline.

Proposal

Write a new tool that will take a Heat template, parse it and build images that have all the required packages installed. These images are then registered with Glance.

Finally, it will produce a new template that will reference these images instead of the generic JEOS ones.

When the user creates a stack based on such a template, only the operations that can't be done during the image creation will be executed during the instance launch.

Example:

    heat-prebuild WordPress_With_RDS.template out.template \
                  --parameters "InstanceType=m1.xlarge;LinuxDistribution=F17" \


Depending on how the template is specified, some of the parameters passed to `heat create` may need to be available to `heat-prebuild` as well.

We need to know which operating systems do we build the images from. In other words, for every `AWS::EC2::Instance` resource we need to have the value of the `ImageId` property to find out what to build.

That property may either be hard-coded in the template or it can be passed via parameters, possibly with some pre-processing (as is the case with the WordPress_with_RDS template).

If `heat-prebuild` does not have enough information to build all the images, it will fail without building any of them. The alternative (building all the OS combinations) would be too costly and not always possible anyway.

Parameters that are not related to the image type may be ommited.