Skip to content
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

chore(protocol-designer): forward dev docker port #17270

Closed
wants to merge 1 commit into from

Conversation

anuwrag
Copy link
Contributor

@anuwrag anuwrag commented Jan 14, 2025

Added support to allow docker container forward to the host system.

Overview

Test Plan and Hands on Testing

Changelog

Review requests

Risk assessment

Added support to allow docker container forward to the host system.
@anuwrag anuwrag requested a review from a team as a code owner January 14, 2025 21:01
@@ -47,10 +47,13 @@ benchmarks:
node ../scripts/runBenchmarks "./benchmarks/*.js" | \
ntee "./benchmarks/output/$(benchmark_output)"

dev_port ?= 5178
Copy link
Contributor

@koji koji Jan 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pd specifies the port number in vite.config so don't need to specify the port number in Makefile.

      server: {
        port: 5178
      }

@@ -47,10 +47,13 @@ benchmarks:
node ../scripts/runBenchmarks "./benchmarks/*.js" | \
ntee "./benchmarks/output/$(benchmark_output)"

dev_port ?= 5178
dev_host ?= 0.0.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason that you want to specify the host?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

host IP set to 0.0.0.0 allows to expose port in docker container.
Please discard the request if it will cause a conflict.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you are trying to do, but localhost should work for Docker.
We don't maintained Dockerfile regularly, but that is available.
https://github.com/Opentrons/opentrons/blob/edge/Dockerfile

Copy link
Contributor

@SyntaxColoring SyntaxColoring Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't use Docker much so I'm not sure, but off the top of my head, I agree with Koji. Localhost feels like it should work, and if it doesn't work, that feels like something that can be fixed in the Docker config.

The reason I'm wary of just setting this to 0.0.0.0 to get it to work is that it'll expose the server to the network, which doesn't seem like good default behavior from a security perspective. Especially not for robot-server (in the other PR), which unfortunately grants clients arbitrary code execution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when this is being run in a docker container, it does need to accept connections from outside because outside means "outside the docker container". it's a reasonable need, so let's keep the variable. however, @anuwrag the default value should be localhost or 127.0.0.1.

@sfoster1 sfoster1 changed the title Update Makefile chore(protocol-designer): forward dev docker port Jan 15, 2025
@@ -47,10 +47,13 @@ benchmarks:
node ../scripts/runBenchmarks "./benchmarks/*.js" | \
ntee "./benchmarks/output/$(benchmark_output)"

dev_port ?= 5178
dev_host ?= 0.0.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when this is being run in a docker container, it does need to accept connections from outside because outside means "outside the docker container". it's a reasonable need, so let's keep the variable. however, @anuwrag the default value should be localhost or 127.0.0.1.

@anuwrag anuwrag closed this Jan 22, 2025
@anuwrag
Copy link
Contributor Author

anuwrag commented Jan 22, 2025

The 127.0.0.1 doesn't directly work with port forwarding on Docker and I could only get 0.0.0.0 working.
However, a better way is to let a Dockerfile locally create forwarding option while creating an image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants