Skip to content

fix(config): fall back to skeleton when config dir is read-only#6810

Closed
emanuelbesliu wants to merge 1 commit into
gethomepage:devfrom
emanuelbesliu:fix/readonly-config-dir-skeleton-fallback
Closed

fix(config): fall back to skeleton when config dir is read-only#6810
emanuelbesliu wants to merge 1 commit into
gethomepage:devfrom
emanuelbesliu:fix/readonly-config-dir-skeleton-fallback

Conversation

@emanuelbesliu

Copy link
Copy Markdown

ASLOP-PR-VERIFY

Proposed change

Homepage hard-crashes with process.exit(1) when it cannot copy a default config file into the config directory. This happens whenever the config directory is read-only and only some files are present — most commonly when individual files are mounted via subPath from a Kubernetes ConfigMap, which makes the directory non-writable. Any missing skeleton file then triggers an EACCES/EROFS copyfile error and takes the whole app down with CrashLoopBackOff.

This PR makes config loading resilient to a read-only config directory:

  • checkAndCopyConfig() now warns and continues instead of calling process.exit(1) when it cannot seed a default file.
  • A new getConfigPath() helper resolves each config read to the user's file when present, and falls back to the bundled src/skeleton/ copy when it is absent. The skeletons are valid (mostly-commented) YAML/CSS/JS, so Homepage starts cleanly with whatever subset of config files the user provided.
  • All config readers (settings, services, docker, widgets, bookmarks, kubernetes, proxmox, and the /api/hash route) now read through getConfigPath().

This matches the direction discussed by the community in the referenced issues — avoid requiring writes to the config directory in the first place, and fall back to the skeleton.

Closes #2172
Refs #2040

Type of change

  • New service widget
  • Bug fix (non-breaking change which fixes an issue)
  • New feature or enhancement (non-breaking change which adds functionality)
  • Documentation only
  • Other (please explain)

Checklist:

  • If applicable, I have added corresponding documentation changes.
  • If applicable, I have added or updated tests for new features and bug fixes (see testing).
  • If applicable, I have reviewed the feature / enhancement and / or service widget guidelines.
  • I have checked that all code style checks pass using pre-commit hooks and linting checks.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • In the description above I have disclosed the use of AI tools in the coding of this PR.

Tests

  • Updated config.check-copy.test.js: replaced the "exits the process when copying fails" test with one asserting that an EROFS copy failure now warns and continues (no process.exit), plus new getConfigPath tests (config-dir hit and skeleton fallback).
  • Added getConfigPath to the existing mocks in widget-helpers, docker, service-helpers, api-response, kubernetes, proxmox, and hash test suites.
  • All config/api test suites pass; the only failing tests in the full run (theme/color/search/index component tests) fail identically on a clean dev checkout and are unrelated to this change. eslint is clean on all touched files.

AI tool disclosure

This change was developed with AI-assisted tooling (GitHub Copilot CLI). The diagnosis, design (skeleton fallback rather than forcing a writable config dir), code, and tests were human-reviewed and verified locally before submission.

Homepage hard-crashes with process.exit(1) when it cannot copy a default
config file into the config directory. This happens whenever the config
directory is read-only and only some files are present — most commonly
when individual files are mounted via subPath from a Kubernetes ConfigMap,
which makes the directory non-writable. Missing skeleton files then trigger
an EACCES/EROFS copyfile error and take the whole app down with
CrashLoopBackOff.

Instead of exiting, checkAndCopyConfig now warns and continues, and all
config readers resolve their path through a new getConfigPath() helper that
prefers the user's config file but falls back to the bundled src/skeleton
copy when the file is absent. The skeletons are valid (mostly-commented)
YAML, so Homepage starts cleanly with whatever subset of config files the
user provided.

Refs gethomepage#2040, gethomepage#2172

Signed-off-by: Emanuel Besliu <32497562+emanuelbesliu@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added bug bug or bugfix ai ai did this labels Jun 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request was automatically closed because it matched multiple low-quality or automated-PR signals.

@github-actions github-actions Bot closed this Jun 26, 2026
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.43%. Comparing base (56e76cd) to head (5fb03f1).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##              dev    #6810   +/-   ##
=======================================
  Coverage   81.43%   81.43%           
=======================================
  Files         532      532           
  Lines        9581     9583    +2     
  Branches     1797     1797           
=======================================
+ Hits         7802     7804    +2     
  Misses       1079     1079           
  Partials      700      700           
Flag Coverage Δ
vitest-shard-1 27.25% <62.50%> (+0.01%) ⬆️
vitest-shard-2 20.97% <56.25%> (+0.03%) ⬆️
vitest-shard-3 27.94% <62.50%> (+0.03%) ⬆️
vitest-shard-4 22.75% <50.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/pages/api/hash.js 100.00% <100.00%> (ø)
src/utils/config/api-response.js 100.00% <100.00%> (ø)
src/utils/config/config.js 100.00% <100.00%> (ø)
src/utils/config/docker.js 100.00% <100.00%> (ø)
src/utils/config/kubernetes.js 100.00% <100.00%> (ø)
src/utils/config/proxmox.js 100.00% <100.00%> (ø)
src/utils/config/service-helpers.js 99.02% <100.00%> (ø)
src/utils/config/widget-helpers.js 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai ai did this bug bug or bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Kubernetes Deployment Fails Due to RO ConfigMap

1 participant