Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pix-art/7681690e64e67b726628 to your computer and use it in GitHub Desktop.
Save pix-art/7681690e64e67b726628 to your computer and use it in GitHub Desktop.

##1. Setup docker

#Mac
https://docs.docker.com/installation/mac/

#Linux
https://docs.docker.com/installation/ubuntulinux/

##2. Setup docker-machine

#Mac
curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_darwin-amd64 > /usr/local/bin/docker-machine

#Linux
curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-amd64 > /usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine

##3. Create Client and Servers

docker-machine create --driver digitalocean --digitalocean-region ams2 --digitalocean-access-token {YOUR_SECRET_TOKEN_HERE} jmeter-server{JMETER_SERVER_ID}
docker-machine create --driver digitalocean --digitalocean-region ams2 --digitalocean-access-token {YOUR_SECRET_TOKEN_HERE} jmeter-client

##4. Setup docker container on each server

Run these commands for all server instances

#This activates your wanted server for docker on your master
docker-machine active jmeter-server{JMETER_SERVER_ID}
eval "$(docker-machine env jmeter-server{JMETER_SERVER_ID})"

#This starts a docker container with the right listening ports
docker run -d -p 0.0.0.0:1099:1099 -p 0.0.0.0:60000:60000 -p 0.0.0.0:4445:4445 -v /root:/logs santosharakere/jmeter-server -Djava.rmi.server.hostname={YOUR_SERVER_IP} -Dmode=Standard

##5. Setup docker container for client

#This activates your wanted client for docker on your master
docker-machine active jmeter-client
eval "$(docker-machine env jmeter-client)"

#This created an ssh connection to your client where you clone the driver setup
docker-machine ssh jmeter-client
git clone https://github.com/smarigowda/jmeter-driver.git

#Close connection made before so you're back on your master
exit

##6. Run your tests

#Start docker container on your client with the test_google scenario
docker run -p 0.0.0.0:1099:1099 -p 0.0.0.0:60000:60000 -p 0.0.0.0:4445:4445 -v /root/jmeter-driver:/jmeter-driver santosharakere/jmeter -n -t /jmeter-driver/test_google.jmx -Djava.rmi.server.hostname={YOUR_CLIENT_IP} -l /jmeter-driver/results.jtl -LDEBUG -R{YOUR_SERVER_IP}

##7. View results

#Connect to client and open results
docker-machine ssh jmeter-client
vim jmeter-driver/results.jtl
@jverdeyen
Copy link

Any reason why you didn't brew install docker-machine? Thanks for the gist! 👍

@pix-art
Copy link
Author

pix-art commented Jun 9, 2015

Thanks a lot for the tip :-) This was my first experience with Docker and Docker-machine. So I followed the manual, in which they recommended this way.

@nathanleclaire
Copy link

Very fun. Something to be aware of, in 0.3.0 / master you only need to do eval "$(docker-machine env jmeter-client)" and the "active" will be tracked automatically from the environment variables set, so docker-machine active dev is not needed anymore.

@pix-art
Copy link
Author

pix-art commented Jun 16, 2015

Awesome! Thanks for sharing @nathanleclaire

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment