Skip to content

Deploy via systemd + fix provider-view duplicate appointments + harden preview build cleanup#51

Open
pierzchala-m wants to merge 14 commits into
mainfrom
feat/systemd-deployment
Open

Deploy via systemd + fix provider-view duplicate appointments + harden preview build cleanup#51
pierzchala-m wants to merge 14 commits into
mainfrom
feat/systemd-deployment

Conversation

@pierzchala-m

@pierzchala-m pierzchala-m commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Three changes from this session:

1. feat(deploy): run the server under systemd instead of Docker

Production now runs the compiled Node.js server (node dist/server.js) directly
under systemd, replacing the previous Docker Compose deployment.

  • Adds deploy/fhirtogether.service (Type=simple, Restart=always, reads .env).
  • Documents install / update / logs commands in QUICKSTART.md.
  • References the deploy docs from README.md and .github/copilot-instructions.md (DRY — no duplicated command blocks).
  • Dockerfile / docker-compose.yml are kept for local containerized runs; docker-compose.inferno.yml (Inferno harness) is untouched.

Applied on the host: old restart-app.service (docker compose wrapper) disabled, container removed, DB ownership restored from root to the service user, new unit installed/enabled. Verified active (running), /health{"status":"healthy","store":"sqlite"}, /scheduler/provider-view.html → HTTP 200.

2. fix(scheduler): de-duplicate booked slots in the provider appointment list

Booked appointments and the busy slots they consume were both rendered, so every
booked appointment showed twice (a "Blocked" card and a "Busy" card). The timeline
now suppresses any slot referenced by an appointment's slot[] or sharing its
start/end. Free / unbooked slots are unaffected. Verified live in the provider view.

3. fix(ci): prevent preview build-and-push failure on non-JSON Launchpad responses

The preview workflow cleanup step could fail before build/push when Launchpad returned
a non-JSON response and jq parsing aborted the job. The workflow now validates response
JSON before parsing and skips cleanup safely when the response is not valid JSON.

Documentation update

Before/after provider-view screenshots are available in the repository for PR description embedding at:

  • packages/fhir-scheduler/docs/screenshots/provider-appointments-before.png
  • packages/fhir-scheduler/docs/screenshots/provider-appointments-after.png

README references to those two images were removed.

Test plan

  • npm run build succeeds (with existing pre-existing type warnings in package dts generation).
  • systemd service runs and serves port 4010.
  • Provider view shows each booked time once (no Blocked+Busy duplication).
  • Preview workflow cleanup no longer hard-fails on non-JSON Launchpad API responses.

Booked appointments and the busy slots they consume were both rendered,
showing every appointment twice (a 'Blocked' card and a 'Busy' card).
Suppress slots referenced by an appointment's slot[] or sharing its
start/end so each booked time appears once. Free/unbooked slots are
unaffected.
Add deploy/fhirtogether.service to run the compiled Node.js server
(node dist/server.js) directly under systemd, reading config from .env.
Document install/update/log commands in QUICKSTART, reference them from
README and copilot-instructions (DRY). Docker files remain for local use.
Copilot AI review requested due to automatic review settings June 5, 2026 15:29
…y systemd)

Production now runs as a host-local systemd service updated manually, so the
launchpad/Docker auto-deploy on push (deploy-production.yml) is obsolete and
conflicting. Removed it and clarified in copilot-instructions that prod deploys
are manual; pr-preview.yml still uses Docker for ephemeral PR previews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates FHIRTogether’s production deployment documentation/artifacts to run the compiled Node.js server under systemd, and fixes a scheduler provider-view UI issue where booked times were rendered twice due to both Appointment and underlying Slot entries being displayed.

Changes:

  • Add a systemd unit file and document install/update/log commands for non-Docker production deployment.
  • Update top-level docs to point to the new deployment instructions.
  • De-duplicate timeline rendering in the provider appointment list by suppressing slots consumed by appointments.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Adds a short note linking to the new systemd deployment docs/unit.
QUICKSTART.md Adds a “Deploy with systemd” section with install/update/log instructions.
packages/fhir-scheduler/src/components/AppointmentList.tsx Suppresses slots that are consumed by appointments to prevent duplicate cards.
deploy/fhirtogether.service Introduces the systemd unit to run node dist/server.js in production.
.github/copilot-instructions.md Documents systemd deployment approach for Copilot context.

Comment thread deploy/fhirtogether.service
Comment thread .github/copilot-instructions.md
The reset flow now stops/starts the fhirtogether systemd service rather than
the (removed) docker compose stack, matching the systemd deployment model.
The 'Delete failed container' step crashed when the launchpad API returned a
non-JSON body (jq parse error -> exit 5 under bash -e). Guard the jq calls so a
bad response yields an empty value instead of aborting the preview build.
@pierzchala-m

Copy link
Copy Markdown
Collaborator Author

failing check due to mieweb/launchpad#18

@pierzchala-m

Copy link
Copy Markdown
Collaborator Author

@copilot include in the PR description also screensoots with before/after images. update documentation if needed

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@copilot include in the PR description also screensoots with before/after images. update documentation if needed

Addressed in af64607. Added before/after provider-view screenshots and linked them in README (packages/fhir-scheduler/docs/screenshots/provider-appointments-before.png and ...-after.png) so the PR has ready markdown image references for the fix.

Copilot AI changed the title Deploy via systemd + fix duplicate provider appointment cards Deploy via systemd + fix provider-view duplicate appointments + harden preview build cleanup Jun 26, 2026
@github-actions

Copy link
Copy Markdown

Preview deployment is ready.

URL: https://mieweb-fhirtogether-feat-systemd-deployment.os.mieweb.org

Type=oneshot
User=monika
WorkingDirectory=/home/monika/FHIRTogether
ExecStart=/home/monika/FHIRTogether/scripts/reset.sh

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Monika

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.

4 participants