fix(clp-package): Restore CLP_*_PORT env vars for bundled services (fixes #2065); Separate published ports from connection ports.#2066
Conversation
…and separate published ports from connection ports (fixes y-scope#2065).
WalkthroughEnvironment variable handling for bundled and non-bundled services is updated to separate inter-container connection ports from published host ports. Non-bundled services now use CONNECT_PORT variable names, while bundled services set both host and port values to enable customization of published ports in Docker Compose. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CLP_*_PORT env vars for bundled services …CLP_*_PORT env vars for bundled services and separate published ports from connection ports (fixes #2065).
CLP_*_PORT env vars for bundled services and separate published ports from connection ports (fixes #2065).CLP_*_PORT env vars for bundled services; Separate published ports from connection ports (fixes #2065).
CLP_*_PORT env vars for bundled services; Separate published ports from connection ports (fixes #2065).CLP_*_PORT env vars for bundled services (fixes #2065); Separate published ports from connection ports.
hoophalab
left a comment
There was a problem hiding this comment.
LGTM.
Validations: modifying "port" fields of bundled services in clp-config.yaml exposes ports correctly.
…ixes y-scope#2065); Separate published ports from connection ports. (y-scope#2066)
Description
#1681 stopped emitting
CLP_DB_PORT,CLP_QUEUE_PORT,CLP_REDIS_PORT, andCLP_RESULTS_CACHE_PORTfor bundled services, causing Docker Compose to fall back tohardcoded defaults for the
publishedport in each service'sportssection. This makesit impossible to customize the host-side published port for bundled third-party services
(e.g., to expose the database on port 13306 instead of 3306, or to avoid port conflicts
on the host). This is the port-side analogue of #2055 (which addressed the same
regression for
CLP_*_HOSTvariables, fixed in #2056).A naive fix of simply restoring
CLP_*_PORTin the bundled branch would breakinter-container connection strings (
BROKER_URL,RESULT_BACKEND, JDBC URLs,initialize-results-cacheURI) that reference the same variables: bundled containersalways listen on their default internal ports (3306, 5672, 6379, 27017) regardless of
the user-configured published port.
docker-compose-all.yamlpublished:fields): Unchanged -- still referenceCLP_*_PORT.CLP_*_PORTtoCLP_*_CONNECT_PORTin allBROKER_URL,RESULT_BACKEND, JDBC, and MongoDB URI entries (11 occurrences acrossspider-scheduler, compression-scheduler, compression-worker, spider-compression-worker,
query-scheduler, query-worker, and results-cache-indices-creator).
This separation ensures:
CLP_*_PORTis set (custom published port),CLP_*_CONNECT_PORTisunset (defaults to standard container port in compose).
CLP_*_PORTis unset (irrelevant, service disabled),CLP_*_CONNECT_PORTis set (external service port used in connection strings).
Checklist
breaking change.
Validation performed
Tested on the actual built package (
task packageto build, thensbin/start-clp.sh).Scenario 1: Bundled mode (default config)
All services bundled (default
clp-config.yaml), no external services running.Task: Verify that the default bundled deployment starts, all services become healthy,
and compression works.
Command:
Output:
Verification --
.envnow contains bundled host and port vars:Explanation: All containers started and became healthy. The
.envnow contains bothCLP_*_HOSTandCLP_*_PORTentries for bundled services. Before this fix,CLP_*_PORTwas absent and Docker fell back to the hardcoded defaults in the compose file --
functionally the same in the default case, but now explicitly set so that users can
override them.
Task: Verify end-to-end data flow (compression) in bundled mode.
Command:
Output:
Scenario 2: Bundled mode with custom ports
All services bundled, but with non-default published ports and
host: "0.0.0.0".Task: Verify that custom ports are respected in the Docker port bindings while
inter-container connections still use default internal ports.
Config (
etc/clp-config-custom-port.yaml):Command:
Output:
Verification --
.envcontains custom port vars:Verification -- Docker port bindings use custom ports:
Explanation: All four bundled services now publish on the user-configured ports
(
13306,15672,16379,17017) instead of the defaults. Thehost_ipis0.0.0.0as configured. No
CLP_*_CONNECT_PORTvars are set, so inter-container connectionstrings (BROKER_URL, RESULT_BACKEND, JDBC, MongoDB URI) correctly fall back to the
default container-internal ports (3306, 5672, 6379, 27017).
Task: Verify end-to-end data flow (compression) with custom ports.
Command:
Output:
Scenario 3: All four services external (non-default ports)
All four services (
database,queue,redis,results_cache) unbundled and runningexternally on the Docker host with non-default ports.
Task: Start 4 external services, configure
bundled: []with non-default ports, andverify all CLP containers connect to the external services using
CLP_*_CONNECT_PORT.Setup -- start four external services on the Docker host:
(Credentials match
etc/credentials.yaml. Images match those used by CLP.)Config (
etc/clp-config-ext-all.yaml):Command:
Output:
Verification --
.envexternal connection port entries:No
CLP_*_PORTorCLP_*_HOSTentries (only relevant for bundled). No bundleddatabase/queue/redis/results-cache containers running.
Verification -- container status (no bundled 3rd-party services):
Verification -- service logs (external connections on non-default ports):
compression-workerconnected to external queue and redis on custom ports:query-schedulerconnected to external database on custom port:Task: Verify end-to-end data flow (compression) with all external services.
Command:
Output:
Explanation: All CLP services connected to external services on non-default ports
using
CLP_*_CONNECT_PORT. Compression job was submitted through external RabbitMQ(port 15672), stored metadata in external MariaDB (port 13306), used external Redis
(port 16379) for task coordination, and the results-cache-indices-creator connected to
external MongoDB (port 17017). Full data pipeline works with all four services external
on non-default ports.
Summary by CodeRabbit