SlipStream™ Tutorial

1.0-SNAPSHOT

SixSq Sàrl

This work is licensed under the Creative Commons Attribution-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

2012-01-25


Table of Contents

1. Getting Started
1. Introduction
2. Tutorial Solutions
3. Key Concepts
4. User Setup
2. Hello World: Simple Client/Server Tutorial
1. Goal
2. Create a New Project
3. Apache Server Machine Image Module
3.1. Image Reference
3.2. Instance Parameters
3.3. Deployment
4. Test Suite Client Image Module
4.1. Image Reference
4.2. Instance parameters
4.3. Deployment
5. Deployment Module to Run it All
6. Execute Distributed Test
3. Performance Example using Apache
1. Goal
2. Create new Project
3. Create a new Deployment Module
4. Execute Distributed Test
5. Increasing the Load on the Server
A. Troubleshooting
1. Debugging a failing machine image creation
2. Debugging a failing deployment
B. Resources
1. Amazon Services
2. Apache2 Server
3. Firefox
4. Ubuntu and Debian AMIs
5. CentOS 5

Chapter 1. Getting Started

1. Introduction

SlipStream™, by SixSq, is a framework for the automatic deployment and testing of n-tier and distributed software systems. It makes extensive use of cloud computing technologies to provide dynamic near-production environments for realistic runtime creation of systems, permitting software stakeholders to assert their ability to release the software into production on a continuous basis. SlipStream™ relies on virtualization for deploying machines and uses a cloud computing back-end to manage the life-cycle of virtual images. SlipStream™ currently can use two cloud backends: StratusLab and Amazon EC2. SlipStream will continue to support more cloud back-ends, as needed and requested.

SlipStream™ is available as public services for both StratusLab and Amazon EC2. Before you can successfully use these services, you will need to have valid accounts with them.

This tutorial document is composed of several tutorials of increasing complexity, designed to get you started on SlipStream™ as fast and simply as possible. The first Simple Client/Server Tutorial uses the Apache2 web server to demonstrate a "hello world" of distributed system tests using SlipStream™. In this first tutorial, we show you how to use existing base images to create a deployment to test a simple client/server pair running on two different virtual machines in the cloud.

Reusing the first tutorial, we then move to a slightly more complex scenario where we show you how with a few button clicks the first tutorial can be turned into a powerful performance system test. This second case deploys several clients in parallel to show how to produce increased load on the web server.

We execute the tutorials in this document daily to make sure that the fundamentals of these tutorials are sound. However, if you experience problems going through these tutorials, you'll find a special appendix to this document with troubleshooting tips. If you think that any of these tutorials are not clear, confusing, missing insights or could simply be made better, please help us improving them by sending your feedback to .

2. Tutorial Solutions

You can find the solutions to the SlipStream™ tutorials on the server in the Public/Tutorials project area. All of the required projects are publicly readable, you therefore only need a standard SlipStream™ account to view them.

3. Key Concepts

Before we start the tutorial, here are a few important SlipStream™ concepts that will come up often. SlipStream™ is accessed via a web application. SixSq runs a public SlipStream™ Service on Amazon EC2 and a SlipStream™ Service on StratusLab. Your organization may run it's own SlipStream™ service; if so, contact your administrator to find the address of the server. If you have your own SlipStream™ instance and you want to use it for this tutorial, please make sure that your instance of SlipStream™ includes the Tutorial SlipStream™ Projects, which ships with the product by default.

Metadata about your images and deployments are organized into projects in SlipStream™. Each project then consists of a number of modules. The modules may be Project, Machine Image or Deployment modules. Here is a short description of these module types:

Project

A container of modules used to provide logical grouping. A project may contain other projects allowing a hierarchical organization for large projects.

Machine image

A module that contains information about machine images, including cloud specific unique identifier and/or recipes to create the machine image. The recipe information consists of a set of packages to install and a script for configuring the machine. Unique identifiers are specific to the corresponding cloud they belong to. This module also includes input/output parameters such that the machine can be synchronized as part of a deployment.

