lablup / lablup/backend.ai

[Phase 0] Add configure_only() to pyinfra deploy scripts

Open
#10,747 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

## Summary

Extract Redis sentinel vs single mode selection logic into a shared module. Currently duplicated in 3+ places across context.py and pyinfra deploy scripts.

## Current Duplication

- `context.py` lines 557-576 (manager), 739-754 (webserver), 870-871 (appproxy coordinator), 894-895 (appproxy worker)
- `pyinfra deploy/cores/manager/deploy.py` lines 185-197 (`_prepare_redis_config()`)
- Each independently checks `redis_sentinel_addrs` vs `redis_addr` and builds connection config

## Approach

Create `config_gen/redis.py` with:

- `build_redis_config(addr, sentinel_addrs, password) -> dict` — returns tomlkit-compatible Redis config section
- Handles both sentinel (host:port pairs) and single (addr) modes
- Used by all service config generators (manager, webserver, appproxy, storage_proxy)

## Acceptance Criteria

- Single function for Redis config generation
- All services use the shared function
- Sentinel mode tested

JIRA Issue: BA-5570

Contributor guide

Open the contributing guide

Research direction

Start by comparing the Redis selection logic in context.py at lines 557-576, 739-754, 870-871, and 894-895 with pyinfra deploy/cores/manager/deploy.py lines 185-197. Define the shared config_gen/redis.py function for sentinel and single modes, then trace the manager, webserver, appproxy, and storage_proxy generators to replace their duplicated logic. Done means all services use one function and sentinel mode is tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.