Repository navigation
docs(headless-server): add upgrade SOP for orca serve on Linux - #9575
Conversation
The headless Linux guide covered install/run/systemd but had no upgrade section, leaving operators to guess how to move to a new AppImage without losing state. Add an "Upgrade" section documenting the manual SOP (serve mode never auto-updates) and one troubleshooting bullet: - State lives under the service user's ~/.config (orca + Orca dirs), independent of /opt/orca, and orca-data.json is forward-migrated on load, so a forward upgrade is safe. - Replace the binary with an atomic same-filesystem rename (download to .new, verify, mv) — never curl -o over the FUSE-mounted live binary. - Back up the whole .config before upgrading, because rollback is NOT binary-only safe: an older build strips newer orca-data.json fields it doesn't recognize, and the .bak.* ring is corruption-recovery, not a pre-upgrade copy. - Note there is no headless version command; track the release tag instead. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
📝 WalkthroughWalkthroughAdds headless Linux documentation for prerequisites, dedicated service ownership, manual AppImage upgrades, persistent configuration migration, version recording, download validation, atomic installation, service verification, rollback of both configuration and binary, and troubleshooting for post-upgrade crash-loops. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 03603ce2-d008-4635-a49f-66141955021b
📒 Files selected for processing (1)
docs/reference/headless-linux-server.md
Address CodeRabbit review on stablyai#9575: - Fail closed: run the upgrade block under `set -euo pipefail`, remove any stale `.new` file before download, and gate the atomic `mv` on an explicit ELF check so a failed/partial/non-ELF download can never be promoted. - Keep /opt/orca/VERSION tied to the installed binary: a single `TAG` variable drives both the download URL and the recorded VERSION, saved as VERSION.prev on upgrade and restored on rollback so the audit file never drifts. - Crash-loop troubleshooting now points to Roll back first (restores the pre-upgrade orca-data.json) instead of re-running Upgrade. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
OrcaWin
left a comment
There was a problem hiding this comment.
Thanks for adding the missing headless upgrade path. I tightened the SOP before landing:
- stage and validate the architecture-matched AppImage while the server remains online
- keep /opt/orca root-owned and rollback generations private and self-contained
- restore only Orca profile directories with guarded failure recovery and explicit retention
- direct crash-looping upgrades to rollback instead of overwriting the known-good generation
The documented Bash paths and failure boundaries have been validated.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
docs/reference/headless-linux-server.md (1)
59-66: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winLock down the service user’s home directory explicitly.
The service state includes paired-device keys and other persistent data, but this setup relies on distro-specific
useraddhome permissions. Explicitly restrict/home/orcaso local users cannot traverse or read the service profile.Proposed hardening
sudo useradd --system --create-home --shell /usr/sbin/nologin orca +sudo chmod 700 /home/orca sudo chown root:root /opt/orca /opt/orca/orca-linux.AppImage
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 84d148e7-78e1-4841-ac6b-b97ae1954fe7
📒 Files selected for processing (1)
docs/reference/headless-linux-server.md
| ### Record the version you deploy | ||
|
|
||
| Orca has no headless version command: there is no `--version` flag or `version` | ||
| subcommand, and `orca serve` prints only its endpoint. Choose a release tag | ||
| explicitly instead of following the `latest` URL, and record it next to the | ||
| binary so upgrades are auditable. The steps below keep that record in | ||
| `/opt/orca/VERSION`. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Initialize VERSION during the initial installation too.
The installation flow still downloads releases/latest at Lines 25-26 without writing /opt/orca/VERSION. Consequently, the first rollback bundle can contain the prior binary but no matching release metadata, weakening auditability and the documented rollback contract. Pin the initial install to the same explicit release-tag flow and create VERSION before starting the service.
| # Clear predictable staging names left by an older attempt after locking the directory | ||
| sudo rm -f /opt/orca/orca-linux.AppImage.new /opt/orca/VERSION.new \ | ||
| /opt/orca/orca-linux.AppImage.recovering /opt/orca/VERSION.recovering |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file='docs/reference/headless-linux-server.md'
echo '--- targeted ranges ---'
sed -n '200,245p' "$file"
echo
sed -n '390,415p' "$file"
echo
echo '--- search for locking / serialization mentions ---'
rg -n --hidden --no-ignore-vcs 'upgrade\.lock|flock|serialize|concurrent|staging paths|\.ready|\.new|recovering|rollback' docs/reference/headless-linux-server.md docs || trueRepository: stablyai/orca
Length of output: 20053
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file='docs/reference/headless-linux-server.md'
echo '--- upgrade section around staging/rename ---'
sed -n '245,370p' "$file"
echo
echo '--- rollback section around bundle selection/restoration ---'
sed -n '400,520p' "$file"Repository: stablyai/orca
Length of output: 8823
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file='docs/reference/headless-linux-server.md'
echo '--- line-numbered excerpt around 216-231 ---'
nl -ba "$file" | sed -n '210,235p'
echo
echo '--- line-numbered excerpt around 402-407 ---'
nl -ba "$file" | sed -n '398,410p'Repository: stablyai/orca
Length of output: 236
Serialize upgrade and rollback operations. Both scripts use fixed /opt/orca/*.new staging paths, so overlapping runs can clobber the in-flight binary/version pair and leave a mismatched deployment. Acquire an exclusive lock before cleanup/staging and hold it through the service restart in both scripts.
Proposed locking pattern
set -euo pipefail
+exec 9>/opt/orca/.upgrade.lock
+flock -n 9 || {
+ echo 'Another Orca upgrade or rollback is already running' >&2
+ exit 1
+}| ```bash | ||
| shopt -s nullglob | ||
| ORCA_ROLLBACK_SETS=(/opt/orca/orca-rollback-*.ready) | ||
| ((${#ORCA_ROLLBACK_SETS[@]} > 0)) | ||
| ORCA_ROLLBACK=${ORCA_ROLLBACK_SETS[${#ORCA_ROLLBACK_SETS[@]} - 1]} | ||
| printf 'Removing rollback bundle: %s\n' "$ORCA_ROLLBACK" | ||
| sudo test -d "$ORCA_ROLLBACK" | ||
| sudo rm -rf -- "$ORCA_ROLLBACK" | ||
| ``` |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Abort explicitly when no rollback bundle exists.
With nullglob, the array can be empty. The arithmetic expression only returns a nonzero status; this standalone cleanup snippet does not necessarily stop there, so it can continue with an empty ORCA_ROLLBACK and emit misleading failures. Add an explicit guard before indexing the array.
…yai#9575) * docs(headless-server): add upgrade SOP for orca serve on Linux The headless Linux guide covered install/run/systemd but had no upgrade section, leaving operators to guess how to move to a new AppImage without losing state. Add an "Upgrade" section documenting the manual SOP (serve mode never auto-updates) and one troubleshooting bullet: - State lives under the service user's ~/.config (orca + Orca dirs), independent of /opt/orca, and orca-data.json is forward-migrated on load, so a forward upgrade is safe. - Replace the binary with an atomic same-filesystem rename (download to .new, verify, mv) — never curl -o over the FUSE-mounted live binary. - Back up the whole .config before upgrading, because rollback is NOT binary-only safe: an older build strips newer orca-data.json fields it doesn't recognize, and the .bak.* ring is corruption-recovery, not a pre-upgrade copy. - Note there is no headless version command; track the release tag instead. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * docs(headless-server): harden the orca serve upgrade/rollback runbook Address CodeRabbit review on stablyai#9575: - Fail closed: run the upgrade block under `set -euo pipefail`, remove any stale `.new` file before download, and gate the atomic `mv` on an explicit ELF check so a failed/partial/non-ELF download can never be promoted. - Keep /opt/orca/VERSION tied to the installed binary: a single `TAG` variable drives both the download URL and the recorded VERSION, saved as VERSION.prev on upgrade and restored on rollback so the audit file never drifts. - Crash-loop troubleshooting now points to Roll back first (restores the pre-upgrade orca-data.json) instead of re-running Upgrade. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * docs(headless): harden server upgrade SOP --------- Co-authored-by: fanyunqian.1 <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: OrcaWin <[email protected]>
What
Adds an Upgrade section (with a step-by-step SOP) to
docs/reference/headless-linux-server.md, plus one Troubleshooting bullet. The guide previously covered install / foreground run / systemd but had no upgrade path, leaving operators to guess how to move to a new AppImage without losing state.Why
orca servenever auto-updates in headless mode (the built-in updater only runs in the desktop GUI, and no paired client can trigger it remotely), so upgrading is always a manual step that deserves a documented, safe procedure.Contents
~/.config/(Orca uses both anorcaand anOrcadirectory), independent of/opt/orca.orca-data.jsonis forward-migrated on load, so a forward upgrade needs no manual data step..newon the same filesystem, verify, thenmv— nevercurl -oover the FUSE-mounted live binary (it can crash/corrupt the running process; a failed download can also clobber a working binary).orca-data.jsonfields it doesn't recognize, and the.bak.*ring is corruption-recovery, not a pre-upgrade copy. So the SOP backs up the whole.configbefore upgrading and requires restoring it (not just swapping the binary) to roll back cleanly.--version.Verification
Every technical claim in the SOP was verified against the codebase before writing (updater wiring in serve mode,
Orca server ready:startup line, userData paths, migration/downgrade behavior, AppImage FUSE mount semantics), then the written SOP was adversarially reviewed for command correctness and data-loss traps.Docs-only change; no code paths affected.
🤖 Generated with Claude Code