Deployment

A module that describes nodes to which machine images are associated, as well as synchronization interconnections between these.

The web interface allows the parameters for each of these modules to be defined, edited, versioned and saved.

We also have two main workflows in SlipStream™: Image Creation and Deployment. Here is a short explanation of what they are:

Image Creation

Creation of a new machine image at the cloud service level, such that it can be reused in deployments. This means that SlipStream™ instantiates a reference (i.e. already existing) image, from which it will add software and configuration, before saving it as a new image for further reuse.

Deployment Execution (or Run)

Deployment of several machines together, synchronizing their setup such that the software in each machine fires in the right order, automatically.

These terms will be referred to throughout this document.

4. User Setup

SlipStream™ is a secure web application requiring a personal account. To register for an account, fill in the registration form. Make sure you provide a valid email address as it will be used to validate your account. Once you've received the email, hit the confirmation link to activate your account. From that point-on, you are good to go on SlipStream™.

By default, SlipStream™ is configured to use the StratusLab reference cloud service for "cloud" resources. In order to build images and execute deployments, you must have an StratusLab account and you must fill your SlipStream™ profile with your StratusLab username and password. The simplest way to request a StratusLab account is to send an email to the StratusLab support mailing list. Once registered and activated, access the SlipStream™ application of your choice (e.g. SlipStream™ Service on Amazon EC2, SlipStream™ Service on StratusLab) and click on Start or the Start button, or the login link at the top right of the screen. Once logged in, go to you account. Once there, click the Edit button and select the "Properties" tab. Then fill the "StratusLab" or "Amazon" section of the form (see the comments next to the fields for guidance). Save the changes. Now you should be good to go!

Caution

By default, StratusLab and Amazon EC2 users cannot instantiate more than 20 virtual machines at the same time. You can ask StratusLab to increase this limit, but we recommend that you keep this limit until you are more experienced with SlipStream™.

Chapter 2. Hello World: Simple Client/Server Tutorial

1. Goal

The goal of this tutorial is to show you how to build a simple distributed test with a client and a server running on separate machines. We are going to use an Apache server as the server, put some data into it, and then from a separate machine test that the data can be accessed remotely. The end result, or the solution, of this tutorial can be found in SlipStream™ in the public project Public/Tutorials/HelloWorld.

2. Create a New Project

To host the different modules we will create in this tutorial, first create a new top level project. Simply click on the "Start" button on the main page. If you haven't logged-in, you will be asked to do so. You will then be shown the root projects page, which will only list the projects you have read access to. To create a new project, click the "New Project" button. Give this project a unique name. Fill-in the form and save it. That's it; you have now created a new project. In this new project, create another project called, say, "HelloWorld" in which we will perform this tutorial.

The "Authorization" tab gives you access to the authorization for this module. As you can tell, by default, the project is only visible to you, as this is the default for each module you create. (Groups are not yet supported.) This means that nobody else will see this project in the root project list. To share this project with others, simply hit the Edit button, and check the checkbox corresponding to Read and Public.

3. Apache Server Machine Image Module

Now that we have a project to work in, we need to create a couple of machine image modules: one for the server and another for the test suite. You can do this by navigating to the new project you've created in the previous step and clicking the "New Machine Image" button. This will add a new image to the current project.

As with most forms in the application, you will see a summary tab, followed by different more specialized tabs. In view mode, only the parts that are defined are displayed, whereas in edit mode, all the available tabs are displayed. For example, Machine Images have two specialized tabs: Creation and Deployment. Call this new machine image apache. The following subsections provide information for the other parts of the form.

