-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker image #48
Docker image #48
Conversation
tar -xf node.tar.gz && \ | ||
mv node-v* node | ||
ENV PATH="/usr/share/heartbeat/.node/node/bin:$PATH" | ||
RUN npm i -g playwright |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might have to find a way to skip firefox, webkit installation. take up memory and time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vigneshshanmugam I tried installing the playwright-chromium
package, which does exactly that, but it caused weird issues, and running our stuff still asked for playwright
. Something to figure out before GA for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two options i see from this thread - microsoft/playwright#823
If we are going via playwright-chromium
, then we have to use the playwright-core
in our code to avoid downloading multiple times.
There is also a programmatic way of downloading browsers.
const {chromium} = require('playwright');
chromium. downloadBrowserIfNeeded()
We could do this in post-install script of our library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets solve in separate PR.
Dockerfile
Outdated
ENV PATH="/usr/share/heartbeat/.node/node/bin:$PATH" | ||
RUN npm i -g playwright | ||
COPY elastic-synthetics*.tgz /opt/elastic-synthetics.tgz | ||
RUN npm install -g /opt/elastic-synthetics.tgz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any specific reason for using packed file vs directly installing our package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively we can copy /src
into the image and install the dependencies during the docker build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I tried doing exactly that, which I realize is more standard, but I hit some weird error during the build IIRC, this worked reliably
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think, we have to copy /dist not source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I remember what the problem is now. Running npm i /path/to/repo
doesn't actually 'install' the package, it really just links it. For some reason on the docker image this wasn't working. Doing a 'proper' pack and install made it act like other node modules.
This probably has some other advantages in that when it comes to release time I assume we'll actually run the npm packed version instead of direct from source, so this makes it more similar. That said, IMHO both methods are fine.
USER root | ||
RUN yum -y update && \ | ||
yum -y install epel-release && \ | ||
yum -y localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this for ffmpeg
, but I need to see if we really need this, since it's not on the official package list playwright recommends for centos.
@@ -0,0 +1,24 @@ | |||
FROM docker.elastic.co/beats/heartbeat:8.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be changed to version 7.10.0-SNAPSHOT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make that change on the 7.x branch when we create it
heartbeat.monitors: | ||
- type: browser | ||
id: my-monitor | ||
name: My Monitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do it separate PR as well, let's add the path which is also supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Co-authored-by: Ivan Fernandez Calvo <[email protected]>
Co-authored-by: Ivan Fernandez Calvo <[email protected]>
This requires that your system already have the docker image
docker.elastic.co/beats/heartbeat:8.0.0
, which at the moment must be created off of this branch. To build itcd x-pack/heartbeat && env PLATFORMS=linux/amd64 mage package
.