-
Notifications
You must be signed in to change notification settings - Fork 70
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
Allow bridge host and port to be specified via options #141
Conversation
Looks like tests are failing due to do the Slimer download responding with |
But presumably this breaks under cluster (hence the reason for the current implementation)
|
AFAIK, general strategy of this driver is to allow run multiple phantoms with high frequency. The only way to avoid port collisions without races was to use built-in resolver. So any attempts to allow pass port/host were rejected in the past as wrong direction. Is there any other way to detect phantom port in your docker image, may be another network utilities? I'm not experienced with docker. PS. Don't pay attention to slimerjs problem. |
Yeah the option is a possibility but there MUST be a way to detect the port in docker images. Even if it's a direct probe of /proc or something.
|
That's true. The window between random port detection and starting the phantom instance is pretty small, but yes, there is a chance for overlap there. However, the user has to opt in to the problem (like I have), as the default method of letting everything start up and then detecting the port hasn't changed. This PR simply introduces the option.
I probably have less experience than you do, most of my Docker info was coming from people who were more experienced, and they weren't aware of a workaround for querying the process. I don't know if |
@w33ble why don't you install package with one of those utility to your docker image? |
Any feedback? I tend to reject. |
I recently ran in to an issue in Docker (like several other people have, based on what I've seen) where
netstat
andss
don't actually return the port used, andnode-phantom-simple
falls apart. We found that privileged containers worked fine, but we needed to run unprivileged containers.Of course there have been several issues here related to netstat/ss for port detection based on pid.
Long story short, the problem doesn't actually seem to be with Phantom, but instead with the bridge.
We discovered that this library was binding the bridge server to port 0, and that there was already code to handle the port not being 0. So I tried passing the port into the bridge using the argument passthrough in the phantom cli and everything worked as expected in our unprivileged containers.
This doesn't change the default operation of
node-phantom-simple
, it simply allows users to pass in thebridge.host
andbridge.post
as options indriver.create()
.I don't know if this will solve all of the port problems for others as well, and I'll admit that I only tested this with Phantom 1.9.8, but I haven't run in to any issues specifying my own port yet. I included the host, but I'm not sure there's a need to, the port was all that seemed important here. I would also be open to flattening the options to something like
bridgeHost
andbridgePost
, or whatever you'd prefer.This seems really useful in upstream here, and I'm happy to update this PR as you see fit.