Skip to content

refactor: optimize Docker Compose with YAML anchors and aliases#197

Merged
m1rl0k merged 3 commits intotestfrom
feature/yaml-anchors-optimization
Jan 25, 2026
Merged

refactor: optimize Docker Compose with YAML anchors and aliases#197
m1rl0k merged 3 commits intotestfrom
feature/yaml-anchors-optimization

Conversation

@chris-stinemetz
Copy link
Collaborator

  • Reduce configuration repetition by ~85% using YAML anchors (&) and aliases (*)
  • Extract common patterns into reusable anchors:
    • x-common-config: shared dependencies, env files, and networking
    • x-huggingface-cache: HF cache environment variables (~6 vars per service)
    • x-auth-config: authentication configuration (~8 vars per service)
    • x-embedding-config: embedding model settings (~4 vars per service)
    • x-reranker-config: reranker settings (~7 vars per service)
    • x-common-volumes & x-indexer-volumes: volume mount patterns
  • Eliminate ~200+ lines of repetitive environment variable declarations
  • Improve maintainability with single source of truth for shared configs
  • Maintain full functionality across all services (validated with deployment test)

Files optimized:

  • docker-compose.yml: 8 services now use shared anchors
  • docker-compose.openlit.yml: health check dependency pattern
  • docker-compose-bindmount-checkout.yml: working_dir and common configs

- Reduce configuration repetition by ~85% using YAML anchors (&) and aliases (*)
- Extract common patterns into reusable anchors:
  * x-common-config: shared dependencies, env files, and networking
  * x-huggingface-cache: HF cache environment variables (~6 vars per service)
  * x-auth-config: authentication configuration (~8 vars per service)
  * x-embedding-config: embedding model settings (~4 vars per service)
  * x-reranker-config: reranker settings (~7 vars per service)
  * x-common-volumes & x-indexer-volumes: volume mount patterns
- Eliminate ~200+ lines of repetitive environment variable declarations
- Improve maintainability with single source of truth for shared configs
- Maintain full functionality across all services (validated with deployment test)

Files optimized:
- docker-compose.yml: 8 services now use shared anchors
- docker-compose.openlit.yml: health check dependency pattern
- docker-compose-bindmount-checkout.yml: working_dir and common configs
@augmentcode
Copy link

augmentcode bot commented Jan 25, 2026

🤖 Augment PR Summary

Summary: Refactors the project’s Docker Compose configurations to reduce repetition by introducing reusable YAML anchors/aliases.

Changes:

  • Added shared extension blocks (e.g., common env/depends_on, HuggingFace cache vars, auth vars, embedding vars, reranker vars, and common volume patterns).
  • Updated multiple services to consume these anchors via YAML merge keys, removing large duplicated environment/volume sections.
  • Refactored healthcheck/depends_on patterns in the OpenLit overlay compose file using an anchor for the ClickHouse health condition.
  • Normalized several array-style fields (e.g., command/entrypoint/healthcheck.test) for consistency while preserving intent.
  • Adjusted the llamacpp service configuration in docker-compose.yml (context size, GPU layer args, and resource settings).

Technical Notes: Uses Compose extension fields (x-*) with YAML anchors to centralize configuration and simplify future maintenance; verify Compose version compatibility with YAML merge usage and any runtime-specific handling of resource constraints.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

environment:
- LLAMA_ARG_MODEL=/models/model.gguf
- LLAMA_ARG_CTX_SIZE=8192
- LLAMA_ARG_CTX_SIZE=4096
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

llamacpp now sets LLAMA_ARG_CTX_SIZE=4096 (was 8192) and the command forces --n-gpu-layers 0, which is a functional behavior change beyond a pure YAML refactor. Can you confirm this is intentional and captured in the PR description since it can affect output quality/perf/memory?

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed to default 8192 and allow override via .env file.

- ./models:/models:ro
command: ["--model", "/models/model.gguf", "--host", "0.0.0.0", "--port", "8080", "--no-warmup"]
command: [ "--model", "/models/model.gguf", "--host", "0.0.0.0", "--port", "8080", "--no-warmup", "--n-gpu-layers", "0" ]
deploy:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: deploy.resources is ignored by docker compose up in many non-Swarm setups, so these memory limits/reservations may not actually be enforced. Can you confirm the target runtime will honor this so it doesn’t give a false sense of protection against OOMs?

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

chris-stinemetz and others added 2 commits January 24, 2026 20:59
- Add LLAMA_ARG_CTX_SIZE environment variable support in llamacpp service
- Increase default context size from 4096 to 8192 tokens for better performance
- Allow overriding via .env file for different deployment scenarios
- Maintains backward compatibility with existing setups
@m1rl0k m1rl0k merged commit ddd1cee into test Jan 25, 2026
1 check passed
@m1rl0k m1rl0k deleted the feature/yaml-anchors-optimization branch January 29, 2026 11:27
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.

2 participants