Skip to content

Improve docker compose template#4004

Merged
ildyria merged 3 commits intomasterfrom
improved-compose-template
Jan 21, 2026
Merged

Improve docker compose template#4004
ildyria merged 3 commits intomasterfrom
improved-compose-template

Conversation

@ildyria
Copy link
Member

@ildyria ildyria commented Jan 21, 2026

Centralize all the configuration in a single chunk.
Re-use the configuration later in the file.

Key Design Notes

  1. x- Extension Fields

    • x-base-lychee-setup is a Compose extension field
    • It is ignored by Docker but reusable via anchors
    • Keeps the file valid and clean
  2. YAML Anchors (&) and Merge Keys (<<)

    • &base-lychee-setup defines the template
    • <<: *base-lychee-setup injects it into each service
    • Individual services override or extend fields safely
  3. Environment Variable Overrides

    • Environment blocks merge, not replace
    • Service-specific variables can be layered on top

Summary by CodeRabbit

  • Refactor
    • Centralized shared service configuration and environment settings to remove per-service duplication; services now inherit common defaults and include health checks.
  • Chores
    • Added a minimal compose variant, consolidated networks and volumes, and streamlined Docker setup for more consistent, maintainable deployments.

✏️ Tip: You can customize this high-level summary in your review settings.

@ildyria ildyria requested a review from a team as a code owner January 21, 2026 16:33
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Centralized Lychee service configuration via two YAML anchors (base and common env). lychee_api and lychee_worker now inherit base settings and shared environment; added healthchecks; networks and volumes consolidated. A new minimal compose file provides an anchored, security-hardened minimal deployment.

Changes

Cohort / File(s) Summary
Primary compose
docker-compose.yaml
Added anchors x-base-lychee-setup and x-common-env; refactored lychee_api and lychee_worker to inherit base + common env, removed duplicated per-service security/volume/env blocks, added healthchecks, consolidated network/volume references.
Minimal compose
docker-compose.minimal.yaml
New file defining minimal Lychee deployment using the same anchor pattern (base-lychee-setup, common-env); includes lychee_api, lychee_worker, and lychee_db with explicit security caps, tmpfs, mounts, and healthchecks.
Backend services (repositioned)
...
lychee_db, lychee_cache retained semantically but integrated into the new anchor-driven topology and service dependency ordering.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through anchors, neat and spry,
Merged the twins that once did lie,
Healthchecks set, the networks tied,
Volumes shared and configs dried.
A tidy hop — deployment sighs!

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docker-compose.yaml (1)

386-398: environment override replaces base defaults—worker lacks fallback values.

Redefining environment: replaces the base map entirely, so the worker loses explicit defaults (PUID, PGID, DB_HOST, APP_KEY, etc.) that the API service has. While the worker inherits env_file and will load variables from .env, if .env is incomplete or missing—common in fresh setups—the worker will lack critical fallbacks and may fail to start.

Consider anchoring the base environment and merging it in the worker:

Suggested fix
   environment:
+    &base-lychee-env
     PUID: "${PUID:-1000}"
     PGID: "${PGID:-1000}"
   lychee_worker:
     <<: *base-lychee-setup
     container_name: lychee-worker
     environment:
+      <<: *base-lychee-env
       LYCHEE_MODE: worker

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@ildyria ildyria merged commit 2fa1ce7 into master Jan 21, 2026
41 checks passed
@ildyria ildyria deleted the improved-compose-template branch January 21, 2026 17:30
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