Self-hosting the gateway#
The NucleI gateway is the server behind the app's TQT Connect page. This page is for the IT staff who install and run their own gateway, step by step. To connect it to Moodle, Canvas, Blackboard or Brightspace, set it up here first, then follow LMS integration (LTI 1.3). What students and instructors see in the app is described in TQT Connect.
- Overview: what the gateway does, and whether a self-hosted gateway is needed.
- Install: requirements, the three ways to install, running it as a service, the first administrator.
- Configuration: every
gateway.yamlkey, with a minimal and a recommended example. - HTTPS and the network: Caddy, nginx with Let's Encrypt, an internal CA, ports and firewall.
- Connecting NucleI: per user, or for every PC through the machine policy.
- Operating the gateway: the admin pages, instruments, users, courses, backups, upgrades and monitoring.
- Troubleshooting
- Security notes
Required settings
- Enrol every NucleI app. An app signs in only after it has been enrolled with a code from the admin page App enrolment, entered once in the app or deployed with the machine policy. Until the first app is enrolled, the log and the admin dashboard say so. See App enrolment.
- Back up
data/secret.keywith the database. The gateway generates its token-signing key there on first start unlessauth.secret_keyis set. Losing it signs everyone out; anyone who has it can sign in as any user. - Instrument sessions do not go through your web proxy. The app connects straight to the gateway on TCP ports 9000 to 9100. Open them on the gateway host and, behind a proxy or NAT, set
server.advertised_host. - Back up the whole
datafolder at once, with thebackupcommand (Backups and restore). The database is useless withoutteaching.key(course comments and review notes) and, with an LMS, theltifolder. Shared packages and backups live indata/uploads. - Create the administrator account immediately after the first start. The first person to open the web page can create it.
Overview#
What the gateway does#
One gateway serves one site (a department, a teaching lab, a company). It gives the NucleI apps on that site:
- Instrument sharing. Spectrometers are registered once on the gateway. A user presses Start session in NucleI; the gateway opens a private TCP tunnel to the instrument for that user only, and closes it when they finish, go quiet or run out of time. Others wait in a queue or book time in a calendar.
- Sharing and backups. Users send projects, scans, sequences and other items to colleagues on the same gateway, and keep encrypted backups of their own work. Items are encrypted in the app before they are uploaded. Items sent to one person, and items in groups with
end_to_endkeys, cannot be read by the gateway; with the defaultserverkey mode the gateway holds group keys (see Who holds group keys). - Courses. Instructors, TAs and students; assignments, submissions, rubric grading; weekly instrument quotas, class time slots and approval of student runs. These appear only when Teaching features is turned on in the app (Teaching).
- LMS integration. The gateway is an LTI 1.3 tool for Moodle, Canvas, Blackboard Learn and D2L Brightspace: course links, assignment links with gradebook columns, grade pass-back and roster sync.
Global and self-hosted gateways#
TerraQuanTech runs a public gateway, TQT Connect (connect.terraquant.tech, and a regional copy). NucleI uses it by default.
| TQT Connect (global) | Your own gateway (self-hosted) | |
|---|---|---|
| Sharing and backups | Yes, within your organisation on the terraquant.tech website | Yes, between the users of this gateway |
| Sign-in | terraquant.tech website account | NucleI profile and computer name (profile@computer); a password only for the web pages |
| Instruments, sessions, queue, reservations | No | Yes |
| Courses | No | Yes |
| LMS (LTI 1.3) | No | Yes |
| Where data is stored | TerraQuanTech servers | Your server |
| Needs internet | Yes | No (except to reach a cloud LMS) |
A self-hosted gateway is needed to share instruments, run courses or connect an LMS, or when data must stay on premises. In gateway.yaml this is mode: local, the default. mode: global is only for TerraQuanTech's servers.
Terms#
Session, tunnel. While a user holds an instrument, the gateway forwards one TCP port from its range (9000 to 9100 by default) to the instrument. The app talks to the instrument through that port.
Advertised host. The name or address the gateway tells the app to dial for its tunnel. By default it is the host name the app already used to reach the gateway.
Reverse proxy. A web server (Caddy, nginx) in front of the gateway that handles HTTPS and passes requests on to it.
tool_url. The gateway's public HTTPS address, as LMS users' browsers reach it. Needed only for LTI.
Install#
Requirements#
| Operating system | Linux with Docker (any current distribution; the examples use Ubuntu or Debian). There is no Windows service; see On Windows. |
| Software | Docker Engine with the Compose plugin. |
| CPU, memory | 2 cores and 2 GB of RAM are sufficient for a lab. Uploads are written to disk as they arrive, so memory use does not grow with the size of a project. |
| Disk | The database stays small. Shared items and backups are stored as files under data/uploads/packages and are not limited per user, so size the disk for the projects people will back up, and watch it (Monitoring). |
| Network | A DNS name for the gateway (for example nmr-gateway.chem.example.edu). Port 8080 (web and API, or 443 through a proxy) and TCP 9000 to 9100 (sessions) reachable from the NucleI PCs. The gateway must reach the instruments. See Ports and firewall. |
| Time | NTP running. LMS launches are refused when the clocks differ by more than a minute. |
Install#
TerraQuanTech support sends you the gateway image as a file named nuclei-gateway-compiled.tar.gz, and a Compose file. The gateway reads gateway.yaml from its working folder and keeps everything else in the data folder next to it. These steps use /srv/nuclei-gateway as the gateway's folder. The image uses SQLite.
-
Install Docker (Ubuntu:
sudo apt install docker.io docker-compose-v2, or Docker's own packages) and make it start at boot: -
Load the image:
The last line says
Loaded image: nuclei-gateway:compiled. -
Create the folder and put the Compose file in it:
The Compose file looks like this:
-
Create
/srv/nuclei-gateway/gateway.yamlwith a text editor (for examplesudo nano /srv/nuclei-gateway/gateway.yaml):# Instruments plugged into this same machine are registered as "localhost"; # inside the container that name means the container, so dial the host instead. device_loopback_host: "host.docker.internal"No secret key is needed: on first start the gateway generates one into
data/secret.key(readable by its owner only) and logs the path. To use your own key instead, addauth.secret_key(32 characters or more, for example the output ofopenssl rand -hex 32) and make the file readable by root only:sudo chmod 600 /srv/nuclei-gateway/gateway.yaml. -
Start the gateway:
restart: unless-stoppedstarts it again after a crash or a reboot. When you add a reverse proxy later, change"8080:8080"to"127.0.0.1:8080:8080"(HTTPS). -
Check it started:
The log shows
Generated a token-signing key at /app/data/secret.key, a warning that no app is enrolled, andApplication startup complete.. The second command prints{"status":"ok","database":"ok","version":"0.1.0",...}. Then create the administrator and enrol the apps.The image has a Docker
HEALTHCHECK;docker psshows the container ashealthyonce/api/healthanswers.
The image runs the database migrations itself at every start; there is no separate setup step.
On Windows#
There is no native Windows build or Windows service. Use one of these:
- A Linux virtual machine (Hyper-V or another hypervisor) with the Compose install above. This is the reliable choice for a server.
- Docker Desktop with the WSL 2 backend and the Compose install above. Docker Desktop only runs while a user is signed in, so the gateway stops when nobody is; turn on Start Docker Desktop when you sign in and keep a session signed in. In PowerShell, load the image with
docker load -i nuclei-gateway-compiled.tar.gz(PowerShell has no<), and use Windows paths such asC:\nuclei-gateway\datain the Compose file'svolumes.
First start and the first administrator#
Do this first: until an administrator exists, anyone who opens the page can create one.
- On the gateway machine, open
http://localhost:8080in a browser (orhttp://<gateway host>:8080from your PC, if no one else can reach it yet). - The page says Create your admin account to get started. Enter a username and a strong password and press Create Admin Account. The account is created and you land on the Dashboard.
- Check from a shell:
curl http://localhost:8080/api/auth/statusnow prints{"has_admin":true}.
Only one account can be created this way. Further administrators are made from Users: a user appears there once they have connected from the app; change their Role to admin and give them a web password with Set Password.
Next, register the instruments, set up HTTPS and connect the apps.
Configuration#
The gateway reads gateway.yaml from the folder it runs in (/app inside the Docker image, so mount the file at /app/gateway.yaml). Changes take effect after a restart (docker restart nuclei-gateway or systemctl restart nuclei-gateway). The file is optional: every key has a default.
Environment variables. Every key can also be set as an environment variable: prefix GATEWAY_, upper case, and __ (two underscores) between levels. For example auth.secret_key is GATEWAY_AUTH__SECRET_KEY and server.advertised_host is GATEWAY_SERVER__ADVERTISED_HOST. An environment variable wins over the same value in gateway.yaml. Lists and the lti.platforms registrations are easiest in the file.
Relative paths (./data/...) are relative to the folder the gateway runs in.
Changes made on the web admin page. Most settings can also be changed on Settings (/admin/settings) without editing the file. gateway.yaml stays the deployment base; changes made on the page are kept in data/config.overrides.yaml (owner-only, written by the gateway) and laid over the file when the gateway starts. The order of precedence is: environment variable, then Settings, then gateway.yaml, then the default. The file is a managed file; edit gateway.yaml for the deployment itself.
- Each field shows its effective value and where it comes from: Default, gateway.yaml, Changed here or Environment. Reset to file value removes the change made on the page.
- Fields set by an environment variable are read-only. On the global gateway, the values it fixes (end-to-end group keys, LMS and identity-provider sign-in off) are read-only and marked Fixed on this gateway.
- Secrets (signing and identity keys, the teaching key, the database address, key folders, LMS registrations, tracing and website identity settings) are not shown and cannot be set on the page; keep them in
gateway.yamlor the environment. - A change is checked against the whole configuration before it is saved. A refused change names the fields at fault and nothing is saved.
- Settings the gateway reads as it works (for example session lengths, course creation, group-key custody) apply at once. Settings read once at start (the listen address and port, upload limit, trusted proxies, CORS, tunnel ports, health-check interval, LMS and identity-provider switches) show Needs restart; after a change they show Restart needed until the gateway restarts.
- Only administrators can read or change settings. Each change and reset is written to the audit log (App enrolment, events
config_changedandconfig_reset) with the user, the field, and the old and new value; credentials inside addresses are masked. data/config.overrides.yamlis part ofgateway backup. A file that no longer validates after an upgrade is ignored, with an error in the log, and the gateway starts fromgateway.yaml.
Settings reference#
| Key | Type | Default | Effect |
|---|---|---|---|
mode |
local or global |
local |
Leave at local. global is TerraQuanTech's multi-tenant service: no instruments, courses or LTI, and sign-in only with a terraquant.tech account. |
server.host |
address | 0.0.0.0 |
Address the web server listens on. 0.0.0.0 means every network interface. Use 127.0.0.1 behind a reverse proxy on the same machine (without Docker; with Docker, bind with -p 127.0.0.1:8080:8080 instead). With a concrete address here, also set server.advertised_host, or the app is told to open its tunnels to this address. |
server.port |
number | 8080 |
Port for the web pages and the API. |
server.advertised_host |
host name or IP | empty | What the app is told to dial for a session tunnel. Empty: the host name the app used to reach the gateway (from the Host header). Set it when a reverse proxy, a load balancer or NAT sits in front, to the name that resolves to the gateway machine itself. |
database_url |
URL | sqlite+aiosqlite:///data/gateway.db |
The database. SQLite needs nothing else; data/gateway.db is created on first start. For PostgreSQL: postgresql+asyncpg://user:password@dbhost/nuclei_gateway. |
proxy.port_range_start |
number | 9000 |
First TCP port for session tunnels. |
proxy.port_range_end |
number | 9100 |
Last tunnel port. Each active session uses one; when all are taken, sessions are refused with "No available tunnel ports". If you change the range, publish the same range in Docker and the firewall. |
proxy.unclaimed_grace_seconds |
seconds | 180 |
A session the app never connects to is ended after this long. |
proxy.disconnected_grace_seconds |
seconds | 120 |
A session whose app stopped sending signs of life (it sends one every 30 seconds) is ended after this long, so a crashed PC frees the instrument. |
proxy.session_timeout_minutes |
minutes | 120 |
The longest session on any instrument. A session lasts what the app asks for, capped by the instrument's Max Session and by this value. |
proxy.idle_timeout_minutes |
minutes | 30 |
A session whose tunnel carries no data for this long is ended and the instrument handed back. The instrument's own status traffic counts as activity. 0 turns it off. |
auth.secret_key |
text | empty | Signs the sign-in tokens of the app and the web pages. Empty: the key in auth.secret_key_file is used, generated on first start. When set, it must be 32 characters or more; the gateway refuses to start with a shorter key or the old example value change-me-in-production. Anyone who knows it can make themselves administrator. Changing it signs everyone out. |
auth.secret_key_file |
file | ./data/secret.key |
Where the generated key is kept (owner-only). Back it up with the database. |
auth.algorithm |
text | HS256 |
Token signing algorithm. Leave it. |
auth.token_expire_minutes |
minutes | 480 |
How long a sign-in lasts before the app or web page must sign in again. |
cors.allow_origins, cors.allow_methods, cors.allow_headers |
lists | ["*"] |
Which web origins may call the API from a browser. The app calls it from its own origin, so leave these unless you know the origins involved. |
cors.allow_credentials |
true/false |
true |
CORS credentials flag. Leave it. |
data_collection.enabled |
true/false |
false |
Lets the app upload scan records, reports and QC records under /api/data. Off: those addresses answer "not found". |
data_collection.storage_path |
folder | ./data/uploads |
Where uploaded files are stored. Shared items and backups are stored here too (packages/), whether or not data_collection.enabled is on. |
storage.backend |
fs |
fs |
Where shared items are stored: files on disk. s3 is not implemented; the gateway refuses to start with it. storage.s3_bucket, storage.s3_endpoint and storage.s3_region have no effect. |
server.max_upload_mb |
MB | 512 |
Largest upload accepted (shared items, backups, reports). Larger uploads are refused with 413 upload_too_large. Uploads are written to disk as they arrive. |
telemetry.otlp_endpoint |
URL | empty | OpenTelemetry collector to send traces to, for example http://jaeger:4317. Empty: no tracing. |
telemetry.jaeger_url |
URL | empty | Shown as Open Jaeger tracing UI on the Dashboard. |
health_check_interval_seconds |
seconds | 30 |
How often the gateway tries to open a TCP connection to each instrument to mark it online or offline. Instruments in maintenance are skipped. |
device_loopback_host |
host name | empty | Where to dial an instrument registered as localhost or 127.0.0.1. Empty: the gateway's own machine. In Docker, set host.docker.internal (with --add-host host.docker.internal:host-gateway) so "localhost" means the Docker host, not the container. |
teaching.open_course_creation |
true/false |
true |
true: any user can create a course and becomes its instructor. false: only gateway administrators create courses (also from an LMS launch). Choosing a course's instruments is always admin-only. |
teaching.key_file |
file | ./data/teaching.key |
Key that encrypts course comments and review notes in the database, and the group keys the gateway holds under server-held keys. Created at first start, readable by its owner only. Back it up with the database. The gateway refuses to start if the file exists but is empty, unreadable or not a valid key. |
group_keys.custody |
server/end_to_end |
server |
Who holds the key of a recipient group (a course, a share, a review request) when the group has no choice of its own. server: the gateway holds the keys and gives them to members at once. end_to_end: only the people in the group hold them. On a global gateway the value is always end_to_end. See Who holds group keys. |
group_keys.locked |
true/false |
false |
true: instructors and senders cannot choose another mode for a course, share or review request. |
audit.accept_forwarded |
true/false |
false |
Accept audit trails that apps forward. Off: apps are refused with audit_forwarding_off and keep their entries queued. See Forwarded audit trails. |
audit.retention_days |
days | 0 |
Delete forwarded entries older than this many days, checked every few hours. The newest entry of each installation is kept so its chain can still be checked. 0 keeps entries for ever. |
audit.max_requests_per_minute |
number | 120 |
Forwarding requests one installation may send per minute; further requests are refused with 429 until the minute passes. Each request carries up to 100 entries. |
lti.enabled |
true/false |
false |
Turns the LMS (LTI 1.3) tool on. Off: every LTI address answers "LTI is not enabled on this gateway". Needs lti.tool_url. |
lti.tool_url |
https:// URL |
empty | The gateway's public HTTPS address, without a path, exactly as browsers reach it: https://nmr-gateway.chem.example.edu. All LTI addresses are built from it. |
lti.key_dir |
folder | ./data/lti |
The tool's signing keys (one .pem file per key) and page-token.secret. Created on first use, owner-only. Back it up. |
lti.platforms |
list | empty | LMS registrations kept in the file. See LMS integration. |
lti.score_retry_max_attempts |
number | 8 |
How often one grade is tried before it is marked failed. |
lti.score_retry_base_seconds, lti.score_retry_max_seconds |
seconds | 30, 3600 |
Wait before the first retry, doubling each time up to the maximum. |
website.* |
Only for mode: global. |
Environment variables read by the server itself, not through gateway.yaml:
| Variable | Effect |
|---|---|
FORWARDED_ALLOW_IPS |
Addresses of reverse proxies whose X-Forwarded-For header is believed. Default 127.0.0.1. Needed so per-address limits see the real user; see Forwarded headers. |
SSL_CERT_FILE |
A CA bundle (PEM) the gateway uses instead of its built-in list when it calls an LMS over HTTPS. Needed only if your LMS uses an internal CA; see Internal CA. |
HTTPS_PROXY, NO_PROXY |
Outgoing web proxy for calls to the LMS. |
Minimal example#
No gateway.yaml is needed to start: every setting has a default, and the token-signing key is generated into data/secret.key on first start. The NucleI app connects only over HTTPS, or over plain HTTP to a gateway on the same computer (http://localhost:8080, http://127.0.0.1:8080), so put the reverse proxy from HTTPS and the network in front before PCs connect.
Recommended example#
Docker, behind an HTTPS reverse proxy on the same machine, with courses and an LMS:
server:
# The name the app uses; it resolves to this machine, where ports 9000-9100 are open.
advertised_host: "nmr-gateway.chem.example.edu"
auth:
token_expire_minutes: 480
proxy:
port_range_start: 9000
port_range_end: 9100
device_loopback_host: "host.docker.internal" # Docker only
health_check_interval_seconds: 30
teaching:
open_course_creation: false # only administrators create courses
lti:
enabled: true
tool_url: "https://nmr-gateway.chem.example.edu"
# LMS registrations: add them on the LMS admin page, or here (see LMS integration).
HTTPS and the network#
Why HTTPS#
- The LMS requires it. With
lti.enabled, the gateway refuses to start unlesslti.tool_urlstarts withhttps://, and every LMS registration URL must behttps://too. - Browsers require it. The LMS sign-in relies on a cookie that browsers only keep over HTTPS.
- The app requires it. Enrolment, app sign-in, account claims and LMS linking go only to an
https://address, or tohttp://on the same computer (localhost,127.x.x.x,[::1]). The machine policy'sgateway.urlfollows the same rule. Any otherhttp://address is refused withgateway_url_invalid. - Sign-in tokens travel with every request. Over plain HTTP anyone on the network path can read them.
Existing plain-HTTP gateways. Apps from this version no longer connect to http://<host>:8080. Before upgrading the apps, put a reverse proxy with a certificate in front of the gateway (below), change the address in each app or in the machine policy to the https:// one, and enrol again if the address's host changed (the enrolment is stored per address).
The gateway itself speaks only plain HTTP. Put a reverse proxy in front that holds the certificate. Session tunnels (TCP 9000 to 9100) never go through that proxy. The app connects to them directly, by the advertised host. They carry the instrument's own protocol, which is not encrypted by the gateway, so keep them on the lab network or a VPN. The proxy needs no WebSocket or gRPC support: the app and the web pages use ordinary HTTPS requests.
Recipe: Caddy (automatic certificates)#
Use this when the gateway's DNS name is reachable from the internet on ports 80 and 443, so Let's Encrypt can check it.
- Install Caddy (Ubuntu or Debian: follow Install → Debian, Ubuntu on caddyserver.com, which adds Caddy's package source, then
sudo apt install caddy). - Bind the gateway to the local machine only: in the Compose file change the first port to
"127.0.0.1:8080:8080"(keep"9000-9100:9000-9100"), and addenvironment:withFORWARDED_ALLOW_IPS: "*"to the service. -
Replace the contents of
/etc/caddy/Caddyfilewith: -
sudo systemctl reload caddy. Caddy gets and renews the certificate itself. It passes the original host name and theX-Forwarded-Forheader on by default. - Set
server.advertised_hostand, for an LMS,lti.tool_url(see the recommended example), and restart the gateway.
Recipe: nginx with Let's Encrypt#
- Install:
sudo apt install nginx certbot python3-certbot-nginx. - Bind the gateway to the local machine as in the Caddy recipe, step 2.
-
Create
/etc/nginx/sites-available/nuclei-gateway:server { listen 80; server_name nmr-gateway.chem.example.edu; # Shared projects and backups are uploaded in one request; nginx refuses # anything over 1 MB unless told otherwise. client_max_body_size 0; location / { proxy_pass http://127.0.0.1:8080; # Without this nginx sends "127.0.0.1:8080" as the host, and the app # is told to open its instrument tunnel to 127.0.0.1. proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 300s; } } -
Enable it and get the certificate:
sudo ln -s /etc/nginx/sites-available/nuclei-gateway /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx sudo certbot --nginx -d nmr-gateway.chem.example.eduCertbot adds the HTTPS server block and an HTTP-to-HTTPS redirect, and installs a timer that renews the certificate.
sudo certbot renew --dry-runchecks that renewal will work. -
Set
server.advertised_host(andlti.tool_url) and restart the gateway.
Intranet with an internal CA#
When the gateway is not reachable from the internet, you have two ways to get a certificate:
- A public certificate by DNS check. Let's Encrypt can verify you own the name through a DNS record instead of a web request (Caddy's DNS modules, or certbot DNS plugins such as
python3-certbot-dns-rfc2136). Every device trusts the result, which avoids the problems below. Prefer this. - A certificate from your organisation's CA. Request one for the gateway's DNS name (include it as a Subject Alternative Name), then point the proxy at the files. Caddy: put
tls /etc/ssl/nuclei/gateway.crt /etc/ssl/nuclei/gateway.keyinside the site block. nginx:listen 443 ssl;withssl_certificate(the certificate followed by any intermediate certificates) andssl_certificate_key.
With an internal CA, everyone who talks to the gateway must trust that CA:
| Who | What to do |
|---|---|
| NucleI on Windows | Install the CA certificate in Trusted Root Certification Authorities of the computer store (by Group Policy or Intune). The app's window and its background service both use that store. |
| NucleI on macOS and Linux | The app's window uses the system trust store (macOS Keychain, Linux NSS), but its background service, which starts instrument sessions and handles sharing, may not. Use a public certificate (DNS check, above) for macOS and Linux PCs. |
| Browsers of admins and LMS users | Trust the CA as above, or browsers show a certificate warning. |
| A cloud LMS (Instructure Canvas, Blackboard SaaS, Brightspace cloud) | It cannot trust your CA, and it must fetch https://<gateway>/lti/jwks. An internal CA does not work with a cloud LMS; use a public certificate and make at least /lti/jwks reachable from the internet. |
| The gateway calling an on-premises LMS that itself uses your internal CA | Build a bundle of the public CAs plus yours (for example cat /etc/ssl/certs/ca-certificates.crt internal-ca.pem > /srv/nuclei-gateway/ca-bundle.pem), mount it into the container and set SSL_CERT_FILE to it (-v /srv/nuclei-gateway/ca-bundle.pem:/app/ca-bundle.pem:ro -e SSL_CERT_FILE=/app/ca-bundle.pem). |
Forwarded headers#
Behind a proxy, every request seems to come from the proxy. The gateway limits sign-ins per client address (LMS launches, password sign-ins, app sign-ins and enrolments), so one client could use up the limit for everyone unless the gateway sees each user's real address. Two settings tell the gateway which proxies to believe:
server.trusted_proxies(GATEWAY_SERVER__TRUSTED_PROXIES): addresses or networks of your proxies, for example["127.0.0.1", "10.0.0.0/8"]. For a request from one of them, the gateway takes the client address fromX-Forwarded-For: the nearest entry that is not itself a trusted proxy. Ports and IPv4-in-IPv6 forms are normalised. Empty (the default): the header is ignored.FORWARDED_ALLOW_IPS(environment variable): the same for the web server's own logs and the LMS launch limit.
Set both to the proxy's address:
- proxy on the host, gateway in Docker bound to
127.0.0.1:8080:-e FORWARDED_ALLOW_IPS="*"(safe only because nothing but the proxy can reach port 8080); - proxy and gateway on one machine without Docker: nothing to do (the default is
127.0.0.1); - proxy on another machine: that machine's IP address.
The gateway builds all LMS addresses from lti.tool_url and the tunnel address from server.advertised_host, so it needs no X-Forwarded-Proto or X-Forwarded-Host handling.
Setting tool_url and the advertised host#
lti.tool_urlis the scheme and host name that LMS users' browsers see, with no path and no trailing slash:https://nmr-gateway.chem.example.edu. The gateway refuses LMS launches aimed at any other address ("The launch target is not this gateway"). If you change it later, update the registration in every LMS too.server.advertised_hostis a host name only (nohttps://, no port) that the NucleI PCs resolve to the machine where ports 9000 to 9100 are open. When the proxy and the gateway are on the same machine it is the same name as intool_url. If the public name points at a load balancer or a different machine, use an internal name of the gateway machine instead.
Ports and firewall#
| From | To | Port | Needed for |
|---|---|---|---|
| NucleI PCs | gateway (via proxy) | TCP 443 (or 8080 without a proxy) | Everything in the app's TQT Connect page |
| NucleI PCs | gateway host | TCP 9000 to 9100 | Instrument sessions |
| Admins' browsers | gateway (via proxy) | TCP 443 | Admin web pages |
| LMS users' browsers | gateway (via proxy) | TCP 443 | LMS launches (/lti/login, /lti/launch) |
| LMS servers | gateway (via proxy) | TCP 443 | /lti/jwks (the LMS checks the gateway's signatures) |
| Let's Encrypt | proxy | TCP 80 and 443 | Certificate checks (not with a DNS check) |
| gateway | instruments | the port registered for each instrument | Health checks and sessions |
| gateway | LMS | TCP 443 outbound | Key sets, access tokens, grades and rosters |
Example with ufw on Ubuntu, allowing sessions only from the campus network 10.0.0.0/8:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow from 10.0.0.0/8 to any port 9000:9100 proto tcp
Docker bypasses ufw
Ports published by Docker are opened by Docker's own firewall rules, before ufw sees the traffic. To limit who reaches a published port, publish it on one interface only (-p 10.0.1.5:9000-9100:9000-9100), bind to 127.0.0.1 behind a proxy, or add rules to Docker's DOCKER-USER chain.
Connecting NucleI#
Per user, on the TQT Connect page#
- In NucleI, open TQT Connect in the sidebar.
- If it is connected to another gateway, press the disconnect button in the page header (tooltip Disconnect). The page shows Disconnected with a Server address field. If it could not reach the last address, it shows Can't reach the server with the same field.
- Enter the gateway's address with its scheme:
https://nmr-gateway.chem.example.edu. Plainhttp://works only for a gateway on the same computer (http://localhost:8080). Press Connect. - The first time, the page shows Enrolment required with a field for the enrolment code; enrolling needs an administrator profile. Enter a code from the gateway's App enrolment page (App enrolment) and press Enrol. The app stores the credential it receives for the signed-in OS user (in Windows Credential Manager, the Linux Secret Service keyring, or an owner-only file on macOS) and does not ask again.
- A password for the gateway's web pages is set by an administrator on Users (Set Password). The app itself never needs it.
The user is signed in as profile@computer (their NucleI profile name and the PC's name); there is no account to create. Switching profile reconnects as the other identity. The app remembers the address. A new identity is created only for the computer it names, and is tied to the installation that created it. When another installation asks for an existing identity (a reinstalled PC, an account from before enrolment existed, an identity released on Users), it is refused with identity_claim_pending or identity_bound_elsewhere and appears under Waiting for approval on App enrolment. The person can instead sign in with the account's gateway password from the same computer.
For every PC, with the machine policy#
Add the gateway section to the machine policy file:
{
"schemaVersion": 1,
"gateway": {
"url": "https://nmr-gateway.chem.example.edu",
"enrolmentToken": "7K2M-9QXD-4TPA-W8RN-C3HV"
}
}
The URL must start with https://, or with http:// for a gateway on the same computer. enrolmentToken is a code from the App enrolment page, usually one with unlimited uses for the fleet. Each PC enrols itself with it on first connection and gets its own credential, so users never see the enrolment step. The token is a secret: keep the policy file readable only as IT deployment describes, and give it an expiry that covers the rollout. Revoking the code stops new enrolments; PCs already enrolled keep working until their installation is revoked. From the next start of NucleI, the Server address field is locked and shows Set by your organisation, the Connect to TQT Connect button is hidden, and the app never moves to the global TQT Connect servers. The file location and its permission rules are in IT deployment.
What users see#
Once connected, the page header shows how many instruments are available, and the tabs Instruments, Instrument reservations, Instrument queue and the sharing tabs. Courses appears too when Teaching features is on. All of it is described in TQT Connect. Registered instruments also appear in the app's device list.
Verification#
- On a NucleI PC, the TQT Connect page shows Connected and the instruments you registered.
- In the gateway's web pages, App enrolment lists the PC under Enrolled apps, and Users lists
profile@computerwith that PC as its app. - Press Start session on an instrument in the app. The instrument connects, and the session is listed on the gateway's Sessions page; its Tunnel column shows the address the app was given. If the app reports "Couldn't reach the gateway at host:port. Check that the port is open in the gateway host's firewall.", host is that address; if it is not a name that PC can reach, set
server.advertised_host.
Certificate problems#
| What you see | Cause | Fix |
|---|---|---|
| Can't reach the server / "Nothing answered at …", while the address opens in a browser on another machine | The PC does not trust the certificate (the app shows certificate errors as "can't reach"), or a firewall blocks 443 | Open the same address in a browser on that PC. A certificate warning there means the CA is not trusted on this PC; see Internal CA. |
| The page connects, but Start session fails with a certificate or TLS error | The app's background service does not trust the CA (macOS, Linux) | Use a publicly trusted certificate. |
Browser shows NET::ERR_CERT_COMMON_NAME_INVALID |
The certificate is not for this host name | Reissue it with the gateway's DNS name as a Subject Alternative Name. |
Browser shows NET::ERR_CERT_AUTHORITY_INVALID |
Internal CA not trusted, or nginx serves the certificate without its intermediate | Install the CA; put the full chain in ssl_certificate. |
| Connecting by IP address fails over HTTPS | Certificates name a host, not an IP | Connect by the DNS name. |
Operating the gateway#
The web admin pages#
Sign in at the gateway's address with the administrator account. Administrators land on /admin; other users on /u, a simpler view of instruments, schedule, queue, activity and sharing.
| Page | Address | What it is for |
|---|---|---|
| Dashboard | /admin |
Instrument, user and session counts, instrument status, active sessions, and a link to Jaeger if telemetry.jaeger_url is set. |
| Devices | /admin/devices |
Register, edit and remove instruments; set one to maintenance. |
| Users | /admin/users |
Change a user's role, set a web password, delete a user. |
| Sessions | /admin/sessions |
Who holds which instrument, the tunnel address, time left; Force Disconnect. |
| Reservations | /admin/reservations |
The booking calendar for all instruments. |
| Audit trails | /admin/audit |
The installations that forward their audit trail: newest entry, time received, entries stored, chain status, Verify, Export and Allow restart. See Forwarded audit trails. |
| Sharing | /admin/sharing |
Shared packages (sender, kind, size; their contents are encrypted) and the public key directory. |
| Courses | /admin/courses |
Every course, its members and instruments; Choose instruments. |
| Settings | /admin/settings |
The gateway's settings: value and source of each, changes, and reset to the file value. See Configuration. |
| LMS | /admin/lms |
The values to give the LMS, LMS registrations, signing keys and the grade pass-back queue. See LMS integration. |
The interactive API reference is at /docs.
Instruments#
Devices → Add Device:
| Field | What to enter |
|---|---|
| Name | What users see, for example NMR-1 (60 MHz, room 204). |
| Device Type | The instrument model: Nanalysis Benchtop NMR or SpinTrack SB-45. |
| Provider | The driver family: nanalysis for Nanalysis, spintrack for SpinTrack. Cannot be changed later. |
| Host, Port | The instrument's network address and port, as the gateway reaches it. An instrument served from the gateway machine itself is localhost (with device_loopback_host set in Docker). |
| Location | Free text shown to users. |
| Max Session (min) | The longest session on this instrument, and the length when the app does not ask for one. Default 120. A longer request is cut to this value, and to proxy.session_timeout_minutes. |
| Walk-in allowed | On: anyone may start a session or join the queue while the instrument is free. Off: users need their own reservation covering the current time (or a class slot of their course); others are refused with walk_in_not_allowed. Administrators are exempt. |
Within health_check_interval_seconds the instrument shows online if the gateway could open a TCP connection to it, otherwise offline with the reason (for example "TCP connect to 10.0.1.50:5000 timed out after 5s"). Choose maintenance in the status list to take it out of use; the health check then leaves it alone until you set it back to online.
The NucleI PC that uses an instrument through the gateway needs the instrument's driver plugin installed, as for a direct connection.
Users#
Users are created automatically the first time an enrolled NucleI app connects as a profile (profile@computer), as lti-… accounts for LMS users (see LMS integration), and as idp-… accounts for identity-provider sign-ins. On Users:
- Role:
admin(everything, including these pages),user(normal use),readonly(may sign in and look, but every change is refused withreadonly_account; it may still give back a session, queue place or reservation it holds). Administrators sign in with their password on the web pages; the app's automatic sign-in refuses administrator accounts (password_login_required). - The second line under the name shows the identity kind (
lti,idp,local) and, for app identities, the computer it is tied to. Release app unties it; the next computer that asks for it waits for approval under App enrolment. - Set Password sets the password for the web pages. It does not affect the app. Users change their own password on the web pages with their current one; an app session cannot set or change a password.
- Unlock sign-in clears the failed password sign-ins counted for that account name.
- Delete removes the user, their sessions, bookings, shares, submissions and comments. Courses the user created pass to another instructor of the course; archived courses with no other instructor pass to the administrator who deletes the user. An active course with no other instructor blocks the deletion (
user_owns_courses): add an instructor, archive the course, or delete it on Courses.
App enrolment#
NucleI apps sign in to the gateway automatically, without a password. To stop anyone on the network from doing the same, each app installation must first be enrolled with a code an administrator issues. The App enrolment page has:
- New enrolment code. A label, the number of uses (1 for one PC, empty for unlimited), and the days it stays valid (empty for no expiry). Create code shows the code once, as
XXXX-XXXX-XXXX-XXXX-XXXX; it is stored only as a hash. Give it to the user, or put it in the machine policy asgateway.enrolmentToken(For every PC). - Codes. Uses, expiry and state (
active,expired,used_up,revoked). Revoke stops a code from enrolling more PCs; PCs it already enrolled stay enrolled. - Waiting for approval. Computers asking for an identity that already exists, with the computer it is tied to now. Approve ties the identity to the asking computer and ends the other computer's sessions as that identity; Refuse drops the request. Approve only when you know the person at that computer owns the account.
- Enrolled apps. One row per installation, with its computer name, the number of identities tied to it and the last sign-in. Revoke signs that installation out for good and ends its sessions at once. Its identities stay tied to it: after the PC is enrolled again with a new code, each identity waits for approval (or the account's password) before the new installation can use it.
- Sign-in audit. Enrolments, refused enrolments, refused app sign-ins, revocations and course deletions, with the reason code and the client address.
App sign-in serves only profile@computer identities. It never serves administrators, LMS accounts or identity-provider accounts, which sign in through their own route. Refusal codes the app shows: enrolment_required (not enrolled, or the gateway does not know the credential), enrolment_revoked, password_login_required, identity_bound_elsewhere, identity_claim_pending, identity_computer_mismatch (the name is of another computer than the enrolled one), identity_computer_ambiguous (two live installations have this computer's name; revoke the old one), and too_many_attempts.
Sign-in limits. Failed attempts are counted per client address (per /64 network for IPv6) and, for passwords, per existing account, over a sliding window: 10 failed password sign-ins per address and 20 per account in 15 minutes, 30 app sign-ins with an unknown credential per address in 5 minutes, and 10 failed enrolments per address in 15 minutes. The counters live in the gateway process and start again after a restart. Names that are not accounts are not counted. A per-account limit also means anyone can lock an account, the administrator's included, by failing to sign in as it; clear it with Unlock sign-in on Users, or with POST /api/admin/attempts/reset and {"account": "<name>"} or {"address": "<client address>"}. When the administrator account itself is locked, sign in with a second administrator account, or restart the gateway.
Verified signing. When an app enrols, it also takes the gateway's certificate key, together with the identity provider and the LMS platforms the gateway is set up with. From then on the gateway certifies the app's signing key for the person behind it: the directory account after a directory sign-in through the gateway, or the LMS account after linking (LMS integration). Other apps that enrolled with the same gateway then show those signatures as verified. The gateway's id is derived from that key. Replacing data/identity.key gives the gateway a new id, so every app must enrol again; keep the file in your backups. Signatures certified by the old key stay verified. Only an administrator profile can enrol the app. To fix the trusted key in advance for a fleet, put its fingerprint in the machine policy as gateway.certificateKeyFingerprint (IT deployment); print it with sudo docker compose exec gateway /app/server/main.bin certificate-fingerprint.
Upgrading a gateway installed before enrolment existed. After the upgrade every app is refused with enrolment_required until it is enrolled. The log says so at each start while no app is enrolled, and the admin dashboard shows a notice. Create a code (for a fleet, one with unlimited uses) and either enter it in each app or deploy it with the machine policy. Existing profile@computer users and their data are kept. They are not tied to any PC yet: the first enrolled PC that asks for one appears under Waiting for approval, and works once you approve it (or once the person signs in with the account's password from that PC).
Who holds group keys#
Datasets for a course, shares and review requests are encrypted in the app. Each group of recipients has a key: the course, the recipients of a share, the reviewers of a review request. A member receives the key once, and it opens everything sent to the group, including what was sent before they joined. People who have not signed in to NucleI yet, or whose LMS account is not linked yet, are listed as waiting and receive the key as soon as they can; nothing is skipped.
group_keys.custody chooses who holds the keys:
| Mode | Who can read group data | When a late member gets access |
|---|---|---|
server (default) |
Group members, and whoever administers the gateway: the gateway keeps each key encrypted with teaching.key_file. |
At once, when they register or link. |
end_to_end |
Group members only. The gateway keeps no key. | When a course staff member's app (or the sender's, for a share or review request) is next online and connected. |
On the global TQT Connect gateway only end_to_end is available. With group_keys.locked: true, the setting applies to every group; otherwise an instructor or sender may choose the other mode for a course, share or review request. An instructor can also switch an existing course. Switching to end-to-end replaces the key with one the gateway never held; data already distributed stays readable by whoever could read it before, including the gateway administrator and anyone with an old backup. Switching to server-held needs an instructor's app to be online. Organisations can also fix the mode on managed computers with the groupKeys key of the machine policy.
Datasets sent to a course one student at a time, before group keys, keep working. In the course's Members tab, the key panel lists them (Older datasets) and Redistribute older datasets gives each a wrap under the course key without changing the package, so students who joined later can open them too. It works for the datasets this instructor's or TA's app can open; the rest stay per student and the panel says how many. Any instructor or TA of the course may upload these wraps.
Removing someone from a course starts a new course key for datasets sent afterwards; instructors can also use Rotate key in the course. Back up teaching.key_file with the database: without it the server-held keys cannot be read, and an instructor's app has to restore them.
Forwarded audit trails#
With audit.accept_forwarded on, enrolled apps send their audit entries to the gateway as well as keeping them on the PC. Each entry arrives as the app wrote it: encrypted to the site administrator's key, with its number and hash. The gateway cannot read it.
- Storage: entries are stored append-only, one chain per enrolled installation, with the time the gateway received each. An installation can add only to its own chain. The gateway has no way to edit or delete an entry through its API. Only
audit.retention_daysremoves entries. - Checks: an entry is stored only when its number is the next one and its previous hash equals the last stored hash. Otherwise the request is refused and the refusal is counted on the installation. Entries that are not encrypted lines are refused. Resending entries already stored is accepted.
- Chain status on the Audit trails page: Intact; Entries refused (the newest request was refused); Chain differs or App is behind (the app's own comparison of its newest entry with the gateway's did not match); Restart allowed. Verify walks the stored chain again.
- Export downloads one installation's entries as one JSON object per line, still encrypted, with chain fields and receive time. The auditor decrypts them with the administrator key of the site; the gateway never has it. The export is recorded in the enrolment log.
- Allow restart: after an installation's audit trail was reset on purpose, or forwarding was off for a while, its next entry is refused as out of place. Allow restart lets the next entry start a new segment of the chain. Earlier entries are kept and the export shows the segment.
- Backups: entries are in the database and are included in
backup.
Apps use the setting only when a gateway is connected. The PC side is set in the machine policy (audit) and by the administrator on the Audit page. See Data integrity for what forwarding does and does not cover.
Courses as the administrator sees them#
Instructors and students do their work in the app (Courses). The administrator's part:
- Who creates courses. With
teaching.open_course_creation: true(the default), anyone may create a course in the app and becomes its instructor. Set it tofalseto keep that to administrators. Gateway administrators act as staff in every course. - Instruments per course. Only an administrator can bind instruments to a course: Courses → Choose instruments, tick them, Save (or in the app, in the course's Settings). Only then do the course's rules apply to them: weekly quotas of experiments and minutes per student (weeks start Monday 00:00 UTC), approval of student runs, and class slots. The rules apply only to the course's students on those instruments; everyone else books and runs as before.
- Class slots. Instructors and TAs book them in the reservation calendar with Book for → Class slot. During a slot, only the course's members and administrators can start a session on that instrument, and slot time does not count against quotas.
- Waiting students. Students who have not linked their NucleI account, or have not signed in to NucleI, appear under Waiting for access in the course. They receive datasets automatically once they can. Instructors can copy a reminder text to send through the LMS.
- Deleting a course. Courses → Delete removes the course with its members, assignments, submissions, comments and class slots. Shared packages stay with their senders.
- Refusals students may report. When a student starts a session or joins the queue on a course instrument, the gateway can refuse with a code that the app shows as a sentence in the user's language:
approval_required(the queued run is not approved yet),quota_experimentsandquota_minutes(this week's limit used up),class_slot_in_progress(a class has booked the instrument now),course_required(the instrument belongs to several of the student's courses and none was chosen). Instructors handle all of these in the course; nothing is wrong with the gateway.
Backups and restore#
Everything the gateway keeps is in its working folder:
| Path | Contents | Without it |
|---|---|---|
data/gateway.db (or the PostgreSQL database) |
Users, instruments, bookings, courses, grades, LMS registrations, the grade queue | Nothing works |
data/teaching.key |
Key for course comments and review notes | Those texts cannot be read, and the gateway refuses to start if the file is damaged |
data/lti/ |
The LMS signing keys and page-token.secret |
Every LMS must be re-registered with new keys |
data/uploads/ |
Shared items, backups, uploaded reports | Users' shares and backups are gone |
data/secret.key |
The token-signing key (generated unless auth.secret_key is set) |
Everyone is signed out |
data/identity.key |
The certificate key (auth.identity_key_file, generated at first use) |
Every app must be enrolled again, and its users' signing keys certified again |
gateway.yaml |
Settings | Settings and LMS registrations kept in the file are lost |
data/config.overrides.yaml |
Settings changed on the admin Settings page | Those changes are lost; the gateway uses gateway.yaml |
Back them up together, with the backup command. It copies the SQLite database with SQLite's online backup, so the gateway keeps running and sessions are not cut, and adds secret.key, identity.key, teaching.key, the lti folder, data/uploads, gateway.yaml and data/config.overrides.yaml:
| Install | Command |
|---|---|
| Docker Compose | cd /srv/nuclei-gateway && sudo docker compose exec gateway /app/server/main.bin backup /app/data/backups/gateway-$(date +%F).tar.gz |
The archive is written owner-only. It holds the signing key, the teaching key and the LMS private keys: copy it off the machine and store it like a password. To run it nightly, put the command in root's crontab (sudo crontab -e), for example 30 2 * * * <command> (in a crontab, write % as \%). With PostgreSQL the command refuses; back up the database with pg_dump and the data folder with tar at the same time.
Restore:
- Stop the gateway (
sudo docker compose stop). - Run
restorewith the same configuration: copy the archive to/var/backups, thensudo docker compose run --rm -v /var/backups:/backups gateway /app/server/main.bin restore /backups/gateway-2026-11-13.tar.gz. Files it replaces are kept beside the new ones with a.pre-restore-<time>suffix. The archive'sgateway.yamlis restored into the working folder; whengateway.yamlis mounted from the host, take it from the archive (tar xzf <archive> files/gateway.yaml) and put it back by hand. - Start it (
sudo docker compose start) and check the log,/api/health, the admin sign-in, and a course comment in the app.
Restore onto the same gateway version or a newer one. An older version cannot open a database that a newer one has upgraded.
Upgrades and migrations#
The database is upgraded automatically when a newer gateway starts; the log shows a Running upgrade … line per step. There is no downgrade: to go back, restore the backup made before the upgrade together with the old version.
cd /srv/nuclei-gateway
sudo docker compose exec gateway /app/server/main.bin backup /app/data/backups/before-upgrade.tar.gz
sudo docker load < nuclei-gateway-compiled.tar.gz
sudo docker compose up -d
sudo docker compose logs -f gateway
Run one gateway process per database. Two containers on the same data folder corrupt it.
Logs and monitoring#
Logs go to standard output: sudo docker compose logs -f gateway. Lines worth watching:
| Log line | Meaning |
|---|---|
Nuclei Gateway (local mode) started on 0.0.0.0:8080 |
Started. |
Generated a token-signing key at …/secret.key |
First start without auth.secret_key; back the file up. |
No desktop app is enrolled with this gateway, … |
App sign-in is refused until an app is enrolled (App enrolment). |
auth event auto_login_refused code=enrolment_required … |
An app tried to sign in without a valid enrolment; also on App enrolment → Sign-in audit. |
LTI 1.3 tool enabled at https://… |
LTI is on, with this tool_url. |
Device NMR-1 (…) status: online -> offline (…): TCP connect to … timed out after 5s |
An instrument stopped answering. |
LTI request refused: unknown_deployment |
A launch was refused; the code is explained in LMS troubleshooting. |
LTI score job … failed after 8 attempt(s): … |
A grade could not be delivered; see the LMS page. |
Unhandled exception on … |
A bug; send the lines around it to support. |
Health check. GET /api/health answers 200 with {"status":"ok","database":"ok","version":…,"revision":…,"mode":"local",…} when the database answers a query, and 503 with "status":"error" when it does not. version is the gateway's release; revision is the source revision the image was built from, when known. It does not test the instruments or the LMS. Point your monitoring (Uptime Kuma, Nagios, Zabbix) at it through the proxy, for example curl -fsS https://nmr-gateway.chem.example.edu/api/health. Both images have a Docker HEALTHCHECK that calls it every 30 seconds (healthcheck subcommand), so docker ps reports healthy or unhealthy.
Also watch:
- disk space of the
datafolder (du -sh /srv/nuclei-gateway/data/uploads), which grows with shares and backups; - the LMS page's Grade pass-back list filtered to Failed;
- instruments stuck offline on the Dashboard.
Capacity. One process handles a department comfortably. Limits to keep in mind: one TCP port per running session (101 by default), uploads written to disk as they arrive, and SQLite allowing one writer at a time.
Troubleshooting#
| Symptom or message | Cause | Fix |
|---|---|---|
| Gateway exits at start: "auth.secret_key is the published example value …" or "… must be at least 32 characters" | gateway.yaml or GATEWAY_AUTH__SECRET_KEY holds change-me-in-production or a short key |
Remove the setting to have a key generated into data/secret.key, or set a random key of 32 characters or more. Before removing a key in use, note that changing it signs everyone out. |
| Gateway exits at start: "storage.backend 's3' is not implemented" | storage.backend: s3 |
Use fs. |
| App: Enrolment required | The app has no credential for this gateway, or the gateway no longer knows it (database restored from before the enrolment) | Enter a new code from App enrolment. |
| App: Enrolment revoked | An administrator revoked the installation | Enrol again with a new code if the PC should have access. |
App: sign-in refused with identity_bound_elsewhere |
That profile@computer was first used from another enrolled computer |
On Users, Release app for that user. |
App: sign-in refused with password_login_required |
The profile's account is an administrator (or an LMS or IdP account) | Use another account in the app; administrators sign in on the web pages. |
| Gateway exits at start: "lti.tool_url must be the gateway's public https:// address when lti.enabled is set" | tool_url missing or http:// |
Set the HTTPS address. |
| Gateway exits at start: "lti.platforms.0.auth_login_url … must be an https:// URL" | An LMS registration in gateway.yaml uses http:// |
Use the LMS's HTTPS addresses. |
| Gateway exits at start: "Teaching key … is empty; restore it from backup (deleting it loses course notes)", "… is not a valid key; restore it from backup", "… is unreadable" | teaching.key damaged or wrong permissions |
Restore it from the backup. Deleting it lets the gateway start with a new key, but existing comments and review notes become unreadable. |
| Login page offers Sign In although you never created an admin | Someone else created it first | Check Users; if it was not you, reinstall with an empty data folder before anyone uses it. |
| Admin sign-in: "Invalid credentials" | Wrong username or password | Another administrator can Set Password on Users. |
| App: Can't reach the server | Wrong address, proxy or firewall, or certificate | curl https://<host>/api/health from that PC's network; see Certificate problems. |
| App: "Couldn't reach the gateway at 127.0.0.1:9000. Check that the port is open in the gateway host's firewall." (or another wrong address) | Wrong advertised host | Set server.advertised_host; with nginx, proxy_set_header Host $host. |
| The same message with the right host name | Tunnel ports blocked | Open TCP 9000 to 9100 on the gateway host and publish them in Docker. |
| Session refused: "Device NMR-1 is currently in use by … until …" | Someone holds it | Wait, join the queue, or Force Disconnect on Sessions. |
| Session refused: "No available tunnel ports" | All ports in the range in use | Widen proxy.port_range_* (and Docker and the firewall). |
| Instrument offline with "… The device is registered on a loopback address …" | Instrument registered as localhost while the gateway runs in Docker |
Set device_loopback_host: "host.docker.internal" and add --add-host host.docker.internal:host-gateway, or register its real address. |
| Instrument offline with "TCP connect to … timed out" | Network or instrument down | Check that the gateway machine reaches that host and port (nc -vz 10.0.1.50 5000). |
| Sharing a large project fails behind nginx with HTTP 413 | nginx body size limit | client_max_body_size 0;. |
| Everyone was signed out after a restart | The signing key changed: auth.secret_key was edited, an environment variable now sets it, or data/secret.key was lost |
Keep one key; restore data/secret.key from the backup. |
LMS-specific messages are in LMS troubleshooting.
Security notes#
- App sign-in needs enrolment. The app signs in as
profile@computerwith the credential of an enrolled installation; without one it is refused. App sign-in never yields an administrator, LMS or identity-provider account, and an identity answers only to the computer that first used it. Enrolment codes and credentials are stored as hashes. A user who controls an enrolled computer can still claim anyprofile@computername not yet tied to another computer, so issue codes only for computers you manage, keep the fleet code in a protected policy file, and revoke installations you no longer trust. Limit/apito the networks that need it (campus network or VPN); if students' browsers must reach the gateway from home for an LMS, publish only/lti/there. - Protect the signing key.
data/secret.key(orauth.secret_key) signs every session token; whoever has it can sign in as anyone. It is created owner-only; keep backups of it as safe as the key itself. - Instrument tunnels are not encrypted by the gateway and are open to the session's holder only by port number. Keep ports 9000 to 9100 on the lab network.
- Shared items are encrypted in the app before upload. With
end_to_endgroup keys the gateway cannot read them; with the defaultservermode it holds the group keys, so anyone who administers the gateway can. Course comments and review notes are encrypted at rest withteaching.key. The database, the keys and the backups are still sensitive: treat a backup archive like a password. - HTTPS protects sign-in tokens on the way. Without a proxy everything, tokens included, is plain text.
- Create the administrator immediately after installation, and keep the number of administrators small.
- LMS. Launches are signed by the LMS and checked by the gateway; see LMS integration, Security.
- What leaves the gateway. Grades and LMS calls go to the registered LMS only. The gateway sends nothing to TerraQuanTech.