Skip to content

Instantly share code, notes, and snippets.

View vepo's full-sized avatar
💻
/bin/bash

Victor Osório vepo

💻
/bin/bash
View GitHub Profile
@vepo
vepo / HibernateScannUtil.java
Last active May 3, 2017 19:33
Load Class Annotations with Scannotation for Hibernate
public class HibernateScannUtil {
public static void scanAndAddAnnotatedClasses(Configuration configuration) {
ClassLoader classLoader = User.class.getClassLoader();
URL url = ClasspathUrlFinder.findClassBase(User.class);
try {
AnnotationDB db = new AnnotationDB();
db.setScanClassAnnotations(true);
db.setScanFieldAnnotations(false);
db.scanArchives(url);
Updagrade to lastest
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Downgrade to version
sudo npm cache clean -f
sudo npm install -g n
sudo n <version>
@vepo
vepo / Dockerfile
Created September 9, 2017 12:08
jmeter-base-dockerfile
FROM java:8
RUN wget http://mirror.nbtelecom.com.br/apache//jmeter/binaries/apache-jmeter-3.2.tgz
RUN tar -xvzf apache-jmeter-3.2.tgz
RUN rm apache-jmeter-3.2.tgz
RUN mv apache-jmeter-3.2 /jmeter
ENV JMETER_HOME /jmeter
@vepo
vepo / Dockerfile
Created September 9, 2017 12:10
JMeter master
FROM jmeter-base
WORKDIR $JMETER_HOME
# Ports to be exposed from the container for JMeter Master
RUN mkdir scripts
EXPOSE 60000
@vepo
vepo / Dockerfile
Created September 9, 2017 12:11
JMeter slave dockerfile
FROM jmeter-base
# Ports to be exposed from the container for JMeter Slaves/Server
EXPOSE 1099 50000
# Application to run on starting the container
ENTRYPOINT $JMETER_HOME/bin/jmeter-server \
-Dserver.rmi.localport=50000 \
-Dserver_port=1099
@vepo
vepo / docker-compose.yml
Last active February 18, 2021 07:07
JMeter master-slave docker-compose file
version: '2'
services:
master:
build: ./jmeter-master
container_name: master
tty: true # tty true make the docker image stay up even with nothing running
networks:
- jmeter-network
slave:
@vepo
vepo / start-jmeter-env.sh
Created September 9, 2017 12:24
Start JMeter environment
#!/bin/bash
COUNT=${1-1}
docker build -t jmeter-base jmeter-base
docker-compose build
docker-compose up -d
docker-compose scale master=1 slave=$COUNT
@vepo
vepo / exec-jmeter.sh
Last active September 9, 2017 12:40
Execute JMeter test plans
#!/bin/bash
SLAVE_IP=$(docker inspect -f '{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq) | grep slave | awk -F' ' '{print $2}' | tr '\n' ',' | sed 's/.$//')
WDIR=`docker exec -it master /bin/pwd | tr -d '\r'`
mkdir -p results
for filename in scripts/*.jmx; do
NAME=$(basename $filename)
NAME="${NAME%.*}"
eval "docker cp $filename master:$WDIR/scripts/"
eval "docker exec -it master /bin/bash -c 'mkdir $NAME && cd $NAME && ../bin/jmeter -n -t ../$filename -R$SLAVE_IP'"
@vepo
vepo / cleanup.sh
Created September 9, 2017 12:38
Cleanup docker-compose
#!/bin/bash
docker-compose stop
docker-compose rm
@vepo
vepo / create-hosts.sh
Last active September 21, 2017 02:33
Creating two docker machines
#!/bin/bash
docker-machine create --driver virtualbox node1
docker-machine create --driver virtualbox node2