easy-install: make deploy compose generation resilient when SITES_RULE is unset#1711
Draft
Copilot wants to merge 3 commits into
Draft
easy-install: make deploy compose generation resilient when SITES_RULE is unset#1711Copilot wants to merge 3 commits into
SITES_RULE is unset#1711Copilot wants to merge 3 commits into
Conversation
Agent-Logs-Url: https://github.com/frappe/bench/sessions/80e3dbaa-a210-469b-a99d-4a443f1cf71a Co-authored-by: netchampfaris <9355208+netchampfaris@users.noreply.github.com>
Agent-Logs-Url: https://github.com/frappe/bench/sessions/80e3dbaa-a210-469b-a99d-4a443f1cf71a Co-authored-by: netchampfaris <9355208+netchampfaris@users.noreply.github.com>
|
Copilot
AI
changed the title
[WIP] Fix Docker Compose generation to handle missing SITES_RULE
easy-install: make deploy compose generation resilient when Apr 23, 2026
SITES_RULE is unset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



easy-install.py build --deploycan fail during compose config generation because Traefik labels infrappe_dockerrequireSITES_RULE, but bench-generated.envfiles may omit it. This change makes env generation always provide a validSITES_RULEwhile preserving user overrides.Root cause addressed in env generation
write_to_env(...)now always writesSITES_RULE.site1.localhost.Override behavior preserved
start_prod(...)now readsSITES_RULEfrom the current.envand passes it back through env regeneration, so custom routing rules remain intact.Regression coverage added
SITES_RULEgeneration when unsetSITES_RULEOriginal prompt
The GitHub Actions job "Easy Install Test" is failing in pull request #1707 in repository
frappe/bench.Observed failure from the job logs:
required variable SITES_RULE is missing a value: SITES_RULE not set.github/workflows/easy-install.ymlthat runspython3 ${GITHUB_WORKSPACE}/easy-install.py build --deploy ...error while interpolating services.frontend.labels.[]: required variable SITES_RULE is missing a value: SITES_RULE not setPlease implement a fix in this PR so the easy-install flow no longer fails when
SITES_RULEis unset.Requirements:
easy-install.py build --deploy.SITES_RULEis not explicitly provided.SITES_RULEis provided by users.site1.localhost) or the repository’s existing conventions.Please create a pull request with the code changes against the branch for PR #1707 in
frappe/bench.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The failure is caused by Docker Compose template interpolation, not by the image build.
Root cause
The job fails here in the logs:
error while interpolating services.frontend.labels.[]: required variable SITES_RULE is missing a value: SITES_RULE not setGenerating Compose File failedThis happens during the workflow’s easy-install step in
.github/workflows/easy-install.yml, which runs:python3 ${GITHUB_WORKSPACE}/easy-install.py build --deploy --tag=custom-apps:latest --project=actions_test --email=test@frappe.io --image=custom-apps --version=latest --app=erpnextSo the install path is generating a compose file that now expects
SITES_RULE, but the generated.envdoes not provide it.Why this fails
The compose template for the frontend service is using
${SITES_RULE}inlabels, and Compose treats that as a required variable. Since the generated environment file only has “basic configs” and does not includeSITES_RULE, compose generation aborts before the stack comes up.The repeated
--- ERROR ---lines during Yarn install are not the fatal issue. The actual terminating error is the missingSITES_RULE.Solution
Make compose generation resilient by providing a default for
SITES_RULE, or ensure the easy-install generated.envexplicitly sets it.Best fix
In the compose template, replace the required interpolation with a safe default.
Use:
${SITES_RULE:-Host(`site1.localhost`)}or, if the label is part of a larger expression, default only the variable:
...${SITES_RULE:-Host(`site1.localhost`)}...This prevents Compose from failing when
SITES_RULEis absent and preserves override behavior when it is set.If the template currently uses required syntax
If it looks like this:
- "traefik.http.routers.frontend.rule=${SITES_RULE}"change it to:
- "traefik.http.routers.frontend.rule=${SITES_RULE:-Host(`site1.localhost`)}"Alternative fix
If bench intentionally requires
SITES_RULE, then the generator that creates.envfor--deploymust write a default value.Suggested generated env entry:
That is especially appropriate because the workflow validates:
curl -H "Host: site1.localhost" -sk https://127.0.0.1/api/method/pingSo
site1.localhostis already the expected hostname in this test.Recommended patch direction
Prefer fixing the compose template instead of only the workflow, because this is a product-level robustness issue: any user running easy install without
SITES_RULEwill hit the same failure.Suggested code change
Wherever the frontend Traefik label is defined, update it along these lines:
If there are separate HTTP/HTTPS routers, apply the same fallback there too.
Summary
...
This pull request was created from Copilot chat.