Skip to content

Instantly share code, notes, and snippets.

@alexgandy
Last active December 15, 2015 03:49
Show Gist options
  • Save alexgandy/5196693 to your computer and use it in GitHub Desktop.
Save alexgandy/5196693 to your computer and use it in GitHub Desktop.
Jenkins (Selenium) Setup Script
#!/bin/bash
# Copied from Art.sy : http://artsy.github.com/blog/2012/07/10/on-demand-jenkins-slaves-with-amazon-ec2/
# Set logrotate to keep only one unit (day or week) of each log
for f in /etc/logrotate.d/* /etc/logrotate.conf ; do
sed -i 's/rotate [0-9]*$/rotate 1/' $f
done
# Get selenium standalone
getsrc(){
( cd $2 > /dev/null ; wget $1 ; )
}
mkdir /var/local/bin
getsrc http://selenium.googlecode.com/files/selenium-server-standalone-2.31.0.jar /var/local/bin
echo -e "[google-chrome]\nname=google-chrome - 64-bit\nbaseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub" > /etc/yum.repos.d/google-chrome.repo
sudo yum -y install xorg-x11-server-Xvfb google-chrome-stable
echo "export DISPLAY=:12" >> ~/.bash_profile
source ~/.bash_profile
xvfb-run java -jar /var/local/bin/selenium-server-standalone-2.31.0.jar -role node -hub http://jenkins.6fusion.lab:4444/grid/register -browser browserName=firefox,maxInstances=5,platform=LINUX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment