Skip to content

ci(deploy): reset hfs/hts DB on deploy and bootstrap hts terminologies#177

Merged
smunini merged 1 commit into
mainfrom
ci/deploy-reset-db-hts-bootstrap
Jun 17, 2026
Merged

ci(deploy): reset hfs/hts DB on deploy and bootstrap hts terminologies#177
smunini merged 1 commit into
mainfrom
ci/deploy-reset-db-hts-bootstrap

Conversation

@smunini

@smunini smunini commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Changes the CD deploy job in .github/workflows/ci.yml so that the hfs and hts deployments start from a clean database, and hts auto-loads its bundled terminologies on startup.

hfs

  • After stopping the service, deletes /opt/hfs/fhir.db (+ WAL/SHM) and the data/hfs.db* job-state variants. Search-parameter JSON under data/ is preserved — only .db files are removed.

hts

  • Deletes /opt/hts/data/hts.db*. This also clears the bootstrap_imports ledger, so terminologies re-import fresh on startup.
  • The "Extract release archive" step now also unpacks terminology-data (already bundled in the release tarball, previously discarded at deploy time).
  • That directory is scp'd to the host at /opt/hts/terminology-data.
  • The hts systemd unit now sets HTS_BOOTSTRAP_DIR=/opt/hts/terminology-data, triggering auto-import on startup.

Supporting change

  • The systemd unit is now written on every deploy instead of only when absent, so env changes (e.g. HTS_BOOTSTRAP_DIR) reconcile on hosts that already have the service. This also means changes like HFS_BASE_URL now reconcile for the other servers.

Notes

  • The hts bootstrap import runs synchronously at startup and can take a while. The deploy's is-active check uses Type=simple, so it passes once the process is up and won't fail the deploy while the import is still running.
  • fhirpath-server and sof-server deploys are unchanged (no DB to reset).

Wipe the database on each hfs and hts deploy so servers start clean.
For hts, ship the bundled terminology-data to the host and set
HTS_BOOTSTRAP_DIR so the server auto-imports all terminologies on
startup; clearing the DB also clears the bootstrap_imports ledger so the
import re-runs fresh each deploy.

Also write the systemd unit on every deploy (instead of only when
absent) so env changes like HTS_BOOTSTRAP_DIR reconcile on existing
hosts.
@claude

claude Bot commented Jun 17, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@smunini smunini merged commit d3aed9d into main Jun 17, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant