Xceptance / XLT-Packer

Packer scripts to build cloud machine images for Xceptance LoadTest.
MIT License
4 stars 0 forks source link

XLT Packer

Build cloud machine images running Xceptance LoadTest with ease using Packer.

Up to now, you can find scripts for the following cloud vendors or platforms:

All XLT images are based on Debian 11 (bullseye), so using another base OS (even another Debian version) may not work.

During image creation, the following main packages will be installed:

Furthermore, the following optimizations will be applied to the underlying OS to allow for high-scale and resource-efficient load testing:

Note that these optimizations are not done for Docker as they would actually have to be applied to the OS of the host machine.

Attention: When running an instance with one of these images later on, the XLT agent controller and also an SSH server (except Docker) are started automatically. Ensure that the following ports are opened in the firewall settings of your instance:

Please consult the documentation of your cloud vendor for details on how to do that.

When you want to log in via SSH, use admin as the user name. This is the default user in Debian.

Preparation

Most of the work (and magic) is done by an open-source tool named Packer built by HashiCorp. So you will need to download and install it first. Note that Packer v1.6.0 or later is required.

Create an Image

Now that you have installed packer, you can use it to build XLT images for any supported cloud vendor listed above. To do so, invoke packer with the build command followed by the JSON file that corresponds to your cloud vendor.

For example, to create a new Amazon EC2 AMI, you would run:

$ <PATH_TO_PACKER>/packer build packer/amazon.json

Configuration

Before you create an image, you need to provide some additional information, such as the authentication data for your cloud vendor.

This can be done in several ways:

  1. Edit the respective JSON file (e.g. packer/digitalOcean.json) and fill out the missing values,
  2. Provide the missing information on the command line by invoking Packer with the -var flag: -var 'variable_name=value', or
  3. Put all your variable definitions in a separate JSON file and pass it to Packer with the -var-file flag: -var-file=myVars.json (recommended).

Imagine you want to create an Amazon EC2 image running XLT 6.2.5 for region eu-central-1. This is done by invoking Packer as follows:

$ <PATH_TO_PACKER>/packer build -var 'region=eu-central-1' -var 'xlt_version=6.2.5' packer/amazon.json

You can also put all variables you need into a file, let's say variables.json:

{
  "region": "eu-central-1",
  "xlt_version": "6.2.5"
}

This file could then be passed to Packer like this:

$ packer build -var-file=variables.json packer/amazon.json

All templates require you to pass/edit the following configuration parameters:

Besides those, there are several additional parameters specific to the cloud vendor of your choice. Please see below for details.

Amazon EC2 Configuration

To create an Amazon Machine Image you'll need to pass:

We also offer a template to build and publish an AMI for multiple regions at once: packer/amazon_allRegions.json. The image will be built in the region specified by the variable region and is then copied to the regions specified by the variable dest_regions.

Please be reminded that AMI names must obey the following rules:

Example variables file:

{
  "region": "eu-central-1",
  "xlt_version": "6.2.5",
  "root_volume_size": "10",
  "launch_permission": "public",
  "aws_access_key": "<YOUR_ACCESS_KEY>",
  "aws_secret_key": "<YOUR_SECRET_KEY>"
}

DigitalOcean Configuration

To create a DigitalOcean image you'll need to pass:

In case you want to build an image for multiple regions at once, you can use the template packer/digitalOcean_allRegions.json.

Example variables file:

{
  "region": "nyc1",
  "xlt_version": "6.2.5",
  "api_token": "<YOUR_API_TOKEN>"
}

Google Compute Engine Configuration

To create a Google Compute Engine image you'll need to pass:

Please be reminded that image version and family must obey the following rules:

Example variables file:

{
  "zone": "us-central1-a",
  "account_file": "<PATH_TO_YOUR_ACCOUNT_JSON_FILE>",
  "project": "<YOUR_PROJECT_ID>",
  "xlt_version": "6.2.5",
  "image_version": "6-2-5",
  "image_family": "6-x"
}

Hetzner Cloud Configuration

To create a Hetzner image you can pass the following variables to packer:

Example variables file:

{
  "location": "nbg1",
  "api_token": "<YOUR_API_TOKEN>",
  "xlt_version": "6.2.5",
  "image_version": "6-2-5",
  "label_xlt_version": "6-x"
}

Docker Configuration

When creating a Docker image you'll need to pass:

Example variables file:

{
  "xlt_version": "6.2.5",
  "image_repository": "<YOUR_ORG>/xlt",
  "image_tags": "6.2.5,greatest",
  "registry_url": "",
  "registry_username": "<YOUR_USER_NAME>",
  "registry_password": "<YOUR_PASSWORD>"
}