chore: remove etcd in favor of redis#162
chore: remove etcd in favor of redis#162jcabrero merged 18 commits intochore/refactor_removed_useless_containersfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the system from using etcd to Redis for model service discovery. The change affects the underlying storage mechanism for model registration and discovery while maintaining the same API surface.
- Replaced etcd3gw client with redis.asyncio for all model discovery operations
- Updated configuration to use Redis connection parameters instead of etcd parameters
- Modified Docker Compose files to use Redis container dependencies instead of etcd
Reviewed Changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/nilai-common/src/nilai_common/discovery.py | Core migration from etcd to Redis with async/await pattern |
| packages/nilai-common/pyproject.toml | Updated dependency from etcd3gw to redis |
| tests/unit/nilai-common/test_discovery.py | Comprehensive test rewrite using Redis test containers |
| tests/unit/nilai-common/conftest.py | Added Redis test container fixtures |
| nilai-api/src/nilai_api/state.py | Added async initialization for discovery service |
| nilai-api/src/nilai_api/config/* | Updated configuration models from etcd to discovery |
| docker-compose*.yml | Updated all compose files to depend on redis instead of etcd |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| discovery_host=str(os.getenv("ETCD_HOST", "localhost")), | ||
| discovery_port=int( | ||
| os.getenv("ETCD_PORT", 6379) | ||
| ), # Redis port (changed from etcd's 2379) |
There was a problem hiding this comment.
The environment variable names still reference ETCD_HOST and ETCD_PORT despite migrating to Redis. Consider renaming these to DISCOVERY_HOST and DISCOVERY_PORT for consistency and to avoid confusion.
| discovery_host=str(os.getenv("ETCD_HOST", "localhost")), | |
| discovery_port=int( | |
| os.getenv("ETCD_PORT", 6379) | |
| ), # Redis port (changed from etcd's 2379) | |
| discovery_host=str(os.getenv("DISCOVERY_HOST", "localhost")), | |
| discovery_port=int( | |
| os.getenv("DISCOVERY_PORT", 6379) | |
| ), # Redis port |
| @property | ||
| async def client(self) -> redis.Redis: |
| if self._client is None: | ||
| # This should never happen | ||
| raise ValueError("Redis client must be initialized") |
There was a problem hiding this comment.
The double check for self._client is None is redundant since initialize() should always set self._client. The second check could be replaced with an assertion or removed entirely.
| if self._client is None: | |
| # This should never happen | |
| raise ValueError("Redis client must be initialized") | |
| assert self._client is not None, "Redis client must be initialized after initialize()" |
| ETCD_HOST: redis | ||
| ETCD_PORT: "6379" |
There was a problem hiding this comment.
Environment variable names ETCD_HOST and ETCD_PORT are misleading after migrating to Redis. These should be updated to DISCOVERY_HOST and DISCOVERY_PORT to match the new architecture.
| ETCD_HOST: redis | |
| ETCD_PORT: "6379" | |
| DISCOVERY_HOST: redis | |
| DISCOVERY_PORT: "6379" |
f142e44 to
a27de4e
Compare
6fab064 to
412f630
Compare
a27de4e to
0845ac2
Compare
700c26a to
f122282
Compare
* feat: added improved database structure and logging * feat: updated nilauth-credit image hash * feat: unit test corrections * fix: pytests unit and e2e errors * fix: improved and fixed gpt oss CI docker compose file * fix: e2e fixes for responses endpoints * fix: nildb commands
…o_tests chore: add native client to tests
a749349
into
chore/refactor_removed_useless_containers
No description provided.