fix(deployment): Restore CLP_*_HOST env vars for bundled services to allow configurable port bindings (fixes #2055).#2056
Conversation
…o allow configurable port bindings (fixes y-scope#2055).
CLP_*_HOST env vars for bundled services t…CLP_*_HOST env vars for bundled services to allow configurable port bindings (fixes #2055).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
WalkthroughThe controller's database environment setup method was refactored to conditionally set service-specific environment variables based on whether services are bundled or external, ensuring CLP_DB_NAME, SPIDER_DB_NAME, and host variables are correctly populated for different deployment configurations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
hoophalab
left a comment
There was a problem hiding this comment.
LGTM.
Validations: CLP_DB_HOST is configured the same as before.
…o allow configurable port bindings (fixes y-scope#2055). (y-scope#2056)
Description
After #1681,
CLP_DB_HOST,CLP_QUEUE_HOST,CLP_REDIS_HOST, andCLP_RESULTS_CACHE_HOSTare no longer set incontroller.pyfor bundled services.docker-compose-all.yamluses these variables ashost_ipfor port bindings (e.g.,host_ip: "${CLP_DB_HOST:-127.0.0.1}"). Since they are never set for bundled services,Docker falls back to
127.0.0.1, making it impossible to expose bundled service ports onall interfaces via
host: "0.0.0.0".This fix restores the
CLP_*_HOSTenvironment variable assignments in the bundled branchof each
_set_up_env_for_*()method, using_get_ip_from_hostname()to resolve theconfigured host. When users set e.g.
database.host: "0.0.0.0",CLP_DB_HOSTis nowcorrectly set to
0.0.0.0so Docker Compose binds the published port on all interfaces.Additionally, moved the
SPIDER_DB_NAMEassignment above the bundled check (it isindependent of bundling) to allow the
elseclause to follow directly.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 vars:Explanation: All containers started and became healthy. The
.envnow containsCLP_*_HOSTentries set to127.0.0.1(the default host config), which Docker Composeuses for
host_ipport bindings. Before this fix, these variables were absent and Dockerfell back to the hardcoded
127.0.0.1default in the compose file — functionally thesame in the default case, but now explicitly set so that users can override them by
configuring
host: "0.0.0.0".Task: Verify end-to-end data flow (compression) in bundled mode.
Command:
Output:
Scenario 2: All four services external
All four services (
database,queue,redis,results_cache) unbundled and runningexternally on the Docker host.
Task: Start 4 external services using the same images as CLP, configure
bundled: [], and verify all CLP containers connect to the external services.Setup — start four external services on the Docker host:
(Credentials match
etc/credentials.yaml. Images match those used by CLP. MongoDB isstarted with
--replSet rs0and--bind_ip_all.)Config (
etc/clp-config-ext-all.yaml):Command:
Output:
Verification — container status:
No
database,queue,redis, orresults-cachecontainers — all are external.Verification —
.envexternal host entries:Explanation: Database, queue, and redis configured with
localhostresolved toDocker's
host-gatewaytoken. Results cache uses the non-loopback IP directly. NoCLP_*_HOSTentries present in external mode (correct — these are only set for bundledservices).
Task: Verify end-to-end data flow (compression) with all external services.
Command:
Output:
Explanation: Compression job was submitted through external RabbitMQ, stored metadata
in external MariaDB, used external Redis for task coordination, and
results-cache-indices-creatorsuccessfully created indices on the external MongoDB.Full data pipeline works with all four services external.
Scenario 3: Cross-host bundled access (two LXC containers, hosts=0.0.0.0)
Bundled services configured with
host: "0.0.0.0"so ports are published on allinterfaces. A second machine (LXC container) verifies remote connectivity.
Task: Verify that configuring
host: "0.0.0.0"for bundled services correctlyexposes ports on all interfaces, allowing remote access from another host.
Setup — create two Ubuntu Noble LXC containers:
Installed Docker and docker-compose-v2 in
clp-server, pushed the CLP package and allrequired Docker images (clp-package, mariadb, rabbitmq, redis, mongo). Installed
mariadb-clientandmongoshinclp-client.Config (
etc/clp-config-bind-all.yaml) in clp-server:Command (in clp-server):
Output:
Verification —
.envshows 0.0.0.0 host vars:Verification — ports bound to 0.0.0.0:
Explanation: All four bundled service ports are published on
0.0.0.0instead of thedefault
127.0.0.1. Before this fix, theCLP_*_HOSTvariables were never set forbundled services, so Docker Compose always fell back to the
127.0.0.1default in thecompose file, making it impossible to expose bundled services on all interfaces.
Verification — remote access from clp-client (10.145.61.208) to clp-server
(10.145.61.244):
Explanation: Both MariaDB and MongoDB on clp-server are accessible from clp-client,
confirming that the fix correctly propagates the
host: "0.0.0.0"config through theCLP_*_HOSTenv vars to Docker Compose'shost_ipport bindings.Summary by CodeRabbit
Release Notes