Last active
August 29, 2015 14:17
-
-
Save danaspiegel/0acf81eb246c246b59fa to your computer and use it in GitHub Desktop.
Selenium on EC2 startup script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# from http://pietervogelaar.nl/ubuntu-14-04-install-selenium-as-service-headless | |
# | |
# To setup selenium on Ubuntu, execute the following code: | |
# | |
# 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' | |
# sudo apt-get update | |
# sudo apt-get upgrade | |
# sudo apt-get --force-yet -y install openjdk-7-jre-headless google-chrome-stable chromium-chromedriver xvfb libexif12 unzip | |
# @reboot sh -c 'Xvfb :99 -ac -screen 0 1000x2000x8 > /tmp/xvfb.log 2>&1 &' | |
# curl -O http://chromedriver.storage.googleapis.com/2.13/chromedriver_linux64.zip | |
# unzip chromedriver_linux64.zip | |
# sudo mv chromedriver /usr/local/bin/chromedriver | |
# curl -O http://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar | |
# ln -s selenium-server-standalone-2.44.0.jar selenium-server-standalone.jar | |
# sudo mkdir -p /var/log/selenium | |
# sudo chmod a+w /var/log/selenium | |
# | |
# sudo sh -c 'echo "/etc/ld.so.conf.d/chrome_lib.conf" > /usr/lib/chromium-browser/libs/xvfb' | |
# sudo ldconfig | |
# | |
# To run selenium, execute this line: | |
# | |
# DISPLAY=localhost:99.0 && java -jar ~/selenium-server-standalone.jar -port 4444 -trustAllSSLCertificates -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver > /var/log/selenium/output.log 2> /var/log/selenium/error.log & echo $! > /tmp/selenium.pid | |
For more details, see: https://github.com/Tomohiro/xvfb-selenium-server | |
# | |
# Upstart script: selenium-server.conf | |
# | |
# selenium - Selenium server | |
description "Selenium server" | |
start on filesystem or runlevel [2345] | |
stop on runlevel [!2345] | |
env SELENIUM_SERVER='/usr/lib/selenium/selenium-server-standalone.jar' | |
env DISPLAY=localhost:99.0 | |
respawn | |
respawn limit 5 60 | |
exec /usr/bin/java -jar ${SELENIUM_SERVER} -port 4444 -trustAllSSLCertificates > /var/log/selenium/output.log 2> /var/log/selenium/error.log | |
# | |
# Upstart script: xvfb.conf | |
# | |
# Xvfb | |
description 'Xvfb is X virtual framebuffer' | |
start on filesystem or runlevel [2345] | |
stop on runlevel [!2345] | |
env XVFB='/usr/bin/Xvfb' | |
respawn | |
respawn limit 5 60 | |
exec ${XVFB} :99 -screen 0 1000x2000x8 -ac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment