Skip to content

Conversation

@mesudip
Copy link
Owner

@mesudip mesudip commented Jan 29, 2026

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @mesudip, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Nginx proxy by integrating robust support for Docker Swarm services. It achieves this through a fundamental refactoring that introduces a generic BackendTarget abstraction, enabling the system to uniformly manage both Docker containers and Swarm services. The event processing and web server logic have been upgraded to monitor and configure Nginx dynamically for these diverse backend types, offering flexible control over Swarm integration. This expansion of capabilities allows the proxy to seamlessly operate within and adapt to Docker Swarm environments.

Highlights

  • Docker Swarm Support: The proxy now supports discovering and configuring Nginx for Docker Swarm services, alongside traditional standalone containers. This is controlled via the new DOCKER_SWARM environment variable with modes like 'ignore', 'enable', and 'strict'.
  • Generic Backend Abstraction: A new BackendTarget class has been introduced to provide a unified representation for both Docker containers and Swarm services, simplifying backend management and configuration logic across the application.
  • Enhanced Event Listening: The DockerEventListener has been refactored to use threading, allowing it to concurrently monitor events from both the local Docker daemon and a potentially remote Docker Swarm manager. It now specifically processes Swarm service lifecycle events.
  • Dual Docker Client Initialization: The application can now initialize and manage connections to two Docker clients: one for local containers and another for a remote Swarm manager, configurable via SWARM_DOCKER_HOST.
  • Comprehensive Testing: Extensive unit and integration tests have been added and updated to validate the new Swarm functionality, ensuring correct routing, lifecycle management, and compatibility across different Swarm modes and backend types.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces significant new functionality by adding support for Docker Swarm. The core of this change is a well-executed refactoring that abstracts away from Docker containers into a more generic BackendTarget, which can represent either a container or a Swarm service. This abstraction is consistently applied across the codebase. The DockerEventListener has been enhanced to use threading, allowing it to monitor events from both a local Docker daemon and a remote Swarm manager simultaneously, which is a robust solution. Furthermore, the test suite has been substantially improved and expanded to validate the new Swarm integration modes and backend types, which is commendable. My review includes a few suggestions to fix minor typos, improve exception handling, and adhere to Python best practices, which will enhance the overall quality and robustness of the code.

def get_container_env_map(container: DockerContainer):
container_env = container.attrs["Config"]["Env"]
env_list = [x.split("=", 1) for x in container_env] if container_env else []
return {x[0]: x[1] for x in env_list if len(x) == 2}

Choose a reason for hiding this comment

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

medium

The value of the environment variable is not being stripped of whitespace. This could lead to unexpected behavior if environment variables have leading or trailing spaces. The previous implementation in Container.py included .strip(), and it would be good to retain that behavior for consistency and robustness.

Suggested change
return {x[0]: x[1] for x in env_list if len(x) == 2}
return {x[0]: x[1].strip() for x in env_list if len(x) == 2}

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 73.13567% with 299 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.24%. Comparing base (8e99f8c) to head (d31f38b).
⚠️ Report is 10 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
nginx_proxy/WebServer.py 45.88% 37 Missing and 9 partials ⚠️
nginx_proxy/SSL.py 19.60% 38 Missing and 3 partials ⚠️
tests/helpers/docker_test_client.py 23.07% 40 Missing ⚠️
tests/helpers/integration_helpers.py 52.85% 23 Missing and 10 partials ⚠️
nginx_proxy/DockerEventListener.py 62.66% 17 Missing and 11 partials ⚠️
nginx_proxy/NginxProxyApp.py 51.72% 25 Missing and 3 partials ⚠️
tests/integration/conftest.py 66.17% 15 Missing and 8 partials ⚠️
..._proxy/post_processors/sticky_session_processor.py 60.71% 9 Missing and 2 partials ⚠️
...inx_proxy/pre_processors/virtual_host_processor.py 67.64% 6 Missing and 5 partials ⚠️
nginx_proxy/BackendTarget.py 88.00% 7 Missing and 2 partials ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
+ Coverage   69.76%   71.24%   +1.47%     
==========================================
  Files          39       45       +6     
  Lines        3165     3884     +719     
  Branches      406      496      +90     
==========================================
+ Hits         2208     2767     +559     
- Misses        820      945     +125     
- Partials      137      172      +35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mesudip mesudip force-pushed the feat/docker-swarm-support branch from 598b1c4 to d1b4035 Compare January 31, 2026 15:22
@mesudip mesudip merged commit d93fa89 into master Jan 31, 2026
7 checks passed
@mesudip mesudip deleted the feat/docker-swarm-support branch January 31, 2026 19:45
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.

2 participants