plexora node serve
Serve one or more files to a Plexora viewer.
Serve one or more files to a Plexora viewer. Every --serve names one resource as kind:id=path, where kind is image, segmentation or table, and id is the name a project will point at.
Usage
plexora node serve [-h] [--serve KIND:ID=PATH] [--host HOST] [--port PORT] [--token TOKEN]
[--node-id NODE_ID] [--allow-origin ORIGIN] [--pair [ORIGIN]]
[--browser-endpoint URL] [--app] [--tls {self-signed}]
[--url-prefix PATH] [--plugins PLUGINS] [--dynamic] [--manifest PATH]
[--exit-on-stdin-close] [--relay-file PATH]Options
--serve KIND:ID=PATHrepeatableA resource to serve, e.g. --serve table:cells=/data/cells.h5ad. Repeat for each one.
--host HOSTdefault 127.0.0.1Address to bind. 127.0.0.1 by default; pass 0.0.0.0 to accept connections from other machines.
--port PORTdefault 8642--token TOKENShared secret the viewer authenticates with. One is generated and printed if you do not supply one.
--node-id NODE_IDStable name for this node, used in cache keys. Generated per launch if unset.
--allow-origin ORIGINrepeatableA viewer origin allowed to read this node from a browser, e.g. http://127.0.0.1:8000. Repeat for each. Needed only when the browser talks to this node directly rather than through the viewer. Origins in PLEXORA_NODE_ORIGINS (separated by commas or spaces) are allowed as well.
--pair [ORIGIN]Once listening, print a link that pairs this node with the Plexora page at ORIGIN (default https://viewer.plexoraapp.com), and allow that origin. The token rides in the link's #fragment, which the browser never sends to a server; the link is printed here and nowhere else.
--browser-endpoint URLWith --pair: the address the browser should use for this node, when it is not this machine's own address and port (127.0.0.1) -- a lab gateway's hostname, or the local end of a tunnel on another port.
--appAlso serve the Plexora web app at /app/, from the static build shipped with this install (when it has one). The app is public code and is served without the token; every data route still needs it.
--tls {self-signed}one of: self-signedServe HTTPS with a certificate this node makes once and keeps (in the data root's node-tls folder), for a browser that opens the node at its own address -- a cloud VM the website started. The browser warns once; the certificate's SHA-256 fingerprint is printed to check the warning against.
--url-prefix PATHThe path this node is reached under behind a reverse proxy, e.g. /rnode/<host>/<port>, for the app's redirects. Without it, an X-Forwarded-Prefix header is used, and otherwise the redirects are relative.
--plugins PLUGINSComma-separated plugin names whose file-side work this node should be able to run. Defaults to every installed plugin.
--dynamicLet the viewer add and remove resources while this node runs, instead of only serving what --serve names. Needed for picking files from the viewer's data forms; whoever holds the token can then read any file this account can, so use it on your own machine rather than a shared one.
--manifest PATHA file recording what this node ends up serving, re-read at startup so a project reopened in a later session finds its files again. Holds paths on this machine and nothing about any project.
--exit-on-stdin-closeStop when whatever started this node closes its input. For a node launched over SSH without a terminal -- a Windows workstation, where asking for one folds the startup line this node prints -- it is what makes the node end with the connection instead of being left running and holding a port.
--relay-file PATHJoin a room on the Plexora website's relay, as the JSON file at PATH describes (written by the page's start script, which runs this). The file is read and deleted at startup; the node then answers the page through the relay, reconnecting on its own, until the page stops it or none has been open for the file's idle_exit seconds.
Examples
Serve three files
plexora node serve --serve image:tonsil=/data/tonsil.ome.tif --serve segmentation:tonsil_mask=/data/tonsil_mask.tif --serve table:cells=/data/cells.csvAccept connections from other machines, with a fixed token
plexora node serve --host 0.0.0.0 --port 8642 --token my-shared-secret --serve image:tonsil=/data/tonsil.ome.tifLet the viewer pick files on this machine
plexora node serve --dynamicPython equivalent
A node is registered on the viewer's side with plexora.register_node,
and a project is pointed at one of its resources with
plexora.attach_image, plexora.attach_table or
plexora.attach_segmentation.
import plexora
plexora.register_node("lab-server", "http://lab-server:8642", token="my-shared-secret")
plexora.node_resources("lab-server")