Repository navigation
Docker: run community and business side by side - #335
Draft
ericholscher wants to merge 7 commits into
Draft
ericholscher wants to merge 7 commits into
ericholscher wants to merge 7 commits into
Conversation
Make every host port configurable with RTDDEV_PORT_* variables (defaults unchanged), and add an opt-in front proxy (inv docker.front) that owns port 80 and routes *.devthedocs.com to business and everything else to community.
The community NGINX routes *.devthedocs.com to business instead (readthedocs/readthedocs.org#13365).
Both environments mount the same side-by-side template, so whichever one owns port 80 forwards the other one's domains to it.
A file mount inside the bind-mounted templates directory makes Docker create an empty mountpoint file in the repository.
Only NGINX is published on the host now. It serves webpack, addons, storage (API and console) and Elasticsearch on assets., addons., storage., storage-console. and search.<domain>, so the side-by-side forward covers them too and only RTDDEV_PORT_NGINX is needed.
…irect Pass the Host header to storage so SigV4 clients work, and send / on the storage console to /rustfs/console/.
inv docker.up and docker.compose publish NGINX on port 80, unless another container already publishes it: then they use the environment's side-by-side port, so the second environment needs no configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Lets the community and business local environments run at the same time. Before, both published NGINX on port 80 plus webpack (10001), addons (8000), storage (9000/9001) and Elasticsearch (9200), so only one could run.
dockerfiles/nginx/services.conf.templateserves the other services by hostname:assets.,addons.,storage.,storage-console.andsearch.$NGINX_WEB_SERVER_NAME. All of them are HTTP, so hostname routing on port 80 covers them, and no HAProxy/TCP layer is needed. Upstreams resolve per request (resolver+ variable), because those containers may start after NGINX or not at all (--no-search).dockerfiles/nginx/side-by-side.conf.templateforwards the other environment's domains to its NGINX throughhost.docker.internal, including websockets. Whichever environment owns port 80 does the forwarding, so start order doesn't matter. Every URL stays the same, so CAS/private docs on business keep working.inv docker.up(anddocker.compose) publish NGINX on port 80 unless another container already publishes it (docker ps --filter publish=80, which matches the host port). Then they use the environment's side-by-side port: 10080 for community, 10081 for business. Our own NGINX doesn't count, so re-runningupdoesn't move it, and once the other environment stops, the nextuptakes port 80 back.RTDDEV_PORT_NGINXoverrides it. Compose can't share a single NGINX container across two projects: a sharedcontainer_namefails with a name conflict.common/dockerfiles/nginxis mounted at/etc/common/dockerfiles/nginx, and each repo symlinks the templates from its owndockerfiles/nginx/. A file mount nested inside the bind-mounted templates directory doesn't work: Docker Desktop fails to start the container, and Docker leaves an empty mountpoint file in the repository.Host, because S3 clients (SigV4, and the RustFS console, which calls the APIs on its own origin) sign it.Breaking for local workflows:
localhost:9000/9001/9200/10001/8000no longer answer. Use the hostnames above.Companion PRs: readthedocs/readthedocs.org#13365 (settings, community defaults, docs) and readthedocs/readthedocs-corporate#2158 (business defaults).
I tested with both environments running from these branches, in both orders. The dashboards, docs and .com private docs (CAS) load for both. The other checks all passed on both domains:
storage.devthedocs.com(204)🤖 Generated with Claude Code