Files
HealthAppRepositoryB/deploy/INSTALLATION.md
T

34 lines
6.6 KiB
Markdown

# Architecture B native Linux installation
Build with the .NET 10 SDK: `HEALTHAPP_DOTNET=/path/to/dotnet bash deploy/build-release.sh --output NEW_DIRECTORY`. The bundle is independently deployable: one app, transient provisioner, module-owned migrations, dependency adapters and one systemd unit. No source checkout, container engine or other Health App services are required on the target.
Normal local installation, from the bundle: `sudo bash install.sh --host DNS_OR_IP`. It supplies missing dependencies, a fresh database, separate NOLOGIN schema owners and a restricted DML login role, generated account/database secrets, HTTPS certificate, protected configuration/key ring, migrations and a native application service. No manual database, password or certificate creation is required. Synthetic installer checks remain as clearly named prototype records; generated professional has no assignments. Assigned reads require predefined configuration, not an assignment-management API.
Existing `/opt/healthapp-b`, `/etc/healthapp-b`, `/var/lib/healthapp-b`, installation state or unit prevents installation before overwriting anything. Partial failures retain protected material and report the stage; there is no transactional installer rollback or automatic resume. Architecture A paths/databases are not modified. No production-data import is included.
## Distribution support
The installer is distribution-aware, not Ubuntu-only. Intended systemd x86_64 targets: Debian 12/13, Ubuntu 24.04, Fedora 43/44, RHEL-family systems with compatible native feeds, and current Arch/Manjaro. Actual package/runtime availability and systemd must pass preflight. Rolling-distribution dependency installation performs a full package update to avoid partial upgrades. Derivative version numbers are not silently substituted into unrelated upstream feeds. No universal Linux support is claimed.
APT uses native feeds, with identified Microsoft Debian or official Ubuntu .NET backports where necessary; DNF uses configured distribution feeds; pacman uses native repositories. PostgreSQL initialization/startup follows each family. In remote mode none of these adapters installs or starts local PostgreSQL.
Package choices follow [Microsoft Debian](https://learn.microsoft.com/en-us/dotnet/core/install/linux-debian), [Ubuntu](https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install), [Fedora](https://learn.microsoft.com/en-us/dotnet/core/install/linux-fedora), and [Arch ASP.NET package](https://archlinux.org/packages/extra/x86_64/aspnet-runtime/) documentation. Supported in design does not mean installation has been executed on every family. Verified: Debian 12 bookworm systemd local installation (PostgreSQL 15.19) and remote installation (PostgreSQL 18.6 with VerifyFull), .NET/ASP.NET 10.0.13. These are actual native services inside isolated Linux test environments sharing the Manjaro kernel; bare-metal/VM and other distributions are not independently verified. The implementation evidence register records this boundary.
## Remote PostgreSQL
Provide administrator-controlled reachable PostgreSQL, certificate/CA trust and restrictive network access. Put its administrative connection in an owner-only file (mode 600/400), including `SslMode=VerifyFull` and `RootCertificate=/path/to/trusted-db-ca.crt` when a private CA is used. Use a DNS name matching the DB certificate (or matching IP SAN), not an unverified alias. Credentials never go on a command line.
Run `sudo bash install.sh --mode remote --host APP_DNS --postgres-admin-file /secure/admin.connection`. The tool creates a new B database/roles/schemas remotely. Runtime config inherits verified encryption/hostname checks, replaces administrative identity with the generated restricted role, and copies an explicit DB CA into installed protected configuration. No local PostgreSQL dependency is installed. The database administrator supplies the existing remote host/administrative access; application database/user/secret setup is automated.
## Native runtime and trust
`healthapp-b.service` runs as `healthapp-b`, listens on one HTTPS endpoint (default 5443), and loads `/etc/healthapp-b/appsettings.json`. Its private key/config are root-owned and readable only by the service group. Token keys persist under `/var/lib/healthapp-b/keys` (service-owned mode 700). Migration identities are not runtime credentials. The runtime cannot create/drop schemas/tables or administer PostgreSQL. Local provisioning generates SCRAM credentials and adds a loopback authentication rule scoped only to the new B database/role, retaining existing rules and a protected backup. This handles distributions whose PostgreSQL defaults use ident authentication without weakening host-wide access.
The verifier validates certificate chain and hostname using the generated/supplied trust root. Export `/etc/healthapp-b/healthapp-ca.crt` to establish client trust separately; never disable certificate validation. Supplied certificate options: `--certificate PFX --certificate-password-file OWNER_ONLY_FILE --ca ROOT_CA_PEM`. Certificate replacement is an administrative operation: preserve backups, change PFX/password configuration with restrictive permissions, restart and verify trusted HTTPS. Prototype leaf validity is one year; CA two years; automatic renewal is outside scope.
The installer checks PID/HTTPS/configured DB/representative login/profile/observation/history/insight/overview, stops the app while PostgreSQL stays ready, restarts with a new PID and repeats verification. Liveness and readiness require a valid bearer ticket and disclose no patient information. Readiness checks keys, reference content and both migration versions; guidance/login can operate during DB-only outages.
`--dotnet /absolute/runtime/path` may reuse an existing .NET 10 ASP.NET runtime. Use a system-readable path outside `/tmp` and protected home directories because the service uses PrivateTmp and ProtectHome. Logs omit credentials/tokens/health payloads and identifying route values. Configuration controls pool size, request/assessment concurrency, deadline, accounts, assignments and token lifetime. Defaults are deployment starting values, not measured capacity or energy claims.
Before future upgrades: back up the B database, protected configuration and token keys; retain source/target revisions; stop or explicitly coordinate app access while privileged module migrations run; verify integrity and HTTPS/workflows before switching. No backup SLA, HA, live A import, automatic rollback or production/clinical certification is promised. Measurement host/data/workload equivalence must be controlled separately from installation evidence.