253 lines
14 KiB
Markdown
253 lines
14 KiB
Markdown
# US-16 — Provision and install HealthApp
|
|
|
|
The installer provisions a working prototype topology. A normal installation no longer
|
|
requires prepared application configuration, database roles/passwords, service keys,
|
|
or HTTPS certificates. Select one service, a comma-separated subset, or `all`.
|
|
|
|
The application DLLs and shared C# provisioning utility are portable. OS adapters
|
|
perform package installation and native service registration: systemd on supported
|
|
Linux hosts, Windows Services on Windows, and launchd on macOS. Deployment location
|
|
and OS do not combine services, introduce shared persistence or change gateway-routed
|
|
communication. There is no container/orchestration requirement.
|
|
|
|
## Build the release
|
|
|
|
A build machine needs the .NET 10 SDK and package access. It is distinct from a target
|
|
machine, where the installer supplies missing runtime/dependencies.
|
|
|
|
```bash
|
|
bash deploy/build-release.sh --output /tmp/healthapp-release
|
|
# Optional: build just a selected application's payload plus the provisioning utility.
|
|
bash deploy/build-release.sh --output /tmp/healthapp-insights --services insights
|
|
```
|
|
|
|
On a Windows build machine, use `deploy/build-release.ps1 -Output NEW_DIRECTORY`
|
|
from PowerShell with the same optional `-Services` selection.
|
|
|
|
The bundle includes the application DLLs, provisioning utility, OS installers, units,
|
|
examples and this guide. Windows services invoke `dotnet Application.dll`, so they do
|
|
not depend on a Linux-generated apphost executable. The small Microsoft WindowsServices
|
|
hosting dependency lets the same ASP.NET Core applications respond to Windows service
|
|
control; it is inactive on Linux/macOS. No production service references another service.
|
|
|
|
Transfer the release by normal administrative deployment transport. Public release
|
|
files contain no generated secrets. Build output must be a new directory.
|
|
|
|
## Normal Ubuntu/Debian installation
|
|
|
|
Automatic Linux package provisioning currently supports Ubuntu 24.04 and Debian 12/13,
|
|
with a running systemd manager and administrative access. This is the implemented
|
|
Linux adapter's supported set, not a restriction in the application binaries. Other
|
|
Linux distributions need corresponding package-manager integration before the installer
|
|
can claim native dependency provisioning there. Internet access to the signed OS/.NET
|
|
package feeds is needed when dependencies are absent.
|
|
|
|
From the release directory:
|
|
|
|
```bash
|
|
sudo bash install.sh --services all --host 192.168.1.20
|
|
```
|
|
|
|
Use the target's reachable DNS name/IP for `--host`. The default `localhost` is useful
|
|
for a wholly local prototype; use a reachable address for another computer to access
|
|
it. No later application-file editing is required.
|
|
|
|
For an individual service, use its name and an existing matching generated deployment
|
|
from the overall topology, which already specifies its remote dependencies/keys:
|
|
|
|
```bash
|
|
sudo bash install.sh --services insights --deployment /secure/generated-deployment
|
|
```
|
|
|
|
Names: `api-gateway`, `patient-profile`, `observation`, `insights`, `health-overview`.
|
|
|
|
The installer:
|
|
|
|
1. Detects .NET 10 ASP.NET Core runtime and local PostgreSQL availability; installs
|
|
missing dependencies from supported package feeds. PostgreSQL is provisioned only
|
|
when Patient/Profile or Observation is selected.
|
|
2. Generates a private deployment plan, independent service keys and synthetic
|
|
prototype accounts. No hard-coded passwords or hand-written password hashes are used.
|
|
3. Creates a private prototype CA and separate service certificates, installs the
|
|
public CA into OS trust, and configures Production HTTPS endpoints.
|
|
4. Creates separate PostgreSQL databases and login roles for the selected persistent
|
|
services. Roles cannot administer the server/create roles/databases or connect to
|
|
the other service's database. Schema ownership supports that service's migrations.
|
|
5. Creates independent service identities, application/configuration directories and
|
|
service registrations. Runs the selected persistent services' migrations, enables
|
|
and starts every selected application, then verifies startup and topology.
|
|
|
|
Linux application/configuration paths are `/opt/healthapp/NAME` and
|
|
`/etc/healthapp/NAME/service.env`. Env files are root-only; systemd passes their values
|
|
to the owning process. Certificate private keys are readable only by root and the
|
|
respective service identity. Units use `healthapp-NAME` users/groups, not a shared
|
|
application identity. Gateway key state remains gateway-owned.
|
|
|
|
Generated material normally resides at `/var/lib/healthapp-installation/deployment`
|
|
with a private directory and private files. `accounts.json` contains generated
|
|
`prototype-patient`, `prototype-professional` and `installation-check` passwords.
|
|
The professional starts without assignments. Do not put generated material in Git.
|
|
Only the CA's public certificate is installed/exported publicly; its signing private
|
|
key is not retained. Certificates expire after one year; the prototype CA after two.
|
|
|
|
## Topology and distributed installation
|
|
|
|
A topology specifies addresses, ports and native platforms, not credentials. Defaults
|
|
are HTTPS ports 5443/5081/5082/5083/5084. Colocated applications need different ports.
|
|
For example:
|
|
|
|
```json
|
|
{
|
|
"hosts": {
|
|
"api-gateway": "192.168.1.20",
|
|
"patient-profile": "192.168.1.21",
|
|
"observation": "192.168.1.22",
|
|
"insights": "192.168.1.23",
|
|
"health-overview": "192.168.1.24"
|
|
},
|
|
"platforms": {
|
|
"api-gateway": "linux",
|
|
"patient-profile": "linux",
|
|
"observation": "linux",
|
|
"insights": "macos",
|
|
"health-overview": "windows"
|
|
}
|
|
}
|
|
```
|
|
|
|
Optional `ports` uses the same service keys and integer values. Hostnames/IPs must
|
|
resolve/reach the corresponding target. Supply existing administrative SSH access;
|
|
Unix hosts need passwordless sudo for the installer, Windows SSH sessions must be
|
|
elevated administrators. Host administration credentials are distinct from generated
|
|
HealthApp/database credentials and are not invented by the application installer.
|
|
|
|
Generate one consistent deployment and automatically distribute matching, scoped
|
|
material to each host:
|
|
|
|
```bash
|
|
sudo bash install.sh --services all --prepare-only --topology topology.json \
|
|
--deployment /secure/healthapp-deployment --dotnet /path/to/available/dotnet
|
|
bash distribute.sh --deployment /secure/healthapp-deployment --ssh-user administrator
|
|
```
|
|
|
|
Use an administrative session able to read the protected deployment material. The
|
|
preparation machine needs an available .NET 10 runtime/SDK for the C# utility.
|
|
Distribution uses SSH/SCP, installs only selected applications per host, and exports
|
|
only their private material plus necessary remote origins. It starts nodes first,
|
|
then verifies the complete topology over its real HTTPS endpoints. No credentials
|
|
are manually invented, copied into application files or distributed individually.
|
|
Services never depend on a shared runtime directory/file across machines.
|
|
|
|
A node started with the orchestrator's `--defer-topology-check` has verified local
|
|
process/HTTPS/database readiness but pending cross-node verification. It is not
|
|
reported as a verified complete topology until the orchestrator's final check passes.
|
|
For incremental installation, reuse the same deployment; independently generated
|
|
plans deliberately have different keys and cannot authenticate to each other.
|
|
|
|
## Windows and macOS adapters
|
|
|
|
On Windows, from an elevated PowerShell session in the release:
|
|
|
|
```powershell
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1 -Services all -HostName 192.168.1.20
|
|
```
|
|
|
|
The adapter installs the .NET runtime automatically, resolves and checksum-verifies
|
|
an EDB PostgreSQL installer from Microsoft's package manifest, creates an owned
|
|
PostgreSQL service when needed, and generates its administrator secret in protected
|
|
files. Existing application/data files are not overwritten. An existing externally
|
|
managed PostgreSQL server can instead be used with `-PostgresAdminFile`; the installer
|
|
still generates application database roles/passwords automatically.
|
|
|
|
Applications have separate native Windows Services and virtual service identities,
|
|
protected per-service JSON configuration, state and certificate ACLs. Their Production
|
|
configuration is installed automatically; certificates are trusted in LocalMachine
|
|
Root. HTTPS firewall rules cover only selected application ports. No IIS is required.
|
|
Windows uses `-Deployment`, `-Topology`, `-Certificates` for the same shared material.
|
|
Default application root is `%ProgramData%\HealthApp`.
|
|
|
|
On macOS, from a sudo administrator session:
|
|
|
|
```bash
|
|
sudo bash install.sh --services all --host 192.168.1.20
|
|
```
|
|
|
|
The Darwin adapter installs the ASP.NET Core runtime, provisions Homebrew/PostgreSQL
|
|
and required Apple build tools where available through softwareupdate, initializes
|
|
an installer-owned PostgreSQL cluster with SCRAM passwords, and creates separate
|
|
hidden service identities and launchd daemons. It configures system-keychain CA trust,
|
|
private environment/launchd files and selected migrations automatically. Default root
|
|
is `/Library/Application Support/HealthApp`. macOS package/tool installation requires
|
|
an administrator user session, network access, and acceptance of OS/vendor licensing.
|
|
|
|
The adapters target supported .NET desktop/server operating systems. Portability does
|
|
not claim support for every OS/kernel/version/CPU where .NET itself is unavailable.
|
|
The live Windows/macOS registration paths need native-host validation; see evidence
|
|
limits below. The Linux execution environment cannot run Windows SCM or macOS launchd.
|
|
|
|
## Verification and management
|
|
|
|
Installation verifies distinct native processes, configured HTTPS endpoints, selected
|
|
databases using their dedicated credentials, actual service keys and outgoing gateway
|
|
access. The complete-system check logs in with the generated `installation-check`
|
|
account and exercises profile/observation/Overview through all deployed services.
|
|
It creates at most one clearly labelled synthetic check profile/observation if absent.
|
|
This is prototype test data, not a clinical reading; repeated verification reuses it.
|
|
|
|
The verifier trusts the generated public CA, validates certificate chains/server names,
|
|
and never disables TLS validation. Existing HTTPS trust is retained. All step failures
|
|
identify the failed operation/service and retain existing data/material for inspection.
|
|
Sensitive SQL/credentials are not printed. Existing applications/configuration cause
|
|
refusal rather than silent replacement; this remains a first-install mechanism,
|
|
not an upgrade/uninstall/data-removal tool. Deployment is not a cross-service transaction.
|
|
|
|
Linux may rerun `sudo bash verify.sh --services all --deployment DIRECTORY` from the
|
|
bundle. Manage selected units with `systemctl start/stop/restart healthapp-NAME`.
|
|
Windows uses `Start-Service`, `Stop-Service`, `Restart-Service`; macOS uses
|
|
`launchctl bootstrap`, `bootout`, `kickstart` on `healthapp-NAME` labels. Stopping a
|
|
service does not directly stop peer processes; requests needing it may fail.
|
|
|
|
External trusted certificates can be supplied during preparation with `--certificates`
|
|
or `-Certificates`. The directory supplies `NAME.pfx`, `NAME.password` for all five
|
|
planned services and `healthapp-ca.crt`. Supplied PFX certificate chains are retained;
|
|
private keys/passwords are protected and configured automatically. Prototype browser
|
|
clients may import the exported public CA for trust; server-side service trust is
|
|
configured automatically by installation.
|
|
|
|
`--root DIRECTORY` on Linux is explicitly offline staging: it generates the same
|
|
settings/material but cannot install host packages or register/start systemd. It is
|
|
not reported as a live verified installation. `--postgres-admin-file` allows automated
|
|
DB provisioning against an externally managed/test server, not manual application
|
|
DB/user preparation. Normal Linux installation administers local PostgreSQL through
|
|
its OS postgres identity without inventing a PostgreSQL administrator password.
|
|
|
|
## Evidence and dependencies
|
|
|
|
The xUnit deployment suite builds the release, calls the actual provisioner/installer,
|
|
creates database roles/databases in an isolated PostgreSQL server and runs all five
|
|
installed services in separate Production-mode HTTPS processes. Tests cover generated
|
|
key matching/uniqueness, certificate private-key output, private configuration, database
|
|
isolation/permissions, migrations, native-format configuration, independent restart,
|
|
representative functionality and repeated non-destructive verification. Package command
|
|
contracts are tested with controlled command doubles; no host package installation
|
|
is performed by the tests. The ordinary application tests remain unchanged.
|
|
|
|
Linux HTTPS/interservice/database execution is verified here. Live systemd package/
|
|
registration behaviour needs a supported Linux host; Windows/macOS service registration
|
|
needs those native hosts. Native configuration formats are exercised by the shared
|
|
utility tests; shell/PowerShell syntax validation is separate from a native end-to-end
|
|
run. The manual `.github/workflows/prototype-native-install.yml` workflow provisions
|
|
and verifies fresh Ubuntu, Windows and macOS runners; it is supplied for native
|
|
validation and has not been executed remotely in this session. These limits must not be described as verified production deployment on every OS.
|
|
|
|
The provisioning tool uses standard .NET X.509/password hashing and Npgsql for creating
|
|
and checking databases. Its dependency is not a shared service runtime library.
|
|
Microsoft.Extensions.Hosting.WindowsServices is added to the five services solely for
|
|
native Windows service lifetime integration; Linux/macOS responsibilities are unchanged.
|
|
|
|
Package/lifetime references reviewed during implementation:
|
|
[Ubuntu runtime installation](https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install),
|
|
[Debian runtime installation](https://learn.microsoft.com/en-us/dotnet/core/install/linux-debian),
|
|
[Windows service hosting](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/windows-service?view=aspnetcore-10.0),
|
|
[EDB unattended installer parameters](https://www.enterprisedb.com/docs/supported-open-source/postgresql/installing/command_line_parameters/).
|