11 KiB
US-16 — Independent Linux installation
The installer supports one service, a comma-separated subset, or all. The same
published application executables work for colocated and distributed deployments.
Each service retains its own process, environment file and systemd registration.
No additional service, shared persistence, shared application library or communication
shortcut is introduced. Application services continue communicating through the API Gateway.
Supported host and prerequisites
Use a Linux host with Bash 4 or later, GNU core utilities/grep/sed, a running systemd
system manager with systemd-run, and the .NET 10 ASP.NET Core runtime. Live installation
requires root and the standard getent, groupadd, useradd and id tools. Network
verification additionally requires curl. Building a release requires the .NET 10 SDK
and the repository's NuGet dependencies; deployment hosts do not need the SDK/source.
Provision PostgreSQL for Patient/Profile and Observation separately, with independent database names/users and credentials matching each service's configuration. The DBs may be on remote hosts. Insights and Health Overview have no databases. Provision trusted HTTPS certificates and the externally configured accounts/service credentials before starting production services. The installer does not install an identity provider, PostgreSQL, runtime packages or certificates and does not generate accounts. These remain administrator-supplied prerequisites, as in the existing deployment model.
Build a release
From the repository root:
bash deploy/build-release.sh --output /tmp/healthapp-release
# Or publish only the service(s) needed on a particular host:
bash deploy/build-release.sh --output /tmp/healthapp-insights-release --services insights
Output must be a new directory. Optionally set HEALTHAPP_DOTNET to the SDK executable.
The release contains selected payloads under services/, their systemd units,
configuration examples, installation/verification scripts and this guide. Transfer it
to the target Linux host using your normal deployment transport. Release contents
are trusted executable deployment input; configuration secrets are not part of it.
Prepare independent configuration
Copy each selected examples/NAME.env.example to a protected administrator directory
as NAME.env. Replace placeholders with actual values. Existing examples deliberately
use remote hostnames and separate DB credentials; they are not usable credentials.
Service names and resulting paths:
| Selection name | Application | Configuration | systemd unit |
|---|---|---|---|
| api-gateway | ApiGateway.dll | /etc/healthapp/api-gateway.env | healthapp-api-gateway.service |
| patient-profile | PatientProfileService.dll | /etc/healthapp/patient-profile.env | healthapp-patient-profile.service |
| observation | ObservationService.dll | /etc/healthapp/observation.env | healthapp-observation.service |
| insights | InsightsService.dll | /etc/healthapp/insights.env | healthapp-insights.service |
| health-overview | HealthOverviewService.dll | /etc/healthapp/health-overview.env | healthapp-health-overview.service |
Supply each service's own network binding via ASPNETCORE_URLS, its needed endpoints,
credentials and (where applicable) DB connection string. The gateway needs all service
origins/keys even when their services are deployed on other machines. Other services
need only their documented dependencies; installation does not require them locally.
Use distinct service credentials in both directions, matching the gateway and service
settings described in src/AUTHENTICATION.md. Never reuse example placeholders.
Keep production ASPNETCORE_ENVIRONMENT=Production and configure HTTPS origins,
certificate path/password and trust chains on each host. Certificate files must be
readable by the healthapp service identity. For example, externally provision files
under /etc/healthapp with group healthapp and mode 0640. The installer makes that
directory root-owned with group access, and environment files root-only 0600;
systemd reads environment files and passes values into the relevant process.
Authentication__KeyDirectory belongs to the gateway host alone. The gateway unit's
StateDirectory creates /var/lib/healthapp-api-gateway; its keys child is created
by data protection. Other machines never require that directory or another service's
local application/configuration files. Only configured network APIs cross machines.
For local development tests, Development permits HTTP; production still requires HTTPS. No deployment path/hostname is hard-coded in an application.
Install selected services
From the transferred release directory, assuming prepared config in /root/healthapp-config:
# One service, with dependencies running on independently configured hosts:
sudo bash install.sh --services insights --config-dir /root/healthapp-config
# A subset (use this instead of the preceding command on a fresh host):
sudo bash install.sh --services patient-profile,observation --config-dir /root/healthapp-config --migrate
# Complete fresh installation:
sudo bash install.sh --services all --config-dir /root/healthapp-config --migrate --start
--bundle DIRECTORY selects a release explicitly. --dotnet /absolute/runtime/path
changes only ExecStart in selected units, when dotnet is not installed at /usr/bin/dotnet.
The installer checks the .NET 10 ASP.NET Core runtime on a live host.
Installation creates the conventional healthapp service user/group if absent,
copies selected independent applications to /opt/healthapp/NAME, copies selected
configurations to /etc/healthapp/NAME.env, registers selected units under
/etc/systemd/system, reloads systemd and enables only those units for boot.
It preflights the full selection before writing files. Unselected service files,
configuration and registrations are untouched; no service dependency/PartOf/BindsTo
relationships are introduced between HealthApp units.
Default installation does not start services or modify schemas. --migrate explicitly
runs the selected Patient/Profile and/or Observation application's existing migration
mode, under its service identity/configuration, using a transient systemd unit. It
never migrates Insights/Overview or another service's DB. --start explicitly starts
the selected units after successful installation/migrations. For migrations run
separately, use the existing published --migrate commands with that service's
configuration, then start its unit.
Existing installation directories, env files or units cause refusal before writes. This is a first-install mechanism, not an upgrade/uninstall tool. It never overwrites existing configuration, removes persistent data or guesses how to rotate credentials. A live copy/migration/systemd error can leave installed files or earlier selected units configured; the command fails and those files/data are retained for administrator inspection. There is no cross-service deployment transaction or automatic rollback.
--root /absolute/staging/directory stages an offline filesystem tree without root,
user creation, runtime checks or systemctl calls. It is for testing/image preparation,
not a completed live installation. It refuses --start/--migrate. Provision the
runtime, healthapp user/group, config-directory group/certificate access and gateway
state-directory ownership on the target, then reload/enable/start the selected units.
The paths inside each unit refer to the target's /opt and /etc, not to the
staging directory. Never mistake successful staging for successful startup.
Manage and verify installation
Each unit can be independently managed using, for example:
sudo systemctl start healthapp-insights.service
sudo systemctl stop healthapp-insights.service
sudo systemctl restart healthapp-insights.service
sudo journalctl -u healthapp-insights.service
Stopping a dependency may cause application requests needing it to fail; it does not stop peer processes. Services need no local process-start ordering or shared memory.
Prepare a protected probe directory with NAME.curl files for each selected service.
These are curl data configuration files (not shell scripts), containing the actual
HTTPS URL, trusted CA and credentials appropriate for a read-only HTTP 200 request.
For example, Insights can use a configured patient/period that has observation data:
url = "https://insights.example.test:5083/api/patients/PATIENT_ID/insights?from=2026-09-01&to=2026-09-10"
header = "X-Gateway-Key: ACTUAL_INSIGHTS_GATEWAY_CREDENTIAL"
cacert = "/etc/healthapp/trusted-ca.pem"
Use corresponding profile GET, latest-observation GET and Overview GET probes on those services. For API Gateway use a bearer-authenticated Overview GET. For a complete installation that probe must select a prepared patient/period with profile, latest reading and calculated insight, thereby exercising the documented gateway and all four application services. Ensure representative records exist through the normal APIs before verification. Public guidance alone cannot verify dependencies. Keep probes root-only; their credentials do not belong in the release or repository. Do not disable certificate verification. Select test/deployment data appropriate to the environment rather than letting installation create patient information.
sudo bash verify.sh --services all --probe-dir /root/healthapp-probes
# Explicitly permits independently stopping/starting/restarting every selected unit:
sudo bash verify.sh --services all --probe-dir /root/healthapp-probes --cycle
Verification checks active units, distinct real PIDs and each configured network
probe's HTTP 200 response. --cycle checks peer units stay active during each stop,
then starts/restarts that service and probes it again. HTTP response bodies and
credentials are suppressed. Probes fail on connection errors, unexpected status or
an exited process. Verification fails rather than treating unavailable sources as
missing data. Use the same mechanism on every host for a distributed deployment;
the complete-system gateway probe checks the configured remote communication paths.
Automated evidence and limits
tests/Deployment.AcceptanceTests publishes a release, installs into temporary roots,
and launches the installed assemblies as separate OS processes against temporary,
independent PostgreSQL databases. It covers selection, preflight failures, independent
config files/permissions/units, standalone startup for every service, multiple/all
processes, authenticated profile/observation/Overview workflow, per-service graceful
stop/restart, retained data and separate persistence. There are no production service
project references in this test project and no test authentication replacement.
Run with Linux, Bash, .NET 10 SDK, and TEST_POSTGRES_CONNECTION referencing a DB
account allowed to create isolated test databases. HEALTHAPP_DOTNET may select the
SDK/runtime executable. Ordinary acceptance tests remain available in the solution.
This development execution environment has no running systemd manager. Automated process tests therefore use direct process launch and SIGINT (the same configured stop signal); live systemctl registration/boot cycling and production certificates must be verified with the supplied verifier on a supported target Linux host. The suite does not claim that localhost testing alone proves a deployment on separate physical machines. Remote origins and independent configuration are preserved by installation, and the target-host gateway probe is the distributed-system check.