diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d96a104 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM maven:3.9.5-eclipse-temurin-11-alpine as builder + +RUN wget https://github.com/JetBrains/kotlin/releases/download/v1.8.0/kotlin-compiler-1.8.0.zip && \ + unzip kotlin-compiler-1.8.0.zip -d /opt && \ + rm kotlin-compiler-1.8.0.zip + +WORKDIR /app +COPY pom.xml ./ +COPY ./src ./src +RUN mvn clean package + +FROM maven:3.9.5-eclipse-temurin-11-alpine + +ENV USER=iroha +ENV UID=1000 +ENV GID=1000 +ENV MAVEN_CONFIG=/var/maven/.m2 +USER root + +RUN set -ex && \ + addgroup -g $GID $USER && \ + adduser \ + --disabled-password \ + --gecos "" \ + --home /app \ + --ingroup "$USER" \ + --uid "$UID" \ + "$USER" && \ + mkdir -p $MAVEN_CONFIG && \ + chown $USER:$USER -R $MAVEN_CONFIG + +WORKDIR /app +COPY --from=builder /app/pom.xml ./ +COPY --from=builder /app/target/ ./target/ + +USER $USER + +ENTRYPOINT ["/usr/local/bin/mvn-entrypoint.sh"] diff --git a/docker-compose.load.yml b/docker-compose.load.yml new file mode 100644 index 0000000..c18c652 --- /dev/null +++ b/docker-compose.load.yml @@ -0,0 +1,92 @@ +version: "3" + +services: + gatling: + container_name: iroha2-perf + build: + context: . + dockerfile: ./Dockerfile + restart: unless-stopped + mem_limit: 4G + cpus: 16 + working_dir: /app + read_only: true + tmpfs: + - /tmp + - /app/target/gatling + - /var/log + environment: + MAVEN_CONFIG: /var/maven/.m2 + command: > + mvn gatling:test + -Duser.home=/var/maven + -Dgatling.simulationClass=jp.co.soramitsu.load.simulation.transaction.StabilitySimulation + -DtargetProtocol=https + -DtargetURL= + -DremoteLogin= + -DremotePass= + -DlogLevel=INFO + -Dconfiguration=standard + -Dintensity=5 + -DrampDuration=10 + -DstageDuration=604800 + networks: + - iroha2-perf-net + volumes: + - gatling-volume:/var/maven/.m2 + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "3" + labels: + - 'filebeat.fields.app=iroha2-perf' + - 'filebeat.fields.env=tst' + - 'filebeat.fields.project=iroha2-perf' + - 'filebeat.fields.logtype=iroha2' + - 'filebeat.multiline.pattern=^\[\d{2}\.\d{2}\.\d{4}' + - 'filebeat.multiline.negate=true' + - 'filebeat.multiline.match=after' +# - 'filebeat.module=docker' + healthcheck: + test: wget --no-verbose --tries=1 --spider http://127.0.0.1:4567/health || exit 1 + interval: 1m + timeout: 10s + retries: 3 + start_period: 1m + + pushgateway: + container_name: pushgateway + image: prom/pushgateway:v1.6.2 + restart: unless-stopped + mem_limit: 512M + cpus: 1 + ports: + - "9091:9091" + networks: + - iroha2-perf-net + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "3" + labels: + - 'filebeat.fields.app=iroha2-push-gw' + - 'filebeat.fields.env=tst' + - 'filebeat.fields.project=iroha2-perf' + - 'filebeat.fields.logtype=iroha2' +# - 'filebeat.module=docker' + + healthcheck: + test: wget --no-verbose --tries=1 --spider http://127.0.0.1:9091/-/healthy || exit 1 + interval: 1m + timeout: 10s + retries: 3 + start_period: 1m + +networks: + iroha2-perf-net: + driver: bridge + +volumes: + gatling-volume: diff --git a/docker-compose.maxPerf.yml b/docker-compose.maxPerf.yml new file mode 100644 index 0000000..626a0d4 --- /dev/null +++ b/docker-compose.maxPerf.yml @@ -0,0 +1,94 @@ +version: "3" + +services: + gatling: + container_name: iroha2-perf + build: + context: . + dockerfile: ./Dockerfile + restart: unless-stopped + mem_limit: 4G + cpus: 16 + working_dir: /app + read_only: true + tmpfs: + - /tmp + - /app/target/gatling + - /var/log + environment: + MAVEN_CONFIG: /var/maven/.m2 + command: > + mvn gatling:test + -Duser.home=/var/maven + -Dgatling.simulationClass=jp.co.soramitsu.load.simulation.transaction.PerformanceSimulation + -DtargetProtocol=https + -DtargetURL= + -DremoteLogin= + -DremotePass= + -DlogLevel=INFO + -Dconfiguration=standard + -DconcurrentUsers=1 + -Dtimes=10000 + -DeachLevelLasting=15 + -DseparatedByRampsLasting=1 + -DstartingFrom=0 + networks: + - iroha2-perf-net + volumes: + - gatling-volume:/var/maven/.m2 + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "3" + labels: + - 'filebeat.fields.app=iroha2-perf' + - 'filebeat.fields.env=tst' + - 'filebeat.fields.project=iroha2-perf' + - 'filebeat.fields.logtype=iroha2' + - 'filebeat.multiline.pattern=^\[\d{2}\.\d{2}\.\d{4}' + - 'filebeat.multiline.negate=true' + - 'filebeat.multiline.match=after' + # - 'filebeat.module=docker' + healthcheck: + test: wget --no-verbose --tries=1 --spider http://127.0.0.1:4567/health || exit 1 + interval: 1m + timeout: 10s + retries: 3 + start_period: 1m + + pushgateway: + container_name: pushgateway + image: prom/pushgateway:v1.6.2 + restart: unless-stopped + mem_limit: 512M + cpus: 1 + ports: + - "9091:9091" + networks: + - iroha2-perf-net + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "3" + labels: + - 'filebeat.fields.app=iroha2-push-gw' + - 'filebeat.fields.env=tst' + - 'filebeat.fields.project=iroha2-perf' + - 'filebeat.fields.logtype=iroha2' + # - 'filebeat.module=docker' + + healthcheck: + test: wget --no-verbose --tries=1 --spider http://127.0.0.1:9091/-/healthy || exit 1 + interval: 1m + timeout: 10s + retries: 3 + start_period: 1m + +networks: + iroha2-perf-net: + driver: bridge + +volumes: + gatling-volume: diff --git a/docker-compose.stress.yml b/docker-compose.stress.yml new file mode 100644 index 0000000..15285a2 --- /dev/null +++ b/docker-compose.stress.yml @@ -0,0 +1,96 @@ +version: "3" + +services: + gatling: + container_name: iroha2-perf + build: + context: . + dockerfile: ./Dockerfile + restart: unless-stopped + mem_limit: 4G + cpus: 16 + working_dir: /app + read_only: true + tmpfs: + - /tmp + - /app/target/gatling + - /var/log + environment: + MAVEN_CONFIG: /var/maven/.m2 + command: > + mvn gatling:test + -Duser.home=/var/maven + -Dgatling.simulationClass=jp.co.soramitsu.load.simulation.transaction.StressSimulation + -DtargetProtocol=https + -DtargetURL= + -DtargetPath= + -DremoteLogin= + -DremotePass= + -DlogLevel=INFO + -Dconfiguration=standard + -Dintensity=5 + -DrampDuration=10 + -DstageDuration=300 + -DstressIntensity=20 + -DstressRampDuration=1 + -DstressDuration=300 + networks: + - iroha2-perf-net + volumes: + - gatling-volume:/var/maven/.m2 + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "3" + labels: + - 'filebeat.fields.app=iroha2-perf' + - 'filebeat.fields.env=tst' + - 'filebeat.fields.project=iroha2-perf' + - 'filebeat.fields.logtype=iroha2' + - 'filebeat.multiline.pattern=^\[\d{2}\.\d{2}\.\d{4}' + - 'filebeat.multiline.negate=true' + - 'filebeat.multiline.match=after' +# - 'filebeat.module=docker' + healthcheck: + test: wget --no-verbose --tries=1 --spider http://127.0.0.1:4567/health || exit 1 + interval: 1m + timeout: 10s + retries: 3 + start_period: 1m + + pushgateway: + container_name: pushgateway + image: prom/pushgateway:v1.6.2 + restart: unless-stopped + mem_limit: 512M + cpus: 1 + ports: + - "9091:9091" + networks: + - iroha2-perf-net + logging: + driver: "json-file" + options: + max-size: "100m" + max-file: "3" + labels: + - 'filebeat.fields.app=iroha2-push-gw' + - 'filebeat.fields.env=tst' + - 'filebeat.fields.project=iroha2-perf' + - 'filebeat.fields.logtype=iroha2' +# - 'filebeat.module=docker' + + healthcheck: + test: wget --no-verbose --tries=1 --spider http://127.0.0.1:9091/-/healthy || exit 1 + interval: 1m + timeout: 10s + retries: 3 + start_period: 1m + +networks: + iroha2-perf-net: + driver: bridge + +volumes: + gatling-volume: