Skip to content

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.

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/
|
v
Fraktal 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/fraktal

The 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 A
https://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.

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.

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, and HmiResponse;
  • chosen gateway profile and owner: production, secure-anonymous, commissioning-anonymous, or isolated-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.

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.

Terminal window
cd C:\Projects\Fraktal\FraktalCore\HMI
flutter pub get
flutter analyze
flutter test
cd gateway
dart pub get
dart run tool/build_gateway.dart --clean

Windows 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 Caddy

Linux 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.

  1. Sign or verify the supplied installer according to site policy.
  2. Run FraktalSetup.exe as the Windows account that will own the tray.
  3. 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 to ads://127.0.0.1.1.1:851; confirm it before installation.
  4. Fill in the gateway instance list — one row per PLC. A fresh install starts with one instance named default on 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.
  5. 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 — PneumaticPress over ADS, PLC1/MAIN/PneumaticPress over 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.
  6. 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).
  7. The installer writes program files to %LOCALAPPDATA%\Programs\Fraktal Gateway and 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.
  8. 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.
  9. 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 single gateway.args is migrated into instances\<first>\ with its site scoping intact, and the original is kept as gateway.args.migrated. An instance removed in the wizard is retired to gateway.args.removed rather than deleted, and re-adding the same name restores it. Uninstall also preserves those site-owned files intentionally.

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.log

The 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-name
press
--plc-endpoint
opc.tcp://127.0.0.1:4840
--port
8080
--path
/fraktal
--web-root
%LOCALAPPDATA%\Programs\Fraktal Gateway\web
--allow-origin
https://192.168.100.126
--security-profile
production
--security-policy
http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
--application-uri
urn: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-root
PLC1/MAIN/PneumaticPress
--write-root
PLC1/MAIN/PneumaticPress

Repeat --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_USERNAME
FRAKTAL_OPCUA_PASSWORD
FRAKTAL_OPCUA_PRIVATE_KEY_PASSWORD # only for an encrypted private key

Restart 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.

Repeat every step per instance, on that instance’s own port:

  1. Restart the gateway from the tray (its own submenu on a multi-PLC host).
  2. Confirm the tray reaches Ready, not merely Running - PLC unavailable.
  3. Open http://127.0.0.1:8080/healthz; expect protocol fraktal.opcua.gateway.v1, status ready, plcReady: true, and the instance field naming the PLC you meant to test.
  4. Open http://127.0.0.1:8080/. The Web HMI and WebSocket now share one origin.
  5. On first run, select languages and Units. A release Web build derives ws://127.0.0.1:8080/fraktal from 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.

Build the package on Linux, then install it using a dedicated non-login account:

Terminal window
sudo useradd --system --home /nonexistent --shell /usr/sbin/nologin fraktal-gateway
sudo install -d -o root -g fraktal-gateway -m 0750 /opt/fraktal-gateway
sudo cp -a build/gateway/linux-x64/. /opt/fraktal-gateway/
sudo chown -R root:fraktal-gateway /opt/fraktal-gateway
sudo chmod 0750 /opt/fraktal-gateway/fraktal_gateway
sudo install -d -o root -g fraktal-gateway -m 0750 /etc/fraktal
sudo install -m 0600 -o root -g root \
/opt/fraktal-gateway/fraktal-gateway.env.example \
/etc/fraktal/fraktal-gateway.env
sudo install -m 0644 /opt/fraktal-gateway/fraktal-gateway.service \
/etc/systemd/system/fraktal-gateway.service

Edit /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.

Terminal window
sudo systemctl daemon-reload
sudo systemctl enable --now fraktal-gateway
systemctl status fraktal-gateway --no-pager
curl --fail http://127.0.0.1:8080/livez
curl --fail http://127.0.0.1:8080/readyz

Open 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:

Terminal window
sudo install -m 0644 /opt/fraktal-gateway/fraktal-gateway@.service \
/etc/systemd/system/fraktal-gateway@.service
sudo install -d -o root -g fraktal-gateway -m 0750 /etc/fraktal/instances
sudo 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-reload
sudo systemctl enable --now fraktal-gateway@press fraktal-gateway@oven
curl --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.

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-origin
https://hmi-cell-01.example

On 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 key

basic-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:

Terminal window
certutil -user -addstore -f Root .\FraktalGatewayRootCA.crt

Trust 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 /fraktal as WebSocket to ws://127.0.0.1:8080/fraktal;
  • preserve Origin and 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:

Terminal window
$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 `
-TrustProxyCaForCurrentUser
Remove-Item Env:FRAKTAL_PROXY_PASSWORD

For several PLCs, replace -GatewayEndpoint/-PublicOrigin with one repeatable -GatewayInstance spec per controller (name, port, and origin all default sensibly; only endpoint is required):

Terminal window
$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 `
-TrustProxyCaForCurrentUser
Remove-Item Env:FRAKTAL_PROXY_PASSWORD

A 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.

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.

Before an upgrade, record hashes and back up:

  • Windows: %LOCALAPPDATA%\Fraktal\Gateway;
  • Linux: /etc/fraktal, PKI paths, unit overrides, and the current /opt/fraktal-gateway release;
  • 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.

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.