Fraktal Web HMI and Gateway Deployment Walkthrough
This walkthrough takes a deployed, TF6100-published Fraktal PLC from OPC UA to
a local or remote browser HMI. It covers the shipped Windows installer and the
Linux systemd package. Follow FIRST_PROJECT_AGENT_GUIDE.md through Phase E
first; this document does not replace PLC, TF6100, or functional-safety
commissioning.
1. Resulting topology
Section titled “1. Resulting topology”The gateway is the only component that talks OPC UA to the PLC. It also serves the compiled Flutter Web HMI, so a separate static web server is not required.
same-host browser http://127.0.0.1:8080/ | vFraktal gateway on loopback ---- opc.tcp/SignAndEncrypt ---- TF6100 ---- PLC | static Web HMI | /fraktal WebSocket | /livez /readyz /healthz
remote browser https://hmi-cell-01.example/ | authenticated TLS reverse proxy | v http://127.0.0.1:8080/ + ws://127.0.0.1:8080/fraktalThe gateway always binds to loopback. Remote access therefore has one explicit security boundary: a same-host reverse proxy authenticates the browser, terminates TLS, and forwards ordinary HTTP plus the WebSocket upgrade.
One gateway process owns one PLC session. A host that serves several controllers runs one instance per PLC, each with its own loopback port, its own published origin, and its own supervision — so an unreachable controller or a stalled router takes down that PLC’s gateway and nothing else:
https://cell.example -> 127.0.0.1:8080 instance "press" -> PLC Ahttps://cell.example:8443 -> 127.0.0.1:8081 instance "oven" -> PLC B (one reverse proxy, one site block and one origin per instance)Each instance needs a whole origin, not a path: a release Web HMI derives its
WebSocket endpoint from the page origin, so https://cell.example/press cannot
be made to reach a second gateway. Ports and origins are therefore unique per
instance, and the installer refuses a set that repeats either.
2. Choose a deployment path
Section titled “2. Choose a deployment path”| Target | Recommended path | Starts automatically | Web HMI included |
|---|---|---|---|
| Windows kiosk/engineering HMI user | FraktalSetup.exe |
At that user’s sign-in, as a tray application | Yes |
| Windows without an interactive login | Headless package + Task Scheduler under a dedicated account | At boot/task trigger | Yes |
| Linux IPC | Packaged gateway + supplied systemd unit | At boot | Yes |
| Development only | flutter run -d chrome + packaged/source gateway |
No | Chrome debug server; gateway on port 8080 |
The tray installer is ideal for a dedicated kiosk or auto-logon account. Use a service/task identity when the gateway must run before login or while nobody is logged in.
3. Prerequisites and recorded inputs
Section titled “3. Prerequisites and recorded inputs”Do not install the HMI layer until these checkpoints are known:
- PLC target identity, runtime name, ADS port, and active
Port_<ADS port>.tmc; - TF6100 initialized, licensed, and publishing the PLC Data Access namespace;
- authorized browse showing
PLC1/MAIN/<Root>/Status,HmiRequest, andHmiResponse; - chosen gateway profile and owner:
production,secure-anonymous,commissioning-anonymous, orisolated-anonymous; - exact root browse paths assigned to this gateway, for example
PLC1/MAIN/PneumaticPress; - for a multi-PLC host: the instance name, PLC endpoint, loopback port, and public origin of every controller this host serves, decided before installation — each is a separate gateway process;
- production gateway application URI, client certificate/private key, server trust list, dedicated TF6100 username/password, and their provisioning owner;
- local-only or remote-browser URL and, for remote access, the reverse proxy’s TLS certificate and authentication method.
Production shall use a trusted OPC UA client certificate, SignAndEncrypt, and
a dedicated TF6100 user. Anonymous/None is limited to bounded commissioning or
a documented physically isolated exception.
4. Build one gateway + Web HMI package
Section titled “4. Build one gateway + Web HMI package”The packaging command builds the Flutter Web release first, then the native gateway and bridge. It copies the exact Web output into the platform package.
cd C:\Projects\Fraktal\FraktalCore\HMIflutter pub getflutter analyzeflutter test
cd gatewaydart pub getdart run tool/build_gateway.dart --cleanWindows outputs:
HMI\build\gateway\windows-x64\ fraktal_gateway.exe fraktal_gateway_tray.exe fraktal_opcua.dll WEB_HMI_GATEWAY_DEPLOYMENT.md web\index.html ...
HMI\build\gateway\installer\FraktalSetup.exe # includes verified CaddyLinux outputs the equivalent linux-x64 package with fraktal_gateway,
libfraktal_opcua.so, web/, the single-PLC systemd unit, the templated
fraktal-gateway@.service for a multi-PLC host, and both environment examples.
Build on the target operating system; the native gateway is not cross-compiled.
Sign the Windows installer and binaries with the organization’s Authenticode certificate before production distribution. Record release hashes with the PLC/TMC and configuration exports.
5. Windows installer walkthrough
Section titled “5. Windows installer walkthrough”5.1 Install
Section titled “5.1 Install”- Sign or verify the supplied installer according to site policy.
- Run
FraktalSetup.exeas the Windows account that will own the tray. - In the wizard, select Fraktal Gateway + Web HMI. The installer asks the
local TwinCAT router for its configured AMS Net ID and seeds
ads://<detected-AmsNetId>:851. If router discovery is unavailable, the wizard visibly falls back toads://127.0.0.1.1.1:851; confirm it before installation. - Fill in the gateway instance list — one row per PLC. A fresh install
starts with one instance named
defaulton port 8080; an upgrade shows the instances already installed. Use the HMI / local PLC endpoint for the first Gateway instance is checked by default, so row one mirrors the HMI/local value; clear it only when that instance must use a different ADS runtime or an OPC UA endpoint. Add PLC… appends a row with the next free port and a suggested origin; give each its own name, endpoint, port, and — when it is published — its own HTTPS origin. The wizard refuses duplicate names, ports, and origins before writing anything. - Decide, per instance, whether the browser may command that PLC.
Allow operator commands from the browser writes
--write-root; cleared, the instance is a read-only viewer and the gateway refuses every operator command before it reaches the PLC. The scope is the published root Unit and its shape follows the transport —PneumaticPressover ADS,PLC1/MAIN/PneumaticPressover TF6100 OPC UA — comma-separated for a multi-root HMI. The wizard confirms any read-only instance before installing, because “every command is refused” is otherwise discovered at commissioning with no obvious cause. The native HMI is unaffected, and the PLC re-checks its own release/access gates either way. - For remote browsers, leave secure remote Web HMI selected and enter one proxy account/password for the host; every instance that has an origin is published as its own HTTPS site under that account. Allow the local-subnet Windows Firewall rule, which covers every published port. For same-host-only use, clear that option (or leave an instance’s origin blank to keep just that PLC local).
- The installer writes program files to
%LOCALAPPDATA%\Programs\Fraktal Gatewayand one arguments file per instance under%LOCALAPPDATA%\Fraktal\Gateway\instances\<name>\gateway.args, each carrying its--instance-name,--plc-endpoint, numeric--port,--web-root, and — when published — its exact--allow-origin. It preserves site data under%LOCALAPPDATA%\Fraktal\Gateway, creates Start Menu and Startup shortcuts (one configuration shortcut per instance), and starts the tray. - The remote option configures the bundled, checksum-pinned Caddy executable
at
%LOCALAPPDATA%\Fraktal\Gateway\proxy\Caddyfile, one site block per published instance. It hashes the password through Caddy’s stdin, stores only the Argon2id hash, generates an internal LAN CA, validates the Caddyfile before publishing it, and exposes only the selected HTTPS ports from Domain/Private profiles and the local subnet. The checked Trust this gateway CA option installs the public root into the current Windows user’s Root store on the gateway PC only. Accept Windows’ visible certificate-security confirmation when prompted; the installer aborts that step after two minutes rather than waiting invisibly forever. - Upgrades replace binaries and the Web HMI but preserve every instance’s
gateway.args, the proxy password hash, proxy CA, OPC UA PKI, and logs when both new password fields are left blank — including when the upgrade adds a PLC, because the routing is regenerated from the stored account. A pre-instances installation’s singlegateway.argsis migrated intoinstances\<first>\with its site scoping intact, and the original is kept asgateway.args.migrated. An instance removed in the wizard is retired togateway.args.removedrather than deleted, and re-adding the same name restores it. Uninstall also preserves those site-owned files intentionally.
5.2 Configure gateway.args
Section titled “5.2 Configure gateway.args”Each instance owns one arguments file, and that file is the only place its settings live — there is no separate index to keep in step:
%LOCALAPPDATA%\Fraktal\Gateway\instances\press\gateway.args%LOCALAPPDATA%\Fraktal\Gateway\instances\oven\gateway.args%LOCALAPPDATA%\Fraktal\Gateway\logs\press\gateway.logThe folder name is the instance name (1–32 letters, digits, ., _, -). The
tray runs every subfolder that has a gateway.args, so an instance can be added
or retired by hand and picked up with Reload instances — but let the wizard
do it when the proxy is involved, since the routing must change with it.
The file uses one option or value per line. Environment variables are expanded. The installed production template already includes the Web root:
--instance-namepress--plc-endpointopc.tcp://127.0.0.1:4840--port8080--path/fraktal--web-root%LOCALAPPDATA%\Programs\Fraktal Gateway\web--allow-originhttps://192.168.100.126--security-profileproduction--security-policyhttp://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256--application-uriurn:fraktal:gateway:CELL-01--client-certificate%LOCALAPPDATA%\Fraktal\Gateway\pki\own\certs\fraktal-gateway.der--client-private-key%LOCALAPPDATA%\Fraktal\Gateway\pki\own\private\fraktal-gateway.pem--trust-list%LOCALAPPDATA%\Fraktal\Gateway\pki\trusted\certs--read-rootPLC1/MAIN/PneumaticPress--write-rootPLC1/MAIN/PneumaticPressRepeat --read-root and --write-root for a multi-root deployment. Add a
separate --read-root for standalone published data such as
PLC1/GVL_PressFieldbus/Topology. Without --read-root, the upstream OPC UA/ADS
identity remains the read boundary; without --write-root, the gateway is
deliberately read-only. Never use --allow-all-root-mailboxes as the production
scope.
Do not put passwords in gateway.args. Provision these for the gateway process
identity through the site’s protected Windows credential/process-environment
mechanism:
FRAKTAL_OPCUA_USERNAMEFRAKTAL_OPCUA_PASSWORDFRAKTAL_OPCUA_PRIVATE_KEY_PASSWORD # only for an encrypted private keyRestart the tray after changing process credentials. Use the tray menu to edit
gateway/proxy configuration, open logs, restart supervised processes, open the
Web HMI, or inspect gateway health — per instance under its own submenu once
there is more than one, plus Start/Stop/Restart all. The tray icon aggregates
and leads with failure: with three PLCs configured it reads 2 of 3 ready, and
never Ready, while one is unreachable.
The reverse-proxy password is separate from
FRAKTAL_OPCUA_PASSWORD: one authenticates the browser at HTTPS/WSS; the other
authenticates the gateway to TF6100. Neither belongs in gateway.args.
5.3 Local acceptance
Section titled “5.3 Local acceptance”Repeat every step per instance, on that instance’s own port:
- Restart the gateway from the tray (its own submenu on a multi-PLC host).
- Confirm the tray reaches Ready, not merely Running - PLC unavailable.
- Open
http://127.0.0.1:8080/healthz; expect protocolfraktal.opcua.gateway.v1, statusready,plcReady: true, and theinstancefield naming the PLC you meant to test. - Open
http://127.0.0.1:8080/. The Web HMI and WebSocket now share one origin. - On first run, select languages and Units. A release Web build derives
ws://127.0.0.1:8080/fraktalfrom that page automatically. The endpoint remains editable for diagnostics.
An instance’s Unit assignment is stored per browser origin, so each PLC is commissioned separately in the browser as well as in the gateway.
For an expiring local commissioning session, explicitly change the profile to
commissioning-anonymous and add --commissioning-ttl-minutes 120. A clean TTL
shutdown remains stopped; tray supervision does not restart it. Restore the
production profile and remove temporary TF6100 Anonymous rights afterward.
6. Linux systemd walkthrough
Section titled “6. Linux systemd walkthrough”Build the package on Linux, then install it using a dedicated non-login account:
sudo useradd --system --home /nonexistent --shell /usr/sbin/nologin fraktal-gatewaysudo install -d -o root -g fraktal-gateway -m 0750 /opt/fraktal-gatewaysudo cp -a build/gateway/linux-x64/. /opt/fraktal-gateway/sudo chown -R root:fraktal-gateway /opt/fraktal-gatewaysudo chmod 0750 /opt/fraktal-gateway/fraktal_gateway
sudo install -d -o root -g fraktal-gateway -m 0750 /etc/fraktalsudo install -m 0600 -o root -g root \ /opt/fraktal-gateway/fraktal-gateway.env.example \ /etc/fraktal/fraktal-gateway.envsudo install -m 0644 /opt/fraktal-gateway/fraktal-gateway.service \ /etc/systemd/system/fraktal-gateway.serviceEdit /etc/fraktal/fraktal-gateway.env, replace every placeholder, and protect
the private key/trust material with the service account’s ACLs. Edit the unit’s
--plc-endpoint, add one --read-root per assigned Unit/shared data subtree,
and add one --write-root per assigned Unit. The supplied unit
already serves /opt/fraktal-gateway/web.
sudo systemctl daemon-reloadsudo systemctl enable --now fraktal-gatewaysystemctl status fraktal-gateway --no-pagercurl --fail http://127.0.0.1:8080/livezcurl --fail http://127.0.0.1:8080/readyzOpen http://127.0.0.1:8080/ locally or add the remote reverse proxy described
next. The bundled proxy installation is currently Windows-only; Linux uses the
site proxy/service policy. systemd restarts process failures; OPC UA/WebSocket
reconnect is handled inside the application and never replays an HMI write.
For several PLCs on one Linux host, use the templated unit instead of the plain one — one systemd instance per controller, each with its own environment file:
sudo install -m 0644 /opt/fraktal-gateway/fraktal-gateway@.service \ /etc/systemd/system/fraktal-gateway@.servicesudo install -d -o root -g fraktal-gateway -m 0750 /etc/fraktal/instancessudo install -m 0640 -o root -g fraktal-gateway \ /opt/fraktal-gateway/fraktal-gateway-instance.env.example \ /etc/fraktal/instances/press.env # repeat per PLC: oven.env, ...
# Set FRAKTAL_PLC_ENDPOINT and a unique FRAKTAL_GATEWAY_PORT in each file.sudo systemctl daemon-reloadsudo systemctl enable --now fraktal-gateway@press fraktal-gateway@ovencurl --fail http://127.0.0.1:8080/healthz # "instance": "press"curl --fail http://127.0.0.1:8081/healthz # "instance": "oven"Shared credentials and PKI stay in /etc/fraktal/fraktal-gateway.env, which the
template reads first; per-PLC overrides go in the instance file, which wins. Do
not enable both fraktal-gateway.service and fraktal-gateway@<name> for the
same PLC, and never give two instances the same port. The site proxy publishes
one origin per instance, exactly as the Windows profile does.
7. Remote HTTPS/WSS browser deployment
Section titled “7. Remote HTTPS/WSS browser deployment”Use one public origin per instance, for example https://192.168.100.126
for the first PLC and https://192.168.100.126:8443 for the second. Add that
exact origin to that instance’s configuration:
--allow-originhttps://hmi-cell-01.exampleOn Windows, select secure remote Web HMI in FraktalSetup.exe; the wizard
performs this configuration and writes the corresponding --allow-origin into
each published instance. It also creates these site-owned artifacts:
%LOCALAPPDATA%\Fraktal\Gateway\proxy\Caddyfile # one site block per instance%LOCALAPPDATA%\Fraktal\Gateway\proxy\basic-auth.txt # account name + Argon2id hash%LOCALAPPDATA%\Fraktal\Gateway\proxy\FraktalGatewayRootCA.crt%LOCALAPPDATA%\Fraktal\Gateway\proxy\storage\ # includes the private CA keybasic-auth.txt holds the same account name and hash the Caddyfile already
contains — no recoverable password — so adding a PLC later can regenerate the
routing without re-entering the browser password. One account serves every
published instance; per-instance accounts are a site-PKI/SSO adapter.
Copy FraktalGatewayRootCA.crt through the commissioning trust channel and
install it as a trusted root on every authorized remote HMI device. For example,
on a managed Windows HMI account:
certutil -user -addstore -f Root .\FraktalGatewayRootCA.crtTrust on the gateway PC does not propagate over the network. A browser opened on an engineering laptop, panel PC, or mobile device remains untrusted until that same public root is installed through the site’s managed trust process. The installer log distinguishes exported from trusted so creation of a certificate is never mistaken for client trust.
Do not distribute anything below proxy\storage; it contains the CA private
key. A site PKI certificate may replace tls internal in the Caddyfile, in
which case every client must trust that site chain instead. Restart the tray
after a reviewed manual Caddyfile change.
Linux or a site-managed Windows proxy shall equivalently:
- listen on HTTPS with a certificate trusted by every HMI device;
- authenticate access to both the static HMI and the WebSocket upgrade;
- proxy ordinary HTTP paths to
http://127.0.0.1:8080; - proxy
/fraktalas WebSocket tows://127.0.0.1:8080/fraktal; - preserve
Originand WebSocket upgrade headers/control frames; - use an idle timeout comfortably above the 2 s heartbeat;
- apply connection/rate limits and audit access;
- avoid publicly exposing health endpoints unless an authenticated monitoring policy requires them.
The bundled Windows profile uses HTTP Basic authentication only inside TLS. Managed-browser SSO, mTLS client identity, centralized account lifecycle, and cross-host/load-balanced proxying remain site deployment adapters; replace the generated Caddy authentication block when those policies are required.
Do not bind the Fraktal gateway directly to a LAN interface and do not treat Origin checking as authentication. Expose only the reverse proxy’s HTTPS port through the host/network firewall.
For scripted Windows installation, provide the password only in the child process environment; it is consumed and cleared after hashing:
$env:FRAKTAL_PROXY_PASSWORD = '<from protected deployment secret>'.\install_fraktal.cmd ` -Components Gateway ` -GatewayEndpoint opc.tcp://127.0.0.1:4840 ` -EnableRemoteAccess ` -PublicOrigin https://192.168.100.126 ` -ProxyUsername fraktal ` -ConfigureFirewall ` -TrustProxyCaForCurrentUserRemove-Item Env:FRAKTAL_PROXY_PASSWORDFor several PLCs, replace -GatewayEndpoint/-PublicOrigin with one repeatable
-GatewayInstance spec per controller (name, port, and origin all
default sensibly; only endpoint is required):
$env:FRAKTAL_PROXY_PASSWORD = '<from protected deployment secret>'.\install_fraktal.cmd ` -Components Gateway ` -GatewayInstance "name=press;endpoint=ads://192.168.1.6.1.1:851;port=8080;origin=https://192.168.100.126" ` -GatewayInstance "name=oven;endpoint=opc.tcp://192.168.1.9:4840;port=8081;origin=https://192.168.100.126:8443" ` -EnableRemoteAccess ` -ProxyUsername fraktal ` -ConfigureFirewall ` -TrustProxyCaForCurrentUserRemove-Item Env:FRAKTAL_PROXY_PASSWORDA silent run carries the whole instance set: instances missing from it are retired. Pass every PLC the host should serve, not only the one being added.
When opened from HTTPS, a release Web HMI automatically derives
wss://hmi-cell-01.example/fraktal. Changing the public origin creates a new
browser storage origin, so language/Unit assignment must be commissioned again
or migrated deliberately.
8. Layered acceptance evidence
Section titled “8. Layered acceptance evidence”Record each checkpoint separately:
| Checkpoint | Command/observation | Pass evidence |
|---|---|---|
| Process | GET /livez |
HTTP 200, status: live |
| PLC readiness | GET /readyz |
HTTP 200 after an observed good OPC UA operation |
| Command policy | any health endpoint | writeAccess matches the approved mutation scope; no credentials returned |
| Static HMI | GET / |
Flutter page loads from the intended origin |
| WebSocket | Browser connection log | channel opens at same-origin /fraktal |
| Fraktal discovery | Unit selector | expected root paths; no truncation/aliases presented as roots |
| Scope | saved Unit assignment | only approved roots visible/writable |
| Mailbox commit | HMI request log | one commit-last batch, new sequence |
| PLC acknowledgement | HmiResponse |
matching AckSequence, Accepted, Diagnostic |
| State effect | published contract | expected mode/status changes |
| Link loss | unplug/stop proxy/gateway | shell disappears immediately; no write queued/replayed |
| Recovery | restore path | fresh snapshot returns LIVE; operator reissues command |
/healthz is a compatibility summary. /livez is for process supervision;
/readyz is for PLC availability and returns 503 after an observed OPC UA
failure. A successful process or TCP probe is not a successful Fraktal session.
9. Upgrade, rollback, and backup
Section titled “9. Upgrade, rollback, and backup”Before an upgrade, record hashes and back up:
- Windows:
%LOCALAPPDATA%\Fraktal\Gateway; - Linux:
/etc/fraktal, PKI paths, unit overrides, and the current/opt/fraktal-gatewayrelease; - reverse-proxy configuration/certificates;
- browser URL and assigned Unit paths;
- PLC/TMC, TF6100 export, and gateway/HMI version.
The Windows installer stops the existing tray/gateway, atomically replaces the compiled Web directory, preserves site data, and restarts the tray. On Linux, stage the new package in a versioned directory or backup the old package before copying, then restart and repeat all acceptance checkpoints. Rollback restores the matching gateway + Web HMI pair; do not mix arbitrary UI and gateway protocol versions.
10. Fast troubleshooting
Section titled “10. Fast troubleshooting”| Symptom | First check |
|---|---|
Browser cannot load / |
Gateway/tray process, --web-root, web/index.html, then reverse-proxy HTTP route |
| Page loads but stays Connecting | Browser developer console and /fraktal upgrade; check exact --allow-origin and proxy WebSocket support |
| Local works, remote fails | HTTPS certificate/authentication, firewall, proxy upgrade headers, public origin |
/livez works, /readyz is 503 |
OPC UA endpoint/profile/certificate/user, then TF6100 namespace authorization |
| Unit selector empty | Namespace URI/browse rights, TMC root marker, truncated snapshot—not static hosting |
| Control rejected | HmiResponse.AckSequence, Accepted, and Diagnostic; do not restart at ping |
| Browser reconnects but command did not repeat | Correct fail-safe behavior; commands are never replayed after an ambiguous disconnect |
| Installer tray is Running but not Ready | Open that instance’s gateway log; production credentials/PKI or PLC access are incomplete |
Tray says 2 of 3 ready |
Open the failing instance’s submenu and log; the other instances are unaffected by design |
| A new PLC’s page shows another PLC’s data | Two instances share an origin or a port; /healthz instance names which one actually answered |
| A configured instance never starts | Its folder must contain gateway.args and a name of 1–32 letters/digits/./_/-; then Reload instances |
For deeper PLC/TF6100 diagnosis, return to the layered table in
FIRST_PROJECT_AGENT_GUIDE.md Section 9.
Built from Specification/Guides/WEB_HMI_GATEWAY_DEPLOYMENT.md at revision a1163c7 of the Fraktal repository.