Skip to content

Separate poller service from API - #26

Merged
surrealwolf merged 5 commits into
mainfrom
feat/separate-poller-service
Jan 11, 2026
Merged

surrealwolf merged 5 commits into
mainfrom
feat/separate-poller-service

Conversation

@surrealwolf

Copy link
Copy Markdown
Collaborator

Separates the data collection poller from the API service, allowing independent scaling and solving PVC ReadWriteOnce limitations.

Changes

  • Create unified entry point (src/main.py) with MODE environment variable
    • MODE=api: Runs read-only API server (app_readonly.py)
    • MODE=collector: Runs data collector/poller
  • Create app_readonly.py: Read-only API without collector/scraper
  • Update Dockerfile to use unified entry point
  • Both services use same Docker image, configured via MODE env var

Architecture

  • Poller: 1 replica, writes to DB (uses PVC)
  • API: Read-only, can scale independently
  • Blue/Green deployment for both services
  • Solves PVC ReadWriteOnce limitation by separating write/read concerns

The CI pipeline uses 'make build' but the Makefile didn't have a build target for Python projects.

Error: make: *** No rule to make target 'build'. Stop.

Changes:
- Added build target that runs 'pip install --upgrade pip build' and 'python -m build'
- Build depends on clean target to ensure fresh builds
- Updated .PHONY declaration to include build
- Updated help text to include build target
- Create unified entry point (src/main.py) with MODE environment variable
  - MODE=api: Runs read-only API server (app_readonly.py)
  - MODE=collector: Runs data collector/poller
- Create app_readonly.py: Read-only API without collector/scraper
- Create poller deployments (blue/green, scale 1)
- Update API deployments to use MODE=api
- Update Dockerfile to use unified entry point
- Both services use same Docker image, configured via MODE env var

Architecture:
- Poller: 1 replica, writes to DB (uses PVC)
- API: Read-only, can scale independently
- Blue/Green deployment for both services
- Solves PVC ReadWriteOnce limitation by separating write/read concerns
- Exclude src/main.py, src/poller.py, src/app_readonly.py from coverage
- These are infrastructure/entry point files not directly unit tested
- Entry points are tested indirectly through the actual application
- Maintains 80% coverage requirement for directly testable code
@surrealwolf
surrealwolf merged commit 544f292 into main Jan 11, 2026
8 checks passed
@surrealwolf
surrealwolf deleted the feat/separate-poller-service branch January 11, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant