Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
mtenrero committed Dec 10, 2017
1 parent fd78c1c commit 29f38c9
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM alpine

LABEL com.mtenrero.jmeter.version="3.3.0"
LABEL vendor="mtenrero.com"
LABEL maintainer="Marcos Tenrero"

RUN apk --update add openjdk8-jre-base
RUN apk -- update add wget

RUN wget http://ftp.cixug.es/apache//jmeter/binaries/apache-jmeter-3.3.tgz
RUN tar zxvf apache-jmeter*.tgz
RUN apk del wget

COPY ./test /test
COPY jmeter_startpoint.sh /script/jmeter_startpoint.sh

RUN rm -f apache-jmeter*.tgz
RUN rm -fr /apache-jmeter*/docs

EXPOSE 7777
EXPOSE 1099
EXPOSE 4445

ENTRYPOINT [ "/bin/ash", "/script/jmeter_startpoint.sh" ]
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# jmeterDistributed
Docker Image with Jmeter specially designed for distributed load testing
Docker Image with Jmeter and OpenJDK JRE based on Linux Alpine specially designed for distributed load testing

## Building the image
In order to build the image, you should run the following command:
`docker build -t mtenrero/jmeter -t mtenrero/jmeter:latest -t mtenrero/jmeter:3.3 .`
Please, bear in mind that the tags *:latest* and *:3.3* represents the version of Jmeter you're installing into the image

## Running the image
The image can be started in two modes:

- **Master** Represents the main instance of Jmeter, and should be started after the nodes. Also a environment variable **_REMOTES_** should be specified in the `docker run` command with the list of all available remotes to use by the master. `docker run -it -v $(pwd)/test:/test -e MODE="master" -e TEST_NAME="test.jmx" -e REMOTES="hosts" -p 6666:6666 mtenrero/jmeter`
- **Node** It's a worker in the distributed load testing process. `docker run -d -e MODE="node" -p 7777:7777 -p 1099:1099 -p 4445:4445 mtenrero/jmeter`

## Docker Compose
Docker Compose is the easiest way to try the configuration locally. You only need to specify the test name without the JMX extension in the enviroment variable *TEST_NAME* and put the file under the test folder within the root docker-compose folder.

If you need simulate multiple nodes, clone the slaves in the docker-compose file and make sure that they are declared in the REMOTES env.

`TEST_NAME=abvetmadrid docker-compose up`

## Ports
- **4445** Jmeter communication port
- **7777** RMI Port
- **1099** Master Port

## Roadmap
- [x] Basic Image for running distributed tests
- [x] Docker-compose for local debugging
- [ ] Publish to Docker Hub
- [ ] CI/CD
- [ ] Docker-compose v3 improvements
- [ ] Fix non-ending slaves
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3.3"
services:
master:
image: mtenrero/jmeter
tty: true
environment:
- MODE=master
- TEST_NAME=$TEST_NAME
- REMOTES=slave
expose:
- 6666
depends_on:
- slave
slave:
image: mtenrero/jmeter
tty: true
environment:
- MODE=node
expose:
- 7777
- 1099
- 4445
36 changes: 36 additions & 0 deletions tools/jmeter_startpoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# !/bin/bash
#### Description: Start up Jmeter in the mode specified
#### MODES: master / node
#### Master mode requires a REMOTES env with the list of the remote nodes
#### Written by: Marcos Tenrero on 11-2017

MODE=$MODE
RMI_PORT=$RMI_PORT
JMX=$JMX

_node(){
cd ../apache-jmeter*
cd bin
./jmeter-server -Dserver.rmi.localport=7777 -Dserver_port=1099
}

_master(){
cd ../apache-jmeter*
cd bin
./jmeter -n -t ../../test/$TEST_NAME.jmx -R$REMOTES
./shutdown.sh
}

if [ "$MODE" == "master" ]
then
echo "MASTER/SINGLE mode"
_master
elif [ "$MODE" == "node" ]
then
echo "NODE/SLAVE mode"
_node
else
echo "No valid mode detected, master/node in env MODE, exiting..."
exit 1
fi

0 comments on commit 29f38c9

Please sign in to comment.