ENTH
PART 5 · Maintenance

Upgrade runbook and troubleshooting

Upgrade runbook and troubleshooting

TL;DR — the 30-second summary

The final chapter is the "survivor guide" — every other chapter points back here when trouble hits. It has two parts: upgrade discipline that keeps the system from breaking during upgrades, and the fix recipe for when it breaks at 2 AM

When to use

Come back to this chapter whenever: you are about to upgrade any component, you hit an odd symptom, or you read the words "if you get stuck anywhere" in another chapter

How-to

The 6 rules of upgrading (none negotiable):

  1. Pin the version of everything — latest is absolutely forbidden (we have been bitten by latest changing behavior under us)
  2. One component per time window — upgrade two things at once and break, and you learn nothing at all
  3. Back up before touching — dump Postgres + snapshot the config, and it must be "really restorable" (a backup never restored is a rumor)
  4. Write the rollback plan before typing the upgrade command
  5. Run the 6-probe check after every change — all six green or roll back
  6. Outside peak hours — after 23:00 every day, avoiding our own automatic restart window

The 6-probe check set (run after every change):

vps — the standard check set (from docs/upgrade.md, sanitized) · 6-probe smoke
# 1. LiteLLM alive + DB connectedcurl -sf https://llm.example.com/health/liveliness # 200curl -sf https://llm.example.com/health/readiness # 200, db=connected# 2. The no-key-no-entry gate still standsPOST /v1/chat/completions without a key attached # must return 401# 3. A real Thai chat fires through the whole pipelinecurl -sf .../v1/chat/completions -H "Authorization: $SMOKE_KEY" -d @smoke-payload.json# 4. WebUI 200 5. SearXNG local answers 6. Mac: models resident + swap not growingssh mac 'ollama ps && vm_stat | grep -i swap'

The full original lives in docs/upgrade.md in the repo — copy it into your own script freely

Common symptoms with hands-on fixes:

SymptomCommon causeFix
Bot answers blankthink enabled + low num_predictpin think:false on the route (chapter 7)
Text streams slowly, in burststwo models resident until swap kicks inevict the secondary model (keep_alive 0), then see chapter 3
Cannot log into the chat site, rapid 401skey/session expiredcheck the master key in .env, then up -d again
Thai answers start showing Chinese characterssystem prompt lost / the new route is missing Config Ggo back and check the route + chapter 12
Today's cloud bill abnormally highthe Mac was down long enough that Tier 3 worked hardcheck the hourly spend log + find the cause on the Mac
Updated and brokenfloating version / params silently droppedroll back to the old tag first, find the cause afterwards

The 2 AM recipe (broken at night): (1) do not debug deep while sleepy — roll back to the old tag first (2) save the last 30 minutes of logs into an incident folder (3) sleep (4) write a one-page post-mortem within 48 hours naming the root cause + which rule, had it been followed, would have prevented this incident, then add that rule to the manual

Config example

The popular upgrade steps in short (full version in docs/upgrade.md):

# --- Ollama on the Mac ---
brew upgrade ollama          # then restart the service
ollama --version             # client == server must match
ollama ps                    # the main model must be resident again
# the first warm-up chat must be < 5 s to count as done

# --- LiteLLM / WebUI on the VPS ---
docker compose pull litellm          # the pinned tag
docker compose up -d litellm         # recreate just this one
docker compose logs -f litellm       # watch boot: parse config + DB migrate
# after upgrade: diff /model/info against the pre-upgrade snapshot + run the 6-probe smoke

The top risk = database migrations, so dump Postgres every time before pulling

Pro tip — field-tested advice

★ PROD LESSON
A backup never restored = nonexistent — we test a real restore at least once a year by loading the dump onto a test machine — the first time you try, you will certainly find what is missing from your own backup script (everyone does)
★ PRO TIP
Write down every upgrade — a simple table: date | what | from->to | smoke result | rollback needed — three months later, when someone asks "when did it start breaking?", this table is the cheapest correct answer

FAQ

Q: How often should I update? — an urgent CVE = immediately but by the 6 rules; normal = once a month in a night window; macOS = only in a quiet week

Q: So broken you do not know what to do? — roll the whole stack back to its previous tags (possible because everything is version-pinned + you have dumps), then hunt the cause on a copy, not on the live system customers are using

For other questions see the FAQ

See also

Figures

The 3-tier fallback ladder — why the system tolerates upgrades
While one component is being upgraded, the other two tiers temporarily take over the work
Sample form for recording a data backup
A form for the team's real notes — not an actual backup result
Summary card: three rules before an upgrade — back up, change one thing at a time, check the result
Summary card from the manual — not a real screenshot

Video

Real screen recording for this lesson · click play to hear the summary · not investment advice