Add example rtb/tsung Dockerfiles, scripts, and configs
All checks were successful
moparisthebest/xmpp-bench-proxy/pipeline/head This commit looks good

This commit is contained in:
Travis Burtrum 2023-10-28 16:48:19 -04:00
parent 3e5e70de63
commit 0079f514e1
Signed by: moparisthebest
GPG Key ID: 88C93BFE27BC8229
7 changed files with 311 additions and 0 deletions

24
contrib/rtb/Dockerfile Normal file
View File

@ -0,0 +1,24 @@
# build some things
FROM docker.io/library/debian:latest AS build
RUN apt-get update && apt-get -y install gcc g++ make libexpat1-dev libyaml-dev \
libssl-dev zlib1g-dev gnuplot-nox erlang-nox erlang-dev git && \
mkdir -p /build/ && \
git clone https://github.com/processone/rtb /build/ && rm -rf /build/rtb/.git && \
chown -R nobody: /build/ && ls -lah /build/ && \
cd /build/ && su -m -s /bin/bash nobody -c make && \
find -type d -name .git -print0 | xargs -0 rm -rf && cp rtb.yml.xmpp.example rtb.yml
FROM docker.io/library/debian:latest
RUN apt-get update && apt-get -y install gnuplot-nox erlang-nox libyaml-0-2 && rm -rf /var/lib/apt/lists
COPY --from=build /build/cert.pem /build/rtb.sh /build/rtb.yml /app/
COPY --from=build /build/deps /app/deps
COPY --from=build /build/ebin /app/ebin
COPY --from=build /build/priv /app/priv
#COPY --from=build /build /app/all
WORKDIR /app
ENTRYPOINT /app/rtb.sh

6
contrib/rtb/rtb.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
set -eux
podman build . -t rtb
podman run --network host --rm -it -p 8080:8080 --volume $(pwd)/rtb.yml:/app/rtb.yml:ro rtb

52
contrib/rtb/rtb.yml Normal file
View File

@ -0,0 +1,52 @@
###
### RTB configuration file
###
### The parameters used in this configuration file are explained at
###
### https://github.com/processone/rtb/blob/master/README.md
###
### The configuration file is written in YAML
###
### *******************************************************
### ******* !!! WARNING !!! *******
### ******* YAML IS INDENTATION SENSITIVE *******
### ******* MAKE SURE YOU INDENT SECTIONS CORRECTLY *******
### *******************************************************
###
### Mandatory options: common for all scenarios
scenario: xmpp
interval: 1
capacity: 1
certfile: cert.pem
debug: true
### Mandatory options for XMPP scenario
jid: user%@example.org
password: pass%
### Server addresses
### Optional, but highly recommended to set
### servers:
### - tcp://127.0.0.1:5222
### - tcp://192.168.1.1:5222
servers:
- tcp://192.168.1.1:5222
### An HTTP port for the statistics web interface
### www_port: 8080
connect_timeout: 30
reconnect_interval: 1
sm: false
disconnect_interval: false
starttls: false
proxy65_interval: false
http_upload_interval: false
### Local Variables:
### mode: yaml
### End:
### vim: set filetype=yaml tabstop=8

11
contrib/tsung/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
# build some things
FROM docker.io/library/debian:latest
RUN apt-get update && apt-get -y install tsung && rm -rf /var/lib/apt/lists
RUN ln -sf /usr/lib/x86_64-linux-gnu/tsung/bin/* /usr/bin/
WORKDIR /root
ENTRYPOINT /usr/bin/tsung
CMD start

9
contrib/tsung/tsung.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/sh
set -eux
podman build . -t tsung
# podman run --rm --entrypoint tar tsung -C /usr/share/doc/tsung/examples -cf - . > tsungexamples.tar
rm -rf tsung-logs; mkdir -p tsung-logs; podman run --network host --rm -it -p 8091:8091 --volume $(pwd)/tsung-logs:/root/.tsung/log --volume $(pwd)/tsung.xml:/root/.tsung/tsung.xml:ro --entrypoint tsung tsung start

View File

@ -0,0 +1,107 @@
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/home/nniclaus/share/tsung/tsung-1.0.dtd" [] >
<tsung loglevel="notice" dumptraffic="false" version="1.0">
<clients>
<client host="localhost" weight="2" maxusers="10000" use_controller_vm="true">
</client>
</clients>
<servers>
<server host="192.168.1.1" port="5222" type="tcp"></server>
</servers>
<load>
<arrivalphase phase="1" duration="1" unit="hour">
<users arrivalrate="100" unit="second"></users>
</arrivalphase>
</load>
<options>
<option type="ts_jabber" name="domain" value="example.org"></option>
<!-- If we want to use the automatic username/password generation:-->
<option type="ts_jabber" name="userid_max" value="10000"></option>
<option type="ts_jabber" name="username" value="user"></option>
<option type="ts_jabber" name="passwd" value="pass"></option>
<!-- Here we are using username /password from CSV files-->
<!--
<option type="ts_jabber" name="userid_max" value="0" />
<option type="ts_jabber" name="random_from_fileid" value='userdb'/>
<option type="ts_jabber" name="offline_from_fileid" value='userdb'/>
<option type="ts_jabber" name="fileid_delimiter" value=","/>
<option name="file_server" id="userdb" value="/home/nniclaus/.tsung/usernames.csv"/>
-->
</options>
<sessions>
<session bidi="true" probability="100" name="jabber-example" type="ts_jabber">
<!--
<setdynvars sourcetype="file" fileid="userdb" delimiter="," order="iter">
<var name="username"/>
<var name="password"/>
</setdynvars>
-->
<!-- first connect: we need to set username /password here if using values from CSV
<request subst="true"><jabber type="connect" ack="local"><xmpp_authenticate username="%%_username%%" passwd="%%_password%%"/></jabber></request>
-->
<transaction name="connect">
<request> <jabber type="connect" ack="local" /> </request>
<thinktime value="2"></thinktime>
<request> <jabber type="starttls" ack="bidi_ack" /> </request>
<request> <jabber type="connect" ack="local" /> </request>
</transaction>
<thinktime value="2"></thinktime>
<!--
<transaction name="authenticate">
<request> <jabber type="auth_get" ack="local"></jabber> </request>
<request> <jabber type="auth_set_plain" ack="local"></jabber> </request>
</transaction>
-->
<transaction name="authenticate">
<request> <jabber type="auth_sasl" ack="local"></jabber></request>
<request> <jabber type="connect" ack="local"></jabber> </request>
<request> <jabber type="auth_sasl_bind" ack="local" ></jabber></request>
<request> <jabber type="auth_sasl_session" ack="local" ></jabber></request>
</transaction>
<transaction name="roster_get">
<request> <jabber type="iq:roster:get" ack="local"/> </request>
</transaction>
<request> <jabber type="presence:initial" ack="no_ack"/> </request>
<!-- Whitespace ping each 60 seconds mimic common client behaviour
and prevent connection to be closed by intermediates-->
<for from="1" to="28" incr="1" var="counter">
<request> <jabber type="raw" ack="no_ack" data="
"/></request>
<thinktime value="60" random="false"/>
</for>
<for from="1" to="30" incr="1" var="counter">
<request> <jabber type="raw" ack="no_ack" data="
"/></request>
<thinktime value="60" random="false"/>
</for>
<transaction name="close">
<request> <jabber type="close" ack="no_ack"/> </request>
</transaction>
</session>
</sessions>
</tsung>

102
contrib/tsung/tsung.xml Normal file
View File

@ -0,0 +1,102 @@
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/home/nniclaus/share/tsung/tsung-1.0.dtd" [] >
<tsung loglevel="notice" dumptraffic="false" version="1.0">
<clients>
<client host="localhost" weight="2" maxusers="2000" use_controller_vm="true">
</client>
</clients>
<servers>
<server host="192.168.1.1" port="5222" type="tcp"></server>
</servers>
<load>
<arrivalphase phase="1" duration="1" unit="hour">
<users arrivalrate="1000" unit="second"></users>
</arrivalphase>
</load>
<options>
<option type="ts_jabber" name="domain" value="example.org"></option>
<!-- If we want to use the automatic username/password generation:-->
<option type="ts_jabber" name="userid_max" value="10000"></option>
<option type="ts_jabber" name="username" value="user"></option>
<option type="ts_jabber" name="passwd" value="pass"></option>
<!-- Here we are using username /password from CSV files-->
<!--
<option type="ts_jabber" name="userid_max" value="0" />
<option type="ts_jabber" name="random_from_fileid" value='userdb'/>
<option type="ts_jabber" name="offline_from_fileid" value='userdb'/>
<option type="ts_jabber" name="fileid_delimiter" value=","/>
<option name="file_server" id="userdb" value="/home/nniclaus/.tsung/usernames.csv"/>
-->
</options>
<sessions>
<session bidi="true" probability="100" name="jabber-example" type="ts_jabber">
<!--
<setdynvars sourcetype="file" fileid="userdb" delimiter="," order="iter">
<var name="username"/>
<var name="password"/>
</setdynvars>
-->
<!-- first connect: we need to set username /password here if using values from CSV
<request subst="true"><jabber type="connect" ack="local"><xmpp_authenticate username="%%_username%%" passwd="%%_password%%"/></jabber></request>
-->
<thinktime value="2"></thinktime>
<request> <jabber type="connect" ack="local" /> </request>
<thinktime value="2"></thinktime>
<!--
<transaction name="authenticate">
<request> <jabber type="auth_get" ack="local"></jabber> </request>
<request> <jabber type="auth_set_plain" ack="local"></jabber> </request>
</transaction>
-->
<transaction name="authenticate">
<request> <jabber type="auth_sasl" ack="local"></jabber></request>
<request> <jabber type="connect" ack="local"></jabber> </request>
<request> <jabber type="auth_sasl_bind" ack="local" ></jabber></request>
<request> <jabber type="auth_sasl_session" ack="local" ></jabber></request>
</transaction>
<transaction name="roster_get">
<request> <jabber type="iq:roster:get" ack="local"/> </request>
</transaction>
<request> <jabber type="presence:initial" ack="no_ack"/> </request>
<!-- Whitespace ping each 60 seconds mimic common client behaviour
and prevent connection to be closed by intermediates-->
<for from="1" to="28" incr="1" var="counter">
<request> <jabber type="raw" ack="no_ack" data="
"/></request>
<thinktime value="60" random="false"/>
</for>
<for from="1" to="30" incr="1" var="counter">
<request> <jabber type="raw" ack="no_ack" data="
"/></request>
<thinktime value="60" random="false"/>
</for>
<transaction name="close">
<request> <jabber type="close" ack="no_ack"/> </request>
</transaction>
</session>
</sessions>
</tsung>