Find traefik dev setup for HA testing #36816
Draft
+701
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR has been created via Cursor Agent Web Interface
feat: Add Traefik load balancer for host-based development
Proposed changes (including videos or screenshots)
This PR introduces a new development setup for running a Traefik Docker container that load balances multiple Rocket.Chat instances running directly on the host machine (e.g., with
yarn dev
).The existing Traefik configurations in the repository primarily support Rocket.Chat instances running within Docker containers. This new setup addresses the need for developers to:
Key features of this new setup:
network_mode: "host"
for the Traefik container, allowing it to directly access Rocket.Chat instances running onlocalhost
(e.g.,127.0.0.1:3000
,127.0.0.1:3002
). This simplifies the setup by avoiding complex Docker networking for the Rocket.Chat instances themselves.watch: true
to automatically reload routing and service configurations when changes are made toconfig/rocketchat.yml
./websocket
,/sockjs
) maintain affinity with a single backend Rocket.Chat instance./api/info
) for backend instances to ensure traffic is only routed to healthy servers.README.md
provides step-by-step instructions, architecture overview, troubleshooting, and references to official Traefik documentation.start-instances.sh
script is included to easily launch multiple Rocket.Chat instances on different ports.All new files are contained within a new directory
development/traefik-host-dev/
, ensuring no impact on existing configurations.Issue(s)
N/A
Steps to test or reproduce
cd development/traefik-host-dev
docker-compose up -d
yarn dev
(starts on port 3000 by default)PORT=3002 yarn dev
PORT=3003 yarn dev
(Alternatively, use the provided helper script:
../start-instances.sh 3
)development/traefik-host-dev/config/rocketchat.yml
and uncomment the additional server URLs (e.g.,http://127.0.0.1:3002
,http://127.0.0.1:3003
). Traefik will automatically reload.http://localhost:3000
(orhttp://rocketchat.localhost:3000
if you configured your hosts file).http://localhost:8080
(orhttp://traefik.localhost:8080
).rocketchat-server
cookie in browser developer tools).Further comments
This setup provides a valuable tool for developers to test high availability and load balancing scenarios in a flexible and efficient manner, without the overhead of containerizing their development instances. It's an optional addition that enhances the development workflow for specific testing needs. The detailed
README.md
serves as a comprehensive guide for its usage and configuration.