quick-jibri-installer/mode/grid/selenium-grid-docker.sh

172 lines
5.1 KiB
Bash
Raw Permalink Normal View History

2020-12-15 14:46:52 +00:00
#!/bin/bash
# Custom Selenium Grid-Node fro Jitsi Meet
2020-12-20 06:40:03 +00:00
# Pandian © - https://community.jitsi.org/u/Pandian
# SwITNet Ltd © - 2022, https://switnet.net/
2020-12-15 14:46:52 +00:00
# GPLv3 or later.
while getopts m: option
do
case "${option}"
in
m) MODE=${OPTARG};;
\?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;;
esac
done
#DEBUG
if [ "$MODE" = "debug" ]; then
set -x
fi
2020-12-15 14:46:52 +00:00
#Check if user is root
if ! [ "$(id -u)" = 0 ]; then
2020-12-15 14:46:52 +00:00
echo "You need to be root or have sudo privileges!"
exit 0
fi
WAN_IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
AV_SPACE="$(df -h .|grep -v File|awk '{print$4}'|sed -e 's|G||')"
2020-12-17 12:47:10 +00:00
echo -e "\n-- Make sure you have at least 10GB of disk space available.\n"
if [ "$(echo "$AV_SPACE > 9" | bc)" -ne 0 ]; then
2020-12-15 14:46:52 +00:00
echo "> Seems we have enough disk space."
else
echo "> Please meet the minimum required disk space for this installer, exiting..."
exit
fi
apt-get update
2020-12-15 14:46:52 +00:00
apt-get dist-upgrade -y
apt-get install -y \
gnupg \
bmon \
curl \
wget \
unzip \
maven \
openjdk-11-jdk
# Docker
2020-12-15 14:46:52 +00:00
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
## Docker Compose
curl -sL "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2020-12-15 14:46:52 +00:00
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# Jitsi Meet Torture
cd /opt || exit
2020-12-15 14:46:52 +00:00
git clone https://github.com/jitsi/jitsi-meet-torture
cd jitsi-meet-torture/ || exit
if [ -f resources/FourPeople_1280x720_30.y4m ] ; then
2022-02-08 01:30:25 +00:00
echo "FourPeople_1280x720_30.y4m exists"
2020-12-20 06:40:03 +00:00
else
2022-02-08 01:30:25 +00:00
echo "FourPeople_1280x720_30.y4m doesn't exists, getting a copy..."
wget -c https://media.xiph.org/video/derf/y4m/FourPeople_1280x720_60.y4m
mv FourPeople_1280x720_60.y4m resources/
cp resources/FourPeople_1280x720_60.y4m resources/FourPeople_1280x720_30.y4m
2020-12-20 06:40:03 +00:00
fi
2020-12-15 14:46:52 +00:00
#150 "participants" available
## Tested up to 120 with AWS c5.24xlarge
cat << SELENIUM_GRID_DOCKER > selenium.yml
version: "3"
services:
selenium-hub:
image: selenium/hub:3.141.59-20200525
container_name: selenium-hub
ports:
- "4444:4444"
restart: always
2020-12-15 14:46:52 +00:00
chrome:
image: selenium/node-chrome:3.141.59-20200525
volumes:
- /dev/shm:/dev/shm
- ./resources:/usr/share/jitsi-meet-torture/resources
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
- NODE_MAX_INSTANCES=30
- NODE_MAX_SESSION=30
restart: always
2020-12-15 14:46:52 +00:00
chrome2:
image: selenium/node-chrome:3.141.59-20200525
volumes:
- /dev/shm:/dev/shm
- ./resources:/usr/share/jitsi-meet-torture/resources
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
- NODE_MAX_INSTANCES=30
- NODE_MAX_SESSION=30
restart: always
2020-12-15 14:46:52 +00:00
chrome3:
image: selenium/node-chrome:3.141.59-20200525
volumes:
- /dev/shm:/dev/shm
- ./resources:/usr/share/jitsi-meet-torture/resources
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
- NODE_MAX_INSTANCES=30
- NODE_MAX_SESSION=30
restart: always
2020-12-15 14:46:52 +00:00
chrome4:
image: selenium/node-chrome:3.141.59-20200525
volumes:
- /dev/shm:/dev/shm
- ./resources:/usr/share/jitsi-meet-torture/resources
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
- NODE_MAX_INSTANCES=30
- NODE_MAX_SESSION=30
restart: always
2020-12-15 14:46:52 +00:00
chrome5:
image: selenium/node-chrome:3.141.59-20200525
volumes:
- /dev/shm:/dev/shm
- ./resources:/usr/share/jitsi-meet-torture/resources
depends_on:
- selenium-hub
environment:
- HUB_HOST=selenium-hub
- HUB_PORT=4444
- NODE_MAX_INSTANCES=30
- NODE_MAX_SESSION=30
restart: always
2020-12-15 14:46:52 +00:00
SELENIUM_GRID_DOCKER
2020-12-16 16:28:28 +00:00
docker-compose -f selenium.yml up -d
echo -e "\n#=================== End of Seleniun Grid build ========================#\n"
2021-05-22 20:50:42 +00:00
echo -e "\nChange the values according to you test requirements using something like;\n"
2020-12-16 16:28:28 +00:00
echo "cd /opt/jitsi-meet-torture
sudo bash /opt/jitsi-meet-torture/scripts/malleus.sh \\
2020-12-15 14:46:52 +00:00
--conferences=1 \\
--participants=30 \\
--senders=2 \\
--audio-senders=1 \\
--duration=120 \\
--room-name-prefix=hamertesting \\
--hub-url=http://localhost:4444/wd/hub \\
--instance-url=https://YOUR.JITSI-MEET-INSTANCE.DOMAIN
"
echo -e "\n-- If using 'hamertesting' as prefix name you can join the room
hamertesting0, hamertesting1, hamertestingN
2020-12-16 00:54:54 +00:00
according to the 'N' number of conferences you have set to watch the test.
2020-12-15 14:46:52 +00:00
*Beware* for 120 \"participants\" to join video-muted it was necessary at least a c5.24xlarge AWS instance.
2020-12-16 00:54:54 +00:00
So start low, monitor your server resources and go from there."
2020-12-15 14:46:52 +00:00
echo -e "\n-- You can check the grid status at:
http://$WAN_IP:4444/grid/console
"