As briefly explained in the introduction section, SlipStream™ supports two main workflows: "image creation" and "deployment execution". The advantage of creating new specific virtual machine is that during execution, these machine will be up and running very quickly, at the price of creating once a new machine, a process that can take up to 40 minutes. Therefore, for this tutorial, we will not create new machines but simply rely on the deployment instructions (called Targets). We do however encourage you to strongly consider creating new machine images whenever appropriate to improve the performance of you deployments. For this refer to the SlipStream™ Reference Manual.

3.1. Image Reference

The Reference tab contains information specifying the mapping between machine images and between SlipStream™ and real machine images at the cloud service level. SlipStream™ supports the concept of inheritance between machine image modules, which is a powerful feature for building machines incrementally. For this tutorial however, we'll start simple and base our image on an existing base image. A base image in SlipStream™ is simply a module that points to an existing image, not built by SlipStream™. You can see it as a bootstrap.

By default, SlipStream™ ships with references to a few base images, such as Ubuntu 10.04 and Fedora 14. They are located in the Public/BaseImages/Ubuntu and Public/BaseImages/Fedora public projects.

We will base our server and test suite machine images on the standard Ubuntu 10.04 (details). To select this machine image as the base image to our Apache server image, in edit mode, select the Reference tab and click on the "Choose Reference" button. This will bring up the Chooser Window. In this window navigate to the Public/BaseImages/Ubuntu/10.04 machine image and click on the "Select" button. Don't save the newly created machine image yet - we will continue working on it by defining input/output parameters.

3.2. Instance Parameters

3.2.1. Instance Type

Physical properties (number of CPUs, RAM, HD etc.) of running image instances can be set via a set of predefined instance types by selecting them from drop-down menu in the Cloud section on the Parameters tab. One can also opt for inheriting the type of the run-time instance from the base image by selecting inherited. See the following link for definition of Amazon instance types or run stratus-run-instance -l to get the list of supported instance types with their respective configurations for a StratusLab cloud.

3.2.2. Input/Output parameters

Using a IaaS cloud service, we cannot predict the IP address nor the hostname of virtual machines before they are instantiated. While there are common services to specify IP addresses, such as Amazon's Elastic IP, they are limited in number. Therefore, it is not practical to leverage such a service as a general solution since we would run out of addresses very quickly.

To alleviate this problem, SlipStream™ embeds in the image boot-up sequence a small script which will make available metadata to other images running as part of the same deployment.

This discovery feature can be configured using Input and Output parameters in the Parameters tab. Further, this feature also provides a simple synchronization mechanism to control the order in which the different services are brought up. For example, a client will wait for the server it needs to contact to configure and start, while in turn the server might need to wait for a database to initialize before it can accept connections. We will see more of this feature in the test suite client image creation section below.

SlipStream™ allows virtual machines to be synchronized. In our current tutorial, we will want that the test suite only fires once the web server is ready to accept connections. To do this, we use input/output parameters.

Let's go back to our tutorial. Select the Parameters tab. You will see that by default SlipStream™ provides hostname and instanceid "Output" parameters. Now we will create a couple of other output parameters. Click on the Add Parameter button at the bottom of the "Output" section. Create this way a new parameter called port and the other called ready.

The hostname and port parameters will be used to inform the test suite how to connect to the web server, while the ready parameter will tell it when the server is ready for the test to be executed.

We can also give some of our parameters default. In this case, give the port parameter a default value of say, 8080.

3.3. Deployment

SlipStream™ support the creation of new machine images. This can be done using the Creation tab. However, for the sake of simplicity, we will not create new machine images here and rely on the machine image deployment scripts, called Targets as defined in the Deployment tab.

3.3.1. Targets

During execution of a deployment, each image goes through a boot-up sequence, where SlipStream™ executes user scripts. These user scripts are called Targets. The currently available targets are: execute and report. These targets can be defined using the "Targets" sub-section in the "Deployment" tab of the image (in edit mode by clicking "Add Target" button).

The target code is expected to exit with a zero (i.e. 0) return code for normal execution and a non-zero (i.e. !0) for error or failure. Returning a non-zero return code will set the run to "Failing", unless the script sets the abort flag (e.g. using the SlipStream™ command ss-abort). In this last case, once the abort flag is set, the entire run will abort. See the Reference Manual for further details on the deployment execution sequence.

The "execute" target is meant, as its name suggests, to execute a script or a program corresponding to the behavior this image is meant to perform during a deployment. For example, if the image corresponds to a test suite, the execute target will contain a call to execute the test suite.

On the other hand, we will need to use the "report" target, in order to retrieve the Apache logs to verify the correct execution of the server, or investigate any errors reported during server access from the remote test suite.

While the "execute" target runs during the Running phase of the run, the "report" target runs during the Sending Report phase of the run. This is the right time to gather reports. Remember that normally machines are released (i.e. destroyed) at the end of the run, which means that it is a good idea to gather enough information in the reports to help troubleshoot problems or to gather performance data for further analysis. It is possible to instruct SlipStream™ not to release the machines at the end of the execution by changing user parameters.

We can now add standard packages to our reference machine image. Select the Deployment tab. Click on "Add Target" and select from the dropdown list the execute as the target name.

#!/bin/sh -xe
apt-get update -y
apt-get install -y apache2

This recipe will simply update the packages installed on the system and add the Apache web server to the system.

Note

Note that we run the Shell script with -e (exit immediately if any untested command fails - "halt on an error" behavior) and -x (write each command to stderr before it is executed) parameters. This is a good practice for the "execute" target. Whereas, running "report" target with -e might not be a good idea as one would be interested in collecting as much logging info from the node as possible automatically tolerating cases when certain logs or outputs are not present.

Now we need to add some simple data to the Apache server for the test suite to retrieve. We do this by appending to the script defined above the following text:

echo 'Hello from Apache deployed by SlipStream!' > /var/www/data.txt

This will simply add text to a data file available at the root of the Apache server.

Another interesting modification to the Apache server is to change the port on which the web server is listening. To do that, add the following commands to our script:

service apache2 stop
port=$(ss-get port)
sed -i -e 's/^Listen.*$/Listen '$port'/' /etc/apache2/ports.conf
sed -i -e 's/^NameVirtualHost.*$/NameVirtualHost *:'$port'/' \
          /etc/apache2/ports.conf
sed -i -e 's/^<VirtualHost.*$/<VirtualHost *:'$port'>/' \
          /etc/apache2/sites-available/default
service apache2 start
ss-set ready true

This will first stop Apache, so we can change its configuration. Then it will retrieve the port parameter from the SlipStream™ server for the specific run. For this we use the SlipStream™ command ss-get. We then modify the configuration using the port value. After restarting the Apache server, we set the ready parameter to true. This will inform the test suite that the server is ready to accept connections.

Here is what the final script should look like:

#!/bin/sh -xe
apt-get update -y
apt-get install -y apache2

echo 'Hello from Apache deployed by SlipStream!' > /var/www/data.txt

service apache2 stop

port=$(ss-get port)

sed -i -e 's/^Listen.*$/Listen '$port'/' /etc/apache2/ports.conf
sed -i -e 's/^NameVirtualHost.*$/NameVirtualHost *:'$port'/' \
          /etc/apache2/ports.conf
sed -i -e 's/^<VirtualHost.*$/<VirtualHost *:'$port'>/' \
          /etc/apache2/sites-available/default

service apache2 start
ss-set ready true

Back to our immediate goal of building an Apache server for our client/server tutorial, create a "report" target by clicking the "Add Target" button, then select report from the drop down list next to Name and copy and paste the following text in the text area:

#!/bin/sh -x
cp /var/log/apache2/access.log $SLIPSTREAM_REPORT_DIR
cp /var/log/apache2/error.log $SLIPSTREAM_REPORT_DIR

This script copies the standard Apache log files (i.e. access and error) to the standard reports area. The directory /tmp/slipstream/reports is the default location in which the SlipStream™ client will expect the reports to be when bundling and uploading the final reports to the SlipStream™ server.

