Skip to content

Instantly share code, notes, and snippets.

@rafanoronha
Last active September 9, 2016 10:06
Show Gist options
  • Save rafanoronha/7828657 to your computer and use it in GitHub Desktop.
Save rafanoronha/7828657 to your computer and use it in GitHub Desktop.
Setting up a Selenium Grid across Ubuntu Server instances

Setting up a Selenium Grid across Ubuntu Server instances

Initial setup for both hub and node instances:

.

sudo apt-get install openjdk-7-jre-headless
wget https://selenium.googlecode.com/files/selenium-server-standalone-2.38.0.jar
sudo apt-get install ruby1.9.1
sudo gem install foreman

Hub setup

.

## Procfile
hub: java -jar selenium-server-standalone-2.38.0.jar -role hub

.

sudo foreman export --app myappname --user myappusername upstart /etc/init
sudo start myappname
ps -f -A | grep myappname
sudo lsof -i | grep 5555

.

Node setup

.

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo deb http://dl.google.com/linux/chrome/deb/ stable main > /etc/apt/sources.list.d/google.list'
sudo apt-get update && sudo apt-get install -y xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic xvfb x11-apps  imagemagick firefox google-chrome-stable

.

## xvfb
#!/bin/bash
if [ -z "$1" ]; then
  echo "`basename $0` {start|stop}"
  exit
fi

case "$1" in
start)
  /usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 &
;;
stop)
  killall Xvfb
;;
esac

.

## Procfile
node: java -jar selenium-server-standalone-2.38.0.jar -role node -nodeConfig config.json

.

sudo chmod +x xvfb
sudo cp xvfb /etc/init.d/
sudo update-rc.d xvfb defaults

.

sudo foreman export --app myappname --user myappusername upstart /etc/init
sudo start myappname
ps -f -A | grep myappname
sudo lsof -i | grep 5555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment