diff --git a/pandora_server/util/pwrd/README.txt b/pandora_server/util/pwrd/README.txt new file mode 100644 index 0000000000..8cdd5d2c6c --- /dev/null +++ b/pandora_server/util/pwrd/README.txt @@ -0,0 +1,14 @@ +instalar java +instalar selenium (descargar) +instalar xorg-x11-server-Xvfb +#wget ftp://rpmfind.net/linux/centos/6.6/os/x86_64/Packages/xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm +#yum install xorg-x11-server-Xvfb-1.15.0-22.el6.centos.x86_64.rpm +#Xvfb :99 -ac & +---> Pulsar Enter para continuar +#export DISPLAY=:99 +#java -jar seleniumXXX.jar + +Ya tenemos funcionando Selenium sin necesidad de X. + + + diff --git a/pandora_server/util/pwrd/firefox-43.0.tar b/pandora_server/util/pwrd/firefox-43.0.tar new file mode 100644 index 0000000000..39fb813ea0 Binary files /dev/null and b/pandora_server/util/pwrd/firefox-43.0.tar differ diff --git a/pandora_server/util/pwrd/firefox_profile.tar.gz b/pandora_server/util/pwrd/firefox_profile.tar.gz new file mode 100644 index 0000000000..15e1e4f2fc Binary files /dev/null and b/pandora_server/util/pwrd/firefox_profile.tar.gz differ diff --git a/pandora_server/util/pwrd/install_pwrd.sh b/pandora_server/util/pwrd/install_pwrd.sh new file mode 100644 index 0000000000..66cb0a9795 --- /dev/null +++ b/pandora_server/util/pwrd/install_pwrd.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +if [ "$1" == "" ] || [ "$1" != "--install" ]; then + cat<<_HELP +********************** + PWR Server installer +********************** + +To install the Pandora web robot daemon (pwrd) +Please launch this script as root: + +$0 --install + + +_HELP + exit 0 +fi + +if [ "`rpm -qa | grep xorg-x11-server-Xvfb | wc -l`" == "0" ]; then + echo "Package xorg-x11-server-Xvfb is required" + exit 0 +fi + +chmod +x pwrd + +PWR_SERVER_DEST=/usr/lib/pwr +PWR_SERVER_RSC=/etc/pwr/tmp +PWR_SERVER_LOG=/var/log/pwr +PWR_FIREFOX_INSTALLDIR=/opt + +mkdir -p $PWR_SERVER_DEST +mkdir -p $PWR_SERVER_LOG +mkdir -p $PWR_SERVER_RSC +mkdir -p $PWR_FIREFOX_INSTALLDIR + + +tar xvf firefox-43.0.tar >/dev/null +mv firefox $PWR_FIREFOX_INSTALLDIR/ + +tar xvzf firefox_profile.tar.gz >/dev/null +chown -R `whoami`. firefox_profile +mv firefox_profile $PWR_FIREFOX_INSTALLDIR + +ln -s $PWR_FIREFOX_INSTALLDIR/firefox/firefox /usr/bin/firefox + +# Generate logrotate configuration + +echo < /etc/logrotate.d/pwrd +/var/log/pwr/pwr_std.log +/var/log/pwr/pwr_error.log { + weekly + missingok + size 300000 + rotate 3 + maxage 90 + compress + notifempty + copytruncate +} + +EO_LROTATE + +cp ./selenium-server-standalone-2.53.1.jar $PWR_SERVER_DEST/ +cp ./pwrd /etc/init.d/pwrd +chmod +x /etc/init.d/pwrd + +cat </dev/null 2>&1` + if [ $? -ne 0 ]; then + echo "Xvfb not found, please install it" + if [ -e /etc/rc.d/init.d/functions ]; then + failure + echo 1 + fi + else + Xvfb :99 -ac > /dev/null 2>&1 & + export DISPLAY=:99 + ps -eo pid,cmd | grep Xvfb | grep -v grep | awk {'print $1 '} > $xvfb_pid_file + echo 0 + fi + +} + +# Stop Xvfb +function stop_xvfb() { + if test -f $xvfb_pid_file ; then + # Check if there's more instances of pwrd running i.e. standalone + node + if [ ! -e "$base_dir/pwrd_node.pid" ] && [ ! -e "$base_dir/pwrd.pid" ]; then + echo -n "Stopping Xvfb..." + PID=$(cat $xvfb_pid_file) + if [ `kill -9 $PID 2>&1 | grep "No such process" | wc -l` == "1" ]; then + # PID file exists but no process + test -f $xvfb_pid_file && rm -f $xvfb_pid_file + if [ -e /etc/rc.d/init.d/functions ]; then + success + fi + return 0 + fi + else + echo "(1) pwrd process left. Skipping Xvfb" + fi + fi +} + +################################################################################ +# START +################################################################################ + +# Start Selenium Standalone server +function start() { + if test -f $pid_file + then + PID=`cat $pid_file` + if ps --pid $PID >/dev/null; then + echo "PWRD is already running: $PID" + exit 2 + else + echo "Removing stale pid file: $pid_file" + fi + fi + + if [ "`start_xvfb`" != "0" ]; then + if [ -e /etc/rc.d/init.d/functions ]; then + failure + fi + echo "Failed... Check Xvfb" + return 1 + fi + + echo -n "Starting PWRD..." + + export DISPLAY=:99 + su $user -c "$java -jar $pwr -host $host $PWROPTS > $std_log 2>&1 &" + + if [ $? == "0" ]; then + if [ -e /etc/rc.d/init.d/functions ]; then + success + fi + echo "Success" + else + if [ -e /etc/rc.d/init.d/functions ]; then + failure + fi + echo "Failed" + fi + + # Store PID + ps -eo pid,cmd | grep $pwr | grep -v "node" | grep -v "hub" | grep -v grep | awk {'print $1 '} > $pid_file + +} + +# Start Selenium GRID server: HUB component +function start-hub() { + if test -f $pid_file + then + PID=`cat $pid_file` + if ps --pid $PID >/dev/null; then + echo "PWRD is already running: $PID" + exit 2 + else + echo "Removing stale pid file: $pid_file" + fi + fi + echo -n "Starting PWRD..." + + # No Xvfb needed in hub mode + + su $user -c "$java -jar $pwr -host $host -role hub $PWR_HUB_OPTS > $std_log 2>&1 &" + + if [ $? == "0" ]; then + if [ -e /etc/rc.d/init.d/functions ]; then + success + fi + echo "Success" + else + if [ -e /etc/rc.d/init.d/functions ]; then + failure + fi + echo "Failed" + fi + + # Store PID + ps -eo pid,cmd | grep $pwr | grep "hub" | grep -v grep | awk {'print $1 '} > $pid_file +} + +# Start Selenium GRID server: Node Connect to hub +function start-node() { + if test -f $pid_file + then + PID=`cat $pid_file` + if ps --pid $PID >/dev/null; then + echo "PWRD is already running: $PID" + exit 2 + else + echo "Removing stale pid file: $pid_file" + fi + fi + + if [ "`start_xvfb`" != "0" ]; then + if [ -e /etc/rc.d/init.d/functions ]; then + failure + fi + echo "Failed... Check Xvfb" + return 1 + fi + + echo -n "Starting PWRD..." + + export DISPLAY=:99 + su $user -c "$java -jar $pwr -host $host -role node -hub $1 $PWROPTS > $std_log 2>&1 &" + + if [ $? == "0" ]; then + if [ -e /etc/rc.d/init.d/functions ]; then + success + fi + echo "Success" + else + if [ -e /etc/rc.d/init.d/functions ]; then + failure + fi + echo "Failed" + fi + + # Store PID + ps -C java -eo pid,cmd | grep $pwr | grep "node" | grep -v grep | awk {'print $1 '} > $pid_file +} + +################################################################################ +# STOP +################################################################################ + +# Stop Selenium Standalone server +function stop() { + if test -f $pid_file ; then + echo -n "Stopping PWRD..." + PID=$(cat $pid_file) + su $user -c "kill -3 $PID" + kill -9 $PID >/dev/null 2>&1 + if [ $? -eq 0 ]; then + sleep 5 + test -f $pid_file && rm -f $pid_file + if [ -e /etc/rc.d/init.d/functions ]; then + success + fi + else + echo "PWRD could not be stopped..." + if [ -e /etc/rc.d/init.d/functions ]; then + failure + fi + echo "Failed" + fi + stop_xvfb + else + echo "PWRD is not running." + stop_xvfb + if [ -e /etc/rc.d/init.d/functions ]; then + success + fi + fi + echo +} + +################################################################################ +# STATUS +################################################################################ + +# Status of Selenium Standalone server +function status() { + if test -f $pid_file ; then + PID=`cat $pid_file` + if ps --pid $PID >/dev/null ; then + echo "PWRD is running: $PID" + if test -f $xvfb_pid_file ; then + PID=`cat $xvfb_pid_file` + if test -f $xvfb_pid_file ; then + echo "Xvfb is running: $PID" + fi + fi + else + echo "PWRD isn't running..." + fi + else + echo "PWRD isn't running..." + fi +} + +case "$1" in + start) # Standalone + pid_file=$base_dir/pwrd.pid + start + ;; + start-hub) # hub + pid_file=$base_dir/pwrd_hub.pid + start-hub + ;; + start-node) # node + pid_file=$base_dir/pwrd_node.pid + start-node $2 + ;; + stop) # standalone + pid_file=$base_dir/pwrd.pid + stop + ;; + stop-hub) # hub + pid_file=$base_dir/pwrd_hub.pid + stop + ;; + stop-node) # node + pid_file=$base_dir/pwrd_node.pid + stop + ;; + restart) # standalone + pid_file=$base_dir/pwrd.pid + stop + start + ;; + restart-hub) # hub + pid_file=$base_dir/pwrd_hub.pid + stop + start-hub + ;; + restart-node) # node + pid_file=$base_dir/pwrd_node.pid + stop + start-node $2 + ;; + status) + pid_file=$base_dir/pwrd.pid + status + ;; + status-hub) # hub + pid_file=$base_dir/pwrd_hub.pid + status + ;; + status-node) # node + pid_file=$base_dir/pwrd_node.pid + status + ;; + *) + echo "Usage: $SELF start*|stop*|restart*|status*" + echo " start* (standalone, hub or node)" + echo " start" + echo " start-hub" + echo " start-node http://hub:4444/grid/register" + echo " stop* (standalone, hub or node)" + echo " stop" + echo " stop-hub" + echo " stop-node" + echo " restart* (standalone, hub or node)" + echo " restart" + echo " restart-hub" + echo " restart-node http://hub:4444/grid/register" + echo " status* (standalone, hub or node)" + echo " status" + echo " status-hub" + echo " status-node" + exit 9 + ;; +esac + +echo FIN [$1] diff --git a/pandora_server/util/pwrd/selenium-server-standalone-2.53.1.jar b/pandora_server/util/pwrd/selenium-server-standalone-2.53.1.jar new file mode 100644 index 0000000000..5c3c4fd210 Binary files /dev/null and b/pandora_server/util/pwrd/selenium-server-standalone-2.53.1.jar differ diff --git a/pandora_server/util/pwrd/selenium_ide_2.9.1.xpi b/pandora_server/util/pwrd/selenium_ide_2.9.1.xpi new file mode 100644 index 0000000000..c93d15d840 Binary files /dev/null and b/pandora_server/util/pwrd/selenium_ide_2.9.1.xpi differ