If you have not already done so, click the save button to commit your changes. You can always go back to previous versions of modules by clicking the "other versions" link on the Summary tab on the "Version" row. You will then see a list of all versions, corresponding to each time you have saved your module.

3.3.2. Output Parameters

By default, when an image is created, SlipStream™ creates output parameters called hostname and instanceid. At runtime, these output parameters are automatically filled by SlipStream™ and will contain hostname of the image instance and the unique identifier of the instance according to the cloud service used. This means that other images, as part of the same deployment, will be able to find this image. In the next section when defining the test suite (client) image, we will leverage this feature.

Now that we have created an Apache machine image module to act as our web server in our client/server tutorial, we next need to create the corresponding client to contact this server.

4. Test Suite Client Image Module

To go with the Apache server machine image we have created in the the previous section, we will now build a client machine image module containing a simple test suite client.

Since we now have a bit more experience with building images, here is a more condensed set of instructions for the client image. Following the same steps as for the Apache server, create in the same project a new Machine Image. Let us call this new image "testclient".

4.1. Image Reference

First, in edit mode, select the "Reference" tab and choose the same Ubuntu image as for the Apache server machine image (i.e. Public/BaseImages/Ubuntu/10.04) using the chooser button.

4.2. Instance parameters

4.2.1. Instance Type

Physical properties (number of CPUs, RAM, HD etc.) of running image instances can be set via a set of predefined instance types by selecting them from drop-down menu in Cloud section on Parameters tab. One can also opt for inheriting the type of the run-time instance from the base image by selecting inherited . See the following link for definition of Amazon instance types or run stratus-run-instance -l to get the list of supported instance types with their respective configurations for StratusLab cloud.

4.2.2. Input/Output parameters

As mentionned before, it doesn't make much sense for the test suite to execute before the server is ready to accept connections. While we could loop inside the test suite waiting for the server to respond, this is not elegant, and it will not scale as we create more complex deployments where, for example, a database must be up and running before the server is ready to accept connections. Also we still do not know where the server is, since we cannot predict a virtual machine's IP address. We will use the synchronisation feature of SlipStream™ to provide synchronization between our machines, without having to expose this issue to our user code.

As we discussed when defining parameters for the Apache server image, the hostname for each machine is automatically resolved by SlipStream™ during the early part of the boot-up sequence. In order to leverage this, we simply need to declare a new input parameter called, for example webserver.hostname. Do this, in edit mode, by clicking on the Parameters tab. We will see how this parameter is associated with hostname output parameter of the Apache server in the next section. What is important to understand at this stage is that while we are focusing on building a simple client/server deployment, the simple test suite we are defining does not know about the specifics of the web server image we have already created, nor does it need to. By creating this input parameter, we are simply stating a requirement where this input parameter must be resolved before this test suite can be executed. It therefore does not know which image this requirement will be fulfilled by.

Along the same lines, we'll need a webserver.port and webserver.ready input parameters.

4.3. Deployment

Under the Deployment tab, create a new execute target with the following content:

#!/bin/sh -xe
# Wait for the metadata to be resolved
web_server_ip=$(ss-get --timeout 360 webserver.hostname)
web_server_port=$(ss-get --timeout 360 webserver.port)
ss-get --timeout 360 webserver.ready

# Execute the test
ENDPOINT=http://${web_server_ip}:${web_server_port}/data.txt
wget -O /tmp/data.txt ${ENDPOINT} && \
    ss-set statecustom "OK: $(cat /tmp/data.txt)" || \
    ss-abort "Could not get the test file: ${ENDPOINT}"

The above bash script simply uses the SlipStream™ command line client to retrieve the the hostname and the port parameters to use to connect to the web server. It also reads the ready indicating that the server is ready to receive connections. By default the ss-get command is blocking, which means that the command will wait until the parameter is set (or a timeout occurs) before returning. Then, we wget the default web page and ensures that this retrieval was successful.

