Skip to content

chore: subdirectory and subdomain routing configuration#247

Merged
sheepdestroyer merged 4 commits into
masterfrom
chore/learn-deployment-guidelines
Jul 10, 2026
Merged

chore: subdirectory and subdomain routing configuration#247
sheepdestroyer merged 4 commits into
masterfrom
chore/learn-deployment-guidelines

Conversation

@sheepdestroyer

@sheepdestroyer sheepdestroyer commented Jul 9, 2026

Copy link
Copy Markdown
Owner

This PR refactors the routing configuration to cleanly support both subdirectory-based and subdomain-based routing layouts for LiteLLM and Langfuse. It dynamically templates NextAuth URL, LiteLLM root path, and base URL settings using environment variables, avoiding hardcoding in pod templates.

Summary by Sourcery

Configure routing to support environment-driven subdirectory and subdomain setups for LiteLLM and Langfuse.

Enhancements:

  • Expose LiteLLM and Langfuse public URLs and LiteLLM root path via environment variables for pod template rendering.
  • Template NextAuth URL, LiteLLM proxy base URL, and server root path using environment variables instead of hardcoded values.
  • Update LiteLLM container liveness check to use the new health endpoint path.

Summary by CodeRabbit

  • New Features
    • Enhanced stack configuration to support distinct public URLs and root paths for the gateway and web app.
  • Bug Fixes
    • Updated the gateway liveness check to use a dedicated liveness endpoint for more reliable monitoring.
    • Corrected runtime environment values for authentication and routing so the web app and gateway initialize with the expected URLs.

@sourcery-ai

sourcery-ai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the stack startup and pod templating logic to parameterize LiteLLM and Langfuse URLs/root paths via environment variables, replacing hard‑coded routing configuration and updating healthcheck and NextAuth settings to support both subdirectory and subdomain layouts.

Flow diagram for templated routing configuration in pod startup

flowchart TD
    A[start-stack.sh] --> B[set env PUBLIC_BASE_URL LOCAL_BASE_URL]
    A --> C[set env LITELLM_PUBLIC_URL LANGFUSE_PUBLIC_URL LITELLM_ROOT_PATH]
    B --> D[render_pod_yaml]
    C --> D
    D --> E[replace PROXY_BASE_URL_PLACEHOLDER with LITELLM_PUBLIC_URL]
    D --> F[replace NEXTAUTH_URL_PLACEHOLDER with LANGFUSE_PUBLIC_URL]
    D --> G[replace SERVER_ROOT_PATH_PLACEHOLDER with LITELLM_ROOT_PATH]
    D --> H[write pod.yaml]
    H --> I[LiteLLM container uses SERVER_ROOT_PATH PROXY_BASE_URL]
    H --> J[Langfuse/NextAuth uses NEXTAUTH_URL]
Loading

File-Level Changes

Change Details Files
Parameterize LiteLLM and Langfuse public URLs and LiteLLM root path as environment variables and export them for pod templating.
  • Add LITELLM_PUBLIC_URL, LANGFUSE_PUBLIC_URL, and LITELLM_ROOT_PATH variables with defaults in the startup script.
  • Export the new environment variables alongside existing PUBLIC_BASE_URL and LOCAL_BASE_URL.
  • Include the new variables in the environment passed into the pod.yaml rendering function.
start-stack.sh
Template URL and root-path placeholders in pod.yaml from environment variables to support subdomain and subdirectory routing.
  • Extend the list of YAML placeholders with NEXTAUTH_URL_PLACEHOLDER and SERVER_ROOT_PATH_PLACEHOLDER.
  • Replace PROXY_BASE_URL_PLACEHOLDER directly with LITELLM_PUBLIC_URL instead of deriving it from PUBLIC_BASE_URL.
  • Map NEXTAUTH_URL_PLACEHOLDER to LANGFUSE_PUBLIC_URL for NextAuth configuration.
  • Map SERVER_ROOT_PATH_PLACEHOLDER to LITELLM_ROOT_PATH for LiteLLM root path configuration.
  • Keep PUBLIC_BASE_URL and ROUTING_DOMAIN templating logic unchanged.
