Docs

fig-host

This page describes Fig 0.1.9.

What fig-host is

fig-host is a command-line program for Linux. It runs Fig cores on a machine that has no desktop app — a server, a spare computer, a cloud VM. From a shell it creates, starts, stops, backs up and restores cores, and fig-host menu adds a small tray menu to that machine’s desktop for the same actions. You then connect the desktop app to the core from anywhere, as described in How Fig works.

Docker is the only thing the machine needs. fig-host is built for Linux on x86_64 and arm64.

Install

curl -fsSL https://fig4.ai/host.sh | sh

The script downloads the right fig-host for that machine, puts it at /usr/local/bin/fig-host (using sudo or doas if your user can’t write there), and ends by printing fig-host <version> is installed. After that, fig-host keeps itself up to date.

Commands

What fig-host prints when run with no arguments:

fig-host list — list this machine's Fig projectsfig-host new <label> [--folder <path>]... — create and start a project; each --folder loads a folder into itfig-host start <address-or-label> — start a projectfig-host restart <address-or-label> — stop a project and start it again on this versionfig-host peek <address-or-label> — show a project's address, token and versionfig-host stop <address-or-label> — stop a projectfig-host attach <address-or-label> <path> — load a folder into a stopped projectfig-host detach <address-or-label> <place> — unload a folder from a stopped projectfig-host backup <address-or-label> <file> — save a project to one file; it is off while the copy is madefig-host restore <file> [--folder <place>=<dir>]... — create a project from a backup; each --folder puts that folder inside <dir>fig-host menu — put Fig in the menu bar, now and at every loginfig-host update — install the published fig-host release nowfig-host version — print this fig-host's version

<address-or-label> is either the project’s label — the name you gave it — or its address as fig-host list shows it. A project must be stopped before you attach or detach folders; the change takes effect at the next start.

Start a core, connect the app

fig-host new <label> creates a core and starts it; fig-host start starts an existing one. Both end by printing three lines (fig-host peek shows them again at any time):

Address: https://<this machine's address>:<port>
Token: <token>
Version: <version>

The address line really does say <this machine's address>: fig-host doesn’t guess how your other machines reach this one. Replace that part with the machine’s hostname or IP address and keep the port fig-host chose.

A core the desktop app created answers only on its own machine unless Reachable from other machines is switched on in the app there; with the switch off, fig-host prints Address: https://127.0.0.1:<port> (this machine only).

In the desktop app, press the + beside the project tabs to open the Open a project dialog. Choose Remote core, type the address into core address and the token into bearer token, then press Confirm. For a project you already have open, the same two fields are in Settings › Project settings › Fig core. The core comes up paused; resume it from the app when you want work to start.

Move a core to another machine

To move a core, back it up on one machine and restore the backup file on another. The steps:

  1. In the app, open Settings › Project settings › Fig core. If the core is on this machine, Back up opens a save dialog; the suggested file name is the project’s label and today’s date, ending in .figbackup. If the core is on another machine, the field beside the button (“A path on that machine”) suggests that same name, placed next to the core’s first folder; keep it or change it, then press Back up, and the file is written on that machine. If the core is on, the app then warns: “Backing up switches the core off until the copy is written. It comes back paused.” Press Back up again. Wait for “Backed up to <path>.” Nothing can start the core while the copy is being made. From a shell, fig-host backup <address-or-label> <file> does the same.
  2. Copy the backup file to the other machine — with scp, a USB drive, or however you like.
  3. On that machine, run this line, which installs fig-host and restores the backup. The app shows the same line when you tick Start from a backup file under Remote core in the Open a project dialog (“Copy the backup file to your remote machine, then run this there:”):
    curl -fsSL https://fig4.ai/host.sh | sh && fig-host restore <backup file>
    It restores the core as a new project, starts it, and prints the address, token and version as above.
  4. Back in the app (“It prints the address and token to enter below.”), type them into core address and bearer token, then press Confirm.

To restore on another desktop computer instead of a server: Open a project › Local core › tick Start from a backup file › Choose backup… › Confirm. Each folder in the backup is placed in your home folder under its own name; Change… beside a folder chooses a different parent folder. With fig-host, --folder <place>=<dir> does the same, and fig-host prints where each folder will go before it writes anything.

A restored core is a new core, with its own address and its own token. The original is untouched, so the same backup can run on two machines without either disturbing the other.