To make the demo a bit more lively, we then use set the ss-set to set the statecustom parameter to display information in the SlipStream™ dashboard.

Note

Instead of using the command-line interface, we could have used the Python API ('cause we like Python at SixSq ;-), and created a PyUnit test case instead.

Note

For more details on the client command-line and Python API, refer to the SlipStream™ Reference Manual.

The script above will exit with a zero return code if the test suite succeeds, or a non-zero return code if the assertion fails or another error occurs in the script execution, such as if the SlipStream™ client cannot reach the SlipStream™ server or if any parameter (e.g. webserver.hostname in this case) is not defined.

Since the execution of this script already redirects the standard output and error to the reports directory, we do not need to add a report target to get the output of the test suite execution.

However, for the demonstration's sake, we may add the following report target which would bundle the file downloaded from the server with the execution report.
#!/bin/sh -x
cp /tmp/data.txt $SLIPSTREAM_REPORT_DIR

5. Deployment Module to Run it All

Now that we have two machine image modules to work with, we will create a deployment module to run these images to form our simple client/server system test.

Go back to your project and click on the New Deployment button. Give it a sensible name, say client_server. You will see that deployments have the concept of Node. A Node in SlipStream™ is a running instance of an image. For this tutorial, we need to add two nodes corresponding to our Apache server and our test suite. To do this follow these simple steps in edit mode:

  1. Add a new node, in the Nodes tab, by clicking on the "Add Node" button. This will open a chooser window. In the chooser, navigate and select your apache image. You will only be able to select an module of type "Image". Now name this node to say apache1.

  2. Do the same for the test suite. As you can see, SlipStream™ automatically pulls the input parameters of the selected machine image module for you to resolve. Call the node say, testclient1.

  3. Set the "Linked to" field of the webserver.hostname parameter to apache1:hostname (where "apache1" corresponds to the name of the node you have given in the first step). This means that when the apache1's hostname parameter will be set as part of the node execution sequence, the webserver.hostname parameter of the "testclient1" node will also be set, linking them together. Autocompletion dropdown should guide you to help choose the right parameter. Link the following testclient1 imput paramters to apache1 ones as well: webserver.port to apache1:port and webserver.ready to apache1:ready.

  4. Save the deployment.

We are now ready to create our new deployment test.

6. Execute Distributed Test

To launch the distributed test, simply click on the "Run" button of the deployment you have created above. Sit back, relax and enjoy the show!

The execution instance created for each submission allows you to track the progress of the distributed test. Once the test is completed, you can access the reports generated by the different nodes, by clicking on the "Results" link.

You can access all your execution by clicking on the "dashboard" link at the top right of every page. To only list the execution of a given deployment module, select the "Runs" tab.

Thanks for taking the time to learn about SlipStream™ and please if there's anything we can do to improve this tutorial or the application itself, don't hesitate in getting back to us at .

Chapter 3. Performance Example using Apache

1. Goal

The goal of this tutorial is to demonstrate how SlipStream™ can be used to automate performance testing, reusing existing functional system test modules. A single parameter is required to instruct SlipStream™ to instantiate several instances of a single image, without needing any duplication of metadata in SlipStream™. We will use this feature to define a performance test, where several test suites will be launched together to create a higher load on the Apache server we already created in the "Simple Client/Server" tutorial. With a slight modification to the test suite, such that instead of downloading a document once, we will loop over a few times such that we can study the behaviour of Apache (or any server) under load.

If you have not performed the "Simple Client/Server" tutorial, you can find a solution of that tutorial in the area Public/Apache. However, we assume that you have acquired the knowledge presented in that first tutorial.

2. Create new Project

In your home project (refer to the "Simple Client/Server" tutorial), create another project called, say, "Performance_Tutorial". It is in this project that we will execute this tutorial.

3. Create a new Deployment Module

Create a new deployment module in the "Performance_Tutorial" project called, say, "deployment". In this deployment we need to add two nodes corresponding to our Apache server and a test suite. To start with, we will reuse the "Simple Client/Server" tutorial test suite.

In this tutorial, we introduce the concept of multiplicity. This means that by setting a multiplicity value on a node, we instruct SlipStream™ to instantiate at runtime several times the same virtual machine, but with a distinct image names. When instantiating nodes with multiplicity, SlipStream™ creates entries on the execution instance of the form <nodename>-<i> where i is an index ranging from 1 to the value given to the multiplicity field.

To do this follow these steps:

  1. Add a new node, by clicking on the "Add Node" button. This will start a new in-line window in your browser we call the "Chooser". In the Chooser, navigate and select your apache image. You will only be able to select a module of type "Image". Now name this node "apache".

  2. Do the same for the test suite as we have done for the Simple Client/Server tutorial. Name it "testsuite".

  3. On the "testsuite" node, set the "Multiplicity" field to 3. This means that while we have defined a single "testsuite" node and it will be duplicated at runtime such that we have 3 distinct "testsuite" image instances. At runtime, the three "testsuite" will be called respectively: testsuite-1, testsuite-2 and testsuite-3.

  4. Here as well, we need to resolve the testsuite's input parameter requirement. Set the "Linked to" field of the webserver.hostname parameter to apache:hostname (where "apache" corresponds to the name of the node you have given in the first step). This means that when the apache:hostname parameter will be set as part of the "apache" node execution sequence, the webserver.hostname parameter of the "testsuite" nodes will also be set, linking them together.

  5. Save the deployment.

We are now ready to submit our new deployment test.

4. Execute Distributed Test

To launch the distributed test, simply click on the "Run" button of the deployment you have created above.

The execution instance created for each submission allows you to track the progress of the distributed test. When the test is completed, you can access the reports generated by the different nodes, by clicking on the "Results" link.

In the report, you will now see an entry for each test suite, containing the specific report of the test suite instance.

While this is interesting, we can do better. Next, we will modify the test suite to increase the load.

5. Increasing the Load on the Server

Instead of simply reusing the test suite from the simple client/server tutorial, we could upgrade the test suite, in which we could for example loop a few times over getting the data, and record the access time for each retrieval. We could also perform this data retrieval from several threads, to make sure we saturate the network, and this by increasing the threads over time. By resubmitting this deployment and varying the multiplicity number, we should see how the number of clients and requests affect the web server's response time. Finally, we could also increase the size of the retrieved document, to increase again the load of the server and the network. We leave this exercise to the user and are looking forward to hearing your solutions.

Appendix A. Troubleshooting

1. Debugging a failing machine image creation

When looking for the source of a failure in creating a new machine image, the simplest thing to do is to log into the machine and run the recipe by hand. Once the recipe works, copy/paste back into the SlipStream image definition and re-run the image creation. Here are the steps to do that:

  1. Instruct SlipStream to freeze on error and run forever. To do that, once logged-in, access your account by clicking on your username at the top right corner of the page. Click the Edit button and on that page in the Properties section, tick the Freeze machines on error option as well as the Run forever on success option. From now on, SlipStream will leave your machines running, so make sure you kill them manually, using for example Elasticfox.

    Note

    These settings will only affect new executions, therefore, they will not affect already running machines.

  2. Once you've made the above changes re-run the failing machine image creation. Find the instance id of the machine from the execution properties. This id can be found in the execution property list as instanceid and login to it using ssh. Elasticfox is handy for that, but you can also using the following command:

    ssh -i <keypair> root@<machine ip address>

    where <keypair> points to the private key file (e.g. id_gsg-keypair if you have followed the AWS account creation examples). You'll have to have saved this file when creating the key. Once more, Elasticfox is handy for doing this.

  3. Once logged-in to the failing machine, configure the SlipStream client environment. To do that, simply source the SlipStream environment setup file:

    source /opt/slipstream/client/scripts/slipstream.setup

    Your local environment should now be the same as the one when the SlipStream orchestrator runs your recipe.

  4. You can now rerun the recipe scripts. The image creation workflow is described in the Reference Manual, but here's a summary of the creation steps, omitting the stock image creation steps and the custom Python environment sometimes required:

    1. package installation

    2. recipe execution

    Note

    If you're creating a stock image, refer to the Reference Manual for details on advanced image creation process.

    If defined, the recipe script is copied by the orchestrator in the /tmp/slipstream directory. The file slipstream-remote-script is the script generated by SlipStream and executed on the machine by the orchestrator via ssh. If you have defined packages to be installed, the slipstream-remote-script script will contain a call to the ss-install-package command with the packages as arguments. Internally, the ss-install-package command will attempt to identify the right local package installation command (e.g. yum, apt). This command expects that the packages are located in the default package repository as configured on the local system by the time the command runs.

You now have the option of rerunning the slipstream-remote-script, only the recipe or the packages installation (by either using the local package command or the ss-install-package command). Once you've identified and fixed the image creation problem, you can copy and paste these modifications back in SlipStream and re-run a clean build.

2. Debugging a failing deployment

When looking for the causes of a failed deployment, here are a few tips and tricks that might help you identifying the source of the problem.

Most causes of deployment failures are due to faulty scripts. Here's a method to avoid playing trial and error which can be time consuming in finding the cause of the error:

  1. Instruct SlipStream to freeze on error and run forever. Here's a link to instructions for doing it.

  2. Once you've made the above changes re-run the failing machine image creation. Find the instance id of the machine from the execution properties. This id can be found in the execution property list as <nodename>.instanceid and login to it using ssh. Elasticfox is handy for that, but you can also using the following command:

    ssh -i <keypair> root@<machine ip address>

    where <keypair> points to the private key file (e.g. id_gsg-keypair if you have followed the AWS account creation examples). You'll have to have saved this file when creating the key. Once more, Elasticfox is handy for doing this.

  3. Once logged-in to the failing machine, configure the SlipStream client environment. Here's a link to instructions for doing it.

  4. At this point, from a single node, you can re-run its execution script called execute (located in /tmp/slipstream). However, if you're troubleshooting a deployment, it's likely that your deployment will already have failed, which includes the abort flag being set. This special flag is used to unblock all blocking calls to SlipStream to make sure the deployment workflow finishes in a controlled manner despite an error being detected. To reset the workflow, run the ss-abort command with the --cancel option.

    ss-abort --cancel
  5. From this point on, you should be able to execute your execute script which might help you to identify the source of the deployment failure. This script is located in located in /tmp/slipstream).

Sometime, you'll also need to (re)set key/value pairs from the current node or from other nodes. You can use the ss-set to set values, as from the standard targets an recipes, as well as ss-get to fetch key values.

Appendix B. Resources

1. Amazon Services

Elastic Computing Cloud (EC2): The AWS service that provides computing resources by running virtual machine images. A limited number of fixed IP addresses can be assigned to images via the Elastic IP service.

Simple Storage Service (S3): The basic AWS service for storing files. It is used with EC2 to store machine images.

Elastic Block Service (EBS): A "disk" image that can be mounted by machine images in EC2. It uses the S3 service behind the scenes, but provides a real "disk" device to the machine images.

2. Apache2 Server

The Apache Web Server is a popular web server maintained by the Apache Software Foundation.

3. Firefox

The Elasticfox plug in for the Firefox browser makes interacting with the Amazon Web Services easy.

4. Ubuntu and Debian AMIs

A set of public Ubuntu and Debian AMIs are maintained by the community. Information about them can be obtained from the Alestic web site and support from the ec2ubuntu Google Group.

5. CentOS 5

CentOS 5 images have been prepared by RightScale. See their description to understand what is in their prepared images or to use their script to prepare a new one.