start-stack.sh
Update pod.yaml to use templated placeholders and adjust LiteLLM healthcheck and NextAuth URL.
  • Change SERVER_ROOT_PATH environment value from a hardcoded path to SERVER_ROOT_PATH_PLACEHOLDER in the LiteLLM container.
  • Keep PROXY_BASE_URL environment wired through PROXY_BASE_URL_PLACEHOLDER for templating.
  • Update LiteLLM liveness probe URL from /ping to /health/liveness.
  • Change NEXTAUTH_URL in the Langfuse/NextAuth container from a hardcoded localhost URL to NEXTAUTH_URL_PLACEHOLDER.
pod.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cfef3057-5908-4008-a9c4-e4f06f1add74

📥 Commits

Reviewing files that changed from the base of the PR and between 92a500f and ed21b07.

📒 Files selected for processing (1)
  • start-stack.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • start-stack.sh

📝 Walkthrough

Walkthrough

start-stack.sh defines and exports LiteLLM/Langfuse URL and root-path variables, maps them to pod.yaml placeholders during rendering, and updates pod.yaml to consume those placeholders. The LiteLLM liveness probe now targets /health/liveness.

Changes

Placeholder-based pod.yaml rendering

Layer / File(s) Summary
New URL/root-path variables and exports
start-stack.sh
Adds defaulted LITELLM_PUBLIC_URL, LANGFUSE_PUBLIC_URL, and LITELLM_ROOT_PATH variables and exports them for template rendering.
Placeholder mapping in render_pod_yaml
start-stack.sh
Requires NEXTAUTH_URL_PLACEHOLDER and SERVER_ROOT_PATH_PLACEHOLDER, and maps them plus PROXY_BASE_URL_PLACEHOLDER from the new variables.
pod.yaml placeholder consumption and probe update
pod.yaml
SERVER_ROOT_PATH and NEXTAUTH_URL now use placeholder tokens, and the LiteLLM Gateway liveness probe targets /health/liveness instead of /ping.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main routing configuration changes for subdirectory and subdomain support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/learn-deployment-guidelines

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.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The default values for LITELLM_PUBLIC_URL and LANGFUSE_PUBLIC_URL are hardcoded to a specific internal domain, which may be surprising for other environments; consider leaving them unset or using generic/localhost defaults so misconfiguration is more obvious.
  • NEXTAUTH_URL_PLACEHOLDER is currently populated from LANGFUSE_PUBLIC_URL, which couples the two concepts; consider introducing a dedicated NEXTAUTH_URL environment variable to avoid unintended cross-dependence.
  • The liveness probe was changed from /ping to /health/liveness; double-check that this path is stable and version-independent for the Litellm image to avoid unexpected startup failures if the upstream health endpoints change.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The default values for LITELLM_PUBLIC_URL and LANGFUSE_PUBLIC_URL are hardcoded to a specific internal domain, which may be surprising for other environments; consider leaving them unset or using generic/localhost defaults so misconfiguration is more obvious.
- NEXTAUTH_URL_PLACEHOLDER is currently populated from LANGFUSE_PUBLIC_URL, which couples the two concepts; consider introducing a dedicated NEXTAUTH_URL environment variable to avoid unintended cross-dependence.
- The liveness probe was changed from /ping to /health/liveness; double-check that this path is stable and version-independent for the Litellm image to avoid unexpected startup failures if the upstream health endpoints change.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates pod.yaml and start-stack.sh to introduce configurable public URLs and root paths for LiteLLM and Langfuse, replacing hardcoded values with placeholders and dynamic environment variables. Additionally, the liveness probe endpoint for LiteLLM was updated to /health/liveness. Feedback on these changes suggests dynamically referencing the ROUTING_DOMAIN variable in the default values of LITELLM_PUBLIC_URL and LANGFUSE_PUBLIC_URL to avoid hardcoding the domain name.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread start-stack.sh Outdated
sheepdestroyer and others added 2 commits July 10, 2026 23:23
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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