Skip to content

CLIProxyAPI: fix update deleting config.yaml#15834

Open
austinpilz wants to merge 3 commits into
community-scripts:mainfrom
austinpilz:fix-cliproxyapi-update-config
Open

CLIProxyAPI: fix update deleting config.yaml#15834
austinpilz wants to merge 3 commits into
community-scripts:mainfrom
austinpilz:fix-cliproxyapi-update-config

Conversation

@austinpilz

Copy link
Copy Markdown
Contributor

✍️ Description

Updating CLIProxyAPI breaks the service. Reported error:

[error] [main.go:488] failed to load config: failed to read config file: open /opt/cliproxyapi/config.yaml: no such file or directory

update_script() in ct/cliproxyapi.sh runs fetch_and_deploy_gh_release with CLEAN_INSTALL=1, which wipes /opt/cliproxyapi before extracting the new release tarball. config.yaml is generated at install time by this script (it is not part of upstream's release asset), so every update deleted it and the service could never start again.

This PR backs up /opt/cliproxyapi/config.yaml before the clean install and restores it before restarting the service — the same backup/restore pattern already used elsewhere in this repo for scripts that pair CLEAN_INSTALL=1 with a generated config file (e.g. fladder.sh, rustypaste.sh).

Only ct/cliproxyapi.sh is touched; no unrelated changes.

Supersedes #15833, which the template-check bot auto-closed for using a non-template body before I fixed it; GitHub won't relink a force-recreated branch to a closed PR, so opening fresh here with the corrected template.

🔗 Related Issue

Fixes #(none filed upstream — reported to me directly; logs included above)

✅ Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughlybash -n ct/cliproxyapi.sh passes; logic verified by tracing fetch_and_deploy_gh_release's CLEAN_INSTALL path in misc/tools.func to confirm it deletes config.yaml, and confirming the backup/restore now runs around that call in the correct order (stop service → backup → clean install → restore → start service). I do not have a spare LXC to run a live end-to-end update against, so this has not been verified against a real running container — flagging this explicitly for reviewer awareness.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues. Backup file is a plain cp/mv under /tmp, scoped to this update run.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to script metadata (PocketBase/website data).
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

root and others added 3 commits July 6, 2026 14:05
The completion message previously pointed to the bare host:port,
which serves the proxy API rather than the admin UI. Provider
authentication happens at /management.html.
CLEAN_INSTALL wipes /opt/cliproxyapi before extracting the new release
tarball, and config.yaml isn't part of upstream's release asset, so
every update deleted it. The service then failed to start with
"failed to read config file: open /opt/cliproxyapi/config.yaml: no
such file or directory" (reported in PIL-395). Back up config.yaml
before the clean install and restore it after, matching the existing
backup/restore pattern used by other scripts in this repo (fladder,
rustypaste, etc.).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@austinpilz
austinpilz requested a review from a team as a code owner July 16, 2026 22:38
@MickLesk

Copy link
Copy Markdown
Member

we have a create_backup und restore function, f.e.:

create_backup /opt/anchor/.env

restore_backup

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants