This file captures the details an operator or automation agent needs to keep the backend healthy.
- Unit file:
/etc/systemd/system/zqs-terminal.service. - Runs
/opt/zqsdev/bin/zqs-terminal-serveras thezqsdevuser withWorkingDirectory=/opt/zqsdev. - Environment is loaded from
/etc/zqsdev/server.env(containsOPENAI_API_KEY,GROQ_API_KEY,GOOGLE_API_KEY,HOST=0.0.0.0,PORT=8787,STATIC_DIR=/opt/zqsdev/static,RUST_LOG=info). - Manage lifecycle with
sudo systemctl status|restart|stop zqs-terminal.service; logs append to/opt/zqsdev/backend.log(mirrored as./backend.log) and can also be read withjournalctl -u zqs-terminal.service. - The service binds to TCP
0.0.0.0:8787and automatically restarts on failure (Restart=on-failure,RestartSec=5s). Tail the live log withmake backend-log.
- Nginx proxy:
/etc/nginx/sites-enabled/api.zqsdev.comforwards HTTPS traffic onapi.zqsdev.comtohttp://127.0.0.1:8787. Keep the/api/*prefix when adding new endpoints. - TLS certificate: managed by Certbot (
/etc/letsencrypt/live/api.zqsdev.com/), renews automatically. - If the proxy breaks, reload Nginx with
sudo systemctl reload nginxafter adjustments. - Netlify rewrite:
/api/*→https://api.zqsdev.com/api/:splat. Re-deploy the site after editingnetlify.toml. - Netlify build pipeline: publish-only (no build command). Always run
make build && make testlocally so the committedstatic/assets andbuild_id.jsare fresh before pushing.
Run make update from the repo root to:
git pull --rebasethe repository.- Rebuild the WebAssembly bundle and proxy binaries (
make build).make buildnow chains intomake rag, so ensureOPENAI_API_KEY/PINECONE_API_KEY/PINECONE_HOSTare exported beforehand. SetSKIP_RAG=1 make buildif you intentionally want to skip the RAG refresh (CI boxes without secrets should always do this).- The final step in
make buildiscargo build --release --manifest-path server/Cargo.toml; copy the resultingtarget/release/zqs_terminal_serverto/opt/zqsdev/bin/zqs-terminal-server(useinstall+rename to avoid “text file busy”) before restarting the service, or the backend will continue serving the previous version even after a restart.
- Restart the systemd unit (
sudo systemctl restart zqs-terminal.service).
- Before handoff, run
make buildandmake testso the maintainer can refresh the live site with confidence. - Typical deploy loop:
make build && make test,git push(Netlify redeploys the frontend automatically), restart the backend before running any prod tests withsudo systemctl restart zqs-terminal.service, and only then runmake autotest BASE_URL=https://www.zqsdev.comto smoke-test production. make updateexpects a clean working tree; regenerate artifacts, stage them (rememberstatic/build_id.jsandstatic/pkg/**/*), or stash before running so the initialgit pull --rebasesucceeds.static/build_id.jsis now tracked; always include the regenerated file produced bymake buildin your commits so Netlify's auto-deploys never fall back to the?build=devcache-buster.make autotestnow fails fast if the deployedbuild_id.jsever falls back to"dev", ensuring production assets are tied to a real commit.- Extend the automated test suite for every new feature or bugfix fix to keep coverage trending upward.
- Run
make rag(orpython3 scripts/build_rag.py --skip-pinecone) after editing anystatic/data/*.jsonso the SQLite cache mirrors the résumé data even if Pinecone is updated later;make rag-inspectdumps per-source stats if you want to verify the on-disk contents. - After deploying, run
make autotest BASE_URL=https://www.zqsdev.com(or your target) to ensure/api/aireturns grounded answers withcontext_chunksmetadata. - Use the hidden
versionterminal command (ormake version-check) to verify the frontend and backend are running the same release and to grab the GitHub commit links directly from production. - If
make version-checkreports an outdated backend commit, confirm the install/copy step above actually replaced/opt/zqsdev/bin/zqs-terminal-serverand then rerun the restart; the API only reports the embeddedenv!(\"CARGO_PKG_VERSION\")from the running binary.
- The project version lives in
VERSION,Cargo.toml, andserver/Cargo.toml. - Always bump the version number before every commit with
python3 scripts/bump_version.pyormake bump-version. Do this prior to edits so both frontend and backend artifacts report the new release identifier and theversioncommand stays trustworthy. Immediately stage the updatedVERSIONfile (git add VERSION) and runmake ensure-version-bumpedto verify the bump is present in your staged changes before committing.