Giter Site home page Giter Site logo

gatling-docker-on-aws's Introduction

Distributed Gatling testing using Docker on AWS Build Status

Read more about it in my blog post here.

Prerequisites

Create

  • ECR repository for Gatling Docker image
  • S3 bucket for Gatling logs
  • ECS cluster for running Docker containers, see below

Install

  • aws-cli. Install using pip install awscli
  • ecs-cli. Download from here
  • Docker

Running

The test consists of 3 steps:

  • Building the Docker image
  • Running the loadtest on AWS
  • Creating the HTML report

Since all steps use aws-cli or ecs-cli, make sure to setup your AWS env variables:

  • export AWS_DEFAULT_REGION=<region>
  • export AWS_ACCESS_KEY_ID=<id>
  • export AWS_SECRET_ACCESS_KEY=<key>

Building docker image

./scripts/buildDockerImage.sh -r <ECR_REPOSITORY_NAME>

Running loadtest on AWS

./scripts/runLoadtestOnAWS.sh -r <S3_BUCKET> -c <NR_CONTAINERS> -u <NR_USERS_PER_CONTAINER> -d <DURATION_IN_MIN> -ramp <RAMPUP_TIME_IN_SEC> -cl <ECS_CLUSTER>

Creating HTML report

./scripts/generateHTMLReport.sh -r <S3_BUCKET>

Developing

Run Gatling tests directly without Docker

mvn clean gatling:test

Creating docker image locally

docker build -t gatling-runner .

Run docker image locally

Use docker volume to add your AWS credentials that has permission to write to the S3 bucket. You can also optionally provide the AWS profile:
docker run --rm -v ${HOME}/.aws/credentials:/root/.aws/credentials:ro gatling-runner -r <bucketname> [-p <profile]

ECS Cluster

Create ECS cluster on AWS

ecs-cli configure --cluster gatlingCluster --region eu-west-1 --config-name gatlingConfiguration
ecs-cli up --capability-iam --instance-type t3.large --size 1

IMPORTANT: The command will generate all the needed stuff, but make sure to add to the generated IAM role the policy for writing to your S3 bucket.

OR Create ECS cluster using Fargate:

ecs-cli configure --cluster gatlingCluster --region eu-west-1 --default-launch-type FARGATE --config-name gatlingConfiguration
ecs-cli up

Checking progress of tasks:

ecs-cli compose ps

Getting logging from a task:

ecs-cli logs --task-id <task_id> --follow

Remove cluster:

ecs-cli down --force

gatling-docker-on-aws's People

Contributors

richardhendricksen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.