How do you find chrome driver in Heroku?
$ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-chromedriver.git -a app-name
› Error: The buildpack
› https://github.com/heroku/heroku-buildpack-chromedriver.git is
› already set on your app.
Chromedriver cannot be found in heroku app.
heroku run bash -a app-name
which chromedriver
Google driver cannot be found by searching file name as well.
$ find . -name *driver
./client/node_modules/node-sass/src/libsass/script/tap-driver
./client/node_modules/sockjs-client/lib/transport/driver
./client/node_modules/websocket-driver
./client/node_modules/websocket-driver/lib/websocket/driver
./vendor/bundle/ruby/2.6.0/gems/capybara-3.16.1/lib/capybara/driver
./vendor/bundle/ruby/2.6.0/gems/sassc-2.0.1/ext/libsass/script/tap-driver
./vendor/bundle/ruby/2.6.0/gems/selenium-webdriver-3.8.0/lib/selenium/webdriver
./vendor/bundle/ruby/2.6.0/gems/websocket-driver-0.7.0/lib/websocket/driver
./vendor/bundle/ruby/2.6.0/gems/websocket-driver-0.7.0/ext/websocket-driver
Related
It is possible to run Google-chrome not Chromium with puppeteer in AWS Lambda with container?
Script stuck when I create new page in browser:
const page = await browser.newPage();
Logs from AWS lambda:
mkdir: cannot create directory ‘/.local’: Read-only file system
touch: cannot touch ‘/.local/share/applications/mimeapps.list’: No such file or directory
/usr/bin/google-chrome-stable: line 45: /dev/fd/62: No such file or directory
/usr/bin/google-chrome-stable: line 46: /dev/fd/62: No such file or directory
[0213/000419.523205:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0213/000419.528197:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0213/000419.648505:WARNING:audio_manager_linux.cc(60)] Falling back to ALSA for audio output. PulseAudio is not available or could not be initialized.
DevTools listening on ws://127.0.0.1:46195/devtools/browser/1d348770-1c99-48a5-934c-fae5254fc766
[0213/000419.769218:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
prctl(PR_SET_NO_NEW_PRIVS) failed
prctl(PR_SET_NO_NEW_PRIVS) failed
I do not use puppeteer but that doesn't matter much.
FROM public.ecr.aws/lambda/provided:al2
RUN yum install unzip atk at-spi2-atk gtk3 cups-libs pango libdrm \
libXcomposite libXcursor libXdamage libXext libXtst libXt \
libXrandr libXScrnSaver alsa-lib \
xorg-x11-server-Xvfb wget shadow-utils -y
COPY install-chrome.sh /tmp/
RUN /usr/bin/bash /tmp/install-chrome.sh
ENV DBUS_SESSION_BUS_ADDRESS="/dev/null"
I am not 100% DBUS_SESSION_BUS_ADDRESS is necessary. I am also not 100% sure whether explicitly naming all these packages are necessary, I stole everything from a dozen different places, likely the chrome rpm will pull in what it needs, but I never used any RHEL based system so I am totally clueless. I know this works. Optimizations are welcome.
Here's the script:
#!/usr/bin/bash
# Download and install chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
# Without -y it doesn't run because it needs to add dependencies.
yum install -y google-chrome-stable_current_x86_64.rpm
rm google-chrome-stable_current_x86_64.rpm
CHROMEVERSION=`wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/$CHROMEVERSION/chromedriver_linux64.zip
unzip /tmp/chromedriver_linux64.zip -d /opt
rm /tmp/chromedriver_linux64.zip
mv /opt/chromedriver /opt/chromedriver-$CHROMEVERSION
chmod 755 /opt/chromedriver-$CHROMEVERSION
ln -fs /opt/chromedriver-$CHROMEVERSION /usr/local/bin/chromedriver
# Create a user. /usr/sbin is not on $PATH.
/usr/sbin/groupadd --system chrome
/usr/sbin/useradd --system --create-home --gid chrome --groups audio,video chrome
You can verify it is working by starting it locally with docker run --mount type=tmpfs,destination=/tmp --read-only this simulates well the environment of AWS Lambda. Then you need to run su chrome -c 'xvfb-run chromedriver --allowed-ips=127.0.0.1'. I am using https://github.com/instaclick/php-webdriver/ which is a very thin PHP client for W3C and Selenium 2 webdriver. I used this to test:
<?php
namespace WebDriver;
require 'vendor/autoload.php';
#mkdir('/tmp/chrome');
chmod('/tmp/chrome', 0777);
$wd_host = 'http://localhost:9515';
$web_driver = new WebDriver($wd_host);
$session = $web_driver->session('chrome', [['goog:chromeOptions' => ['args' => [
'--no-sandbox',
'--user-data-dir=/tmp/chrome'
]]]]);
$session->open('https://google.com');
My problem is how to run google chrome in docker container for e2e testing.
I create a Dockerfile from official Jenkins image, but when try to run google chrome, it crashes and show the error:
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
Trace/breakpoint trap (core dumped)
The Jenkins docker image uses Debian jessie.
I can run google chrome with --headless flag and the X server is not needed.
This is my docker file:
https://github.com/ripper2hl/jenkinswithchrome
Jenkins official image:
https://github.com/jenkinsci/docker
The repo a person runs google chrome with GUI from docker:
https://github.com/jessfraz/dockerfiles/blob/master/chrome/stable/Dockerfile
My first approach is to use xvbf, but the process is more simple when used --headless flag.
https://gist.github.com/addyosmani/5336747
I can run chrome in Ubuntu server with the same commands for installation, but in docker it fails.
After other intents, I used --no-sandbox flag, but docker images shows the next error.
[0427/180929.595479:WARNING:audio_manager.cc(295)] Multiple instances of AudioManager detected
[0427/180929.595537:WARNING:audio_manager.cc(254)] Multiple instances of AudioManager detected
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted
Actually I ran this command:
google-chrome-stable --headless --disable-gpu --no-sandbox http://www.google.com
Just launch chrome with --no-sandbox that s resolves the problem
Using this image alpeware/chrome-headless-trunk worked for me in ubuntu!
The command used in that container to launch headless chrome is this:
/usr/bin/google-chrome-unstable \
--disable-gpu --headless --no-sandbox \
--remote-debugging-address=0.0.0.0 \
--remote-debugging-port=9222 --user-data-dir=/data
here's a short video of the container in action
I launched the container in Ubuntu with this command:
docker run -it --rm -p=0.0.0.0:9222:9222 \
--name=chrome-headless \
-v /tmp/chromedata/:/data alpeware/chrome-headless-trunk
then used Chrome to connect to the debug port at localhost:9222
With some modifications you could probably get this running in Jenkins!
Sources
https://hub.docker.com/r/alpeware/chrome-headless-trunk/
https://github.com/alpeware/chrome-headless-trunk
This article is exactly what I needed to run Karma tests with Headless Chrome inside docker:
https://hackernoon.com/running-karma-tests-with-headless-chrome-inside-docker-ae4aceb06ed3
Basically, the solution is to run Headless Chrome with the --no-sandbox flag.
We built a Docker image with Chrome and Chromedriver that runs Chrome in headless mode for automated tests. We're using this as a drop-in replacement for PhantomJS in our docker-compose.yml setups. The image is based on Alpine Linux and doesn't need or include Selenium so it's pretty small.
Source:
https://github.com/retreatguru/headless-chromedriver
Docker Hub:
https://hub.docker.com/r/retreatguru/headless-chromedriver
I don't have the answer but I know a container which successfully launch a headless Chrome in Docker. The selenium one:
Selenium Chrome Node
I use it for automated testing of my webapp in Chrome
Hope it helps
I extend default Dockerfile Selenium Chrome Node by following
FROM selenium/standalone-chrome-debug:latest
MAINTAINER Serge Arbuzov <Serge.Arbuzov#advantechwireless.com>
USER root
### jenkins set up ###
RUN apt-get update && apt-get install -y openssh-server sudo
RUN mkdir /var/run/sshd
RUN adduser jenkins
RUN echo jenkins:jenkins | chpasswd
RUN echo "jenkins ALL=(ALL) NOPASSWD:ALL">>/etc/sudoers
USER root
RUN echo export DISPLAY=":1.5" >> /etc/environment
ADD run.sh /run.sh
RUN chmod +x /run.sh
EXPOSE 22
CMD ["/run.sh"]
And my run.sh is
#!/bin/bash
Xvfb :1 -screen 5 1024x768x8 &
/usr/sbin/sshd -D
So i can use default image as Jenkins node
I am trying to install Couchbase sync gateway using the steps from the following URL for MacOS
https://developer.couchbase.com/documentation/mobile/current/installation/sync-gateway/index.html
This issue is, i downloaded "couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz" and its in "Downloads" folder in MacBook.
When I execute this command -> sudo tar -zxvf couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz --directory /opt
[MyMacbook:downloads administrator$ sudo tar -zxvf couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz --directory /opt
tar: could not chdir to '/opt']
Throws error as "tar: could not chdir to '/opt'"
I don't understand how to resolve this. I couldn't get help anywhere.
Please help installing Couchbase sync gateway successfully on MacBook.
It dosen't actually matter if /opt does not exist on your Mac. You can either create one before firing the command with the following command:
sudo mkdir /opt
Otherwise, you can replace "opt" with locations like : /Users/< your_user > or /usr/share or /var
I installed cygnus and when I hit sudo service cygnus start I get the status OK running.
But the log file says:
Warning: JAVA_HOME is not set!
+ exec /usr/bin/java -Xmx20m -Dflume.log.file=cygnus.log -cp '/usr/cygnus/conf:/usr/cygnus/lib/*:/usr/cygnus/plugins.d/cygnus/lib/*:/usr/cygnus/plugins.d/cygnus/libext/*' -Djava.library.path= es.tid.fiware.fiwareconnectors.cygnus.nodes.CygnusApplication -p 8081 -f /usr/cygnus/conf/agent_1.conf -n cygnusagent
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/cygnus/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/cygnus/plugins.d/cygnus/lib/cygnus-0.7.1-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
I checked echo $JAVA_HOME and get:
/usr/lib/jvm/java-1.6.0-openjdk.x86_64
I also checked java -version and got:
java version "1.6.0_35"
OpenJDK Runtime Environment (IcedTea6 1.13.7) (rhel-1.13.7.1.el6_6-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
So what am I missing here?
I did all these steps here:
Installing Cygnus
Open a terminal and simply configure the FIWARE repository if not yet
configured and use your applications manager in order to install the
latest version of Cy gnus (CentOS/RedHat example):
$ sudo cat > /etc/yum.repos.d/fiware.repo <http://repositories.testbed.fi-ware.eu/repo/rpm/x86_64/
gpgcheck=0 enabled=1 EOL $ sudo yum install cygnus
IMPORTANT NOTE:
Cygnus, as it is based on Apache Flume, needs Java SDK is installed.
If not yet installed, do it right now:
$ sudo yum install java-1.6.0-openjdk-devel
Remember to export the JAVA_HOME environment variable. In the case you
have installed Java SDK right now as shown above, this would be as:
$ export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk.x86_64
In order to do it permanently, edit /root/.bash_profile (root user) or
/etc/profile (other users).
Despite such a warning message, Cygus will run since the flume-ng (and derived cygnus-flume-ng) script looks for Java if JAVA_HOME is not set:
# find java
if [ -z "${JAVA_HOME}" ] ; then
warn "JAVA_HOME is not set!"
# Try to use Bigtop to autodetect JAVA_HOME if it's available
if [ -e /usr/libexec/bigtop-detect-javahome ] ; then
. /usr/libexec/bigtop-detect-javahome
elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ] ; then
. /usr/lib/bigtop-utils/bigtop-detect-javahome
fi
# Using java from path if bigtop is not installed or couldn't find it
if [ -z "${JAVA_HOME}" ] ; then
JAVA_DEFAULT=$(type -p java)
[ -n "$JAVA_DEFAULT" ] || error "Unable to find java executable. Is it in your PATH?" 1
JAVA_HOME=$(cd $(dirname $JAVA_DEFAULT)/..; pwd)
fi
fi
I have problem to deploy OpenShift Origin on Fedora 19. I'm getting error:
Preflight check: verifying system and resource availability.
Checking broker.example.com:
* SSH connection succeeded
* Target host is running non-Fedora, non-RHEL
* Located getenforce
* SELinux is running in please login as the user "fedora" rather than
the user "root". mode
* Located yum
* Located puppet
* Located augtool
* Located dnssec-keygen
* Located htpasswd
* Located scl
* ERROR: The ruby193 software collection is not installed. Correct
this by running `yum install ruby193` on this system.
* ERROR: The 'epel' repository isn't available via yum. Install /
enable this repository and try again.
That's weird:
Target host is running non-Fedora, non-RHEL
Release:
[root#broker tmp]# cat /etc/issue
Fedora release 19 (Schrödinger’s Cat)
Kernel \r on an \m (\l)
I'm not able to install ruby193 via yum. Dependency problem. Fedora 19 has ruby version 2.0.0. Log from installation of ruby193: http://pastebin.com/raw.php?i=TpJEF4Rw
So I'm using rvm:
[root#broker tmp]# ruby -v
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-linux]
[root#broker tmp]#
At the end, I'm installing Origin by:
sh <(curl -s https://install.openshift.com/)
And my configuration file: http://pastebin.com/raw.php?i=sSgYVVMt
I figured out that problem was in ssh check. I was not able to ssh to broker but installation script was facing as if ssh is OK.
Needed packages: (yum -y install) ruby unzip httpd-tools puppet augeas bind
Interesting. I solved it by adding repos and install some things:
cat <<EOF> /etc/yum.repos.d/openshift-origin-deps.repo
[openshift-origin-deps]
name=openshift-origin-deps
baseurl=http://mirror.openshift.com/pub/origin-server/release/3/fedora-19/dependencies/x86_64/
gpgcheck=0
enabled=1
EOF
cat <<EOF> /etc/yum.repos.d/openshift-origin.repo
[openshift-origin]
name=openshift-origin
baseurl=http://mirror.openshift.com/pub/origin-server/release/3/fedora-19/packages/x86_64/
gpgcheck=0
enabled=1
EOF
yum clean all
yum -y update
yum -y install ruby unzip httpd-tools puppet bind vim rubygem-openshift-origin-container-selinux</strike>
I would email this to the openshift origin users list here (https://lists.openshift.redhat.com/openshiftmm/listinfo/users) alot of the developers are on that list and should be able to help you with a solution. Then once you have one come back here and update us so that if anyone else runs into it they'll have something to reference.