-
Notifications
You must be signed in to change notification settings - Fork 4
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
Enable MITM proxy for requestor probes #535
Conversation
8f4c6e0
to
92f41c4
Compare
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.
The logic looks good! I'd insist on performing some of the cleaning I mentioned.
@@ -13,7 +13,7 @@ services: | |||
# harness on the host machine | |||
image: proxy-nginx | |||
ports: | |||
- "6000:6000" | |||
- "16000-16100:6000-6100" |
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.
Perhaps it would be a good idea to add a short comment about why this port mapping is necessary here.
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.
Done (318fb5f)
goth/runner/__init__.py
Outdated
nginx_containers = [ | ||
info.address | ||
for name, info in self._container_info.items() | ||
if "nginx" in name |
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'd change this to use the exact name as defined in the default compose file, that is: proxy-nginx
. In theory, the compose file may be modified by the user (it's part of the default assets) and it could define another nginx*
container.
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.
Done (318fb5f)
@@ -106,7 +119,12 @@ async def start_network(self, log_dir: Path, force_build: bool = False) -> None: | |||
|
|||
self._start_log_monitors(log_dir) | |||
await self._wait_for_containers() | |||
self._log_running_containers() |
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 safely remove this function.
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.
Done (318fb5f)
async def start_network(self, log_dir: Path, force_build: bool = False) -> None: | ||
async def start_network( | ||
self, log_dir: Path, force_build: bool = False | ||
) -> Dict[str, ContainerInfo]: | ||
"""Start the compose network based on this manager's compose file. | ||
|
||
This step may include (re)building the network's docker images. |
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 mention the newly-added return value here.
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.
Done (318fb5f)
goth/runner/probe/__init__.py
Outdated
@@ -225,6 +238,22 @@ async def _start_container(self) -> None: | |||
) | |||
self._logger.info("IP address: %s", self.ip_address) |
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.
With the below log lines added I think we can remove this one.
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.
Done (318fb5f)
Apply suggestions from code review Co-authored-by: Kuba Mazurek <[email protected]>
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.
Resolves #429
This was meant to be a small PR that adds
use_proxy = True
to the specification of the requestor node in the default goth config file and checks that the communication between the requestor agent (running on Docker host) and the requestor daemon passes through the MITM proxy.Changes:
Ports 6000-6100 on
proxy-nginx
are mapped to ports 16000-16100 on the host. This is to make ports 6000-6100 onproxy-nginx
reachable via localhost (127.0.0.1
) and is important for some non-Linux systems, where the Docker compose network is not reachable directly. On such a system, an agent running on Docker host may reach the daemon by sending a request to an address such as127.0.0.1:16001
. Such request is then forwarded toproxy-nginx:6001
in the Docker network (according to port mapping defined indocker-compose.yml
) and then to the MITM proxy (bynginx
).ComposeNetworkManager.start_network()
andrun_compose_network()
context manager return a dictionary with information on the containers started by Docker compose. This information is stored by the Runner and is used to determine the address of theproxy-nginx
container. This is not really needed, since thanks to port mapping defined in 1., ports onproxy-nginx
assigned to specific daemons are mapped to ports on the Docker host.Using proxy is turned on for Market API. For some reason, it was turned off, even if calls to Activity API and to Payment API were made through proxy.