Running a node
In the repository, with the devenv shell (it has every tool):
cargo build --release -p fos # the program: target/release/fosapps # the engine and apps: target/apps/*.appA release has the same files: the fos program and the apps/ folder.
Make a node
Section titled “Make a node”fos init --engine target/apps/Capability.appThis makes the data directory (by default ~/.fileos; change it with --dir
or FOS_DIR), a key for the node, and a root folder. The engine is the set of
rules of the node. Capability.app is the default engine: the maker of a
folder may do everything in it, and gives others what they may do.
Run it
Section titled “Run it”fos runThis starts the network, the apps and the gateway. The gateway is a small
HTTP API on 127.0.0.1 for the other fos commands. It needs the token in
gateway.token in the data directory.
| Option | What it does |
|---|---|
--listen ADDR |
A libp2p address to listen on (default: TCP on every address) |
--peer ADDR |
A node to connect to at the start |
--gateway ADDR |
Where the gateway listens (default 127.0.0.1, any free port) |
--no-mdns |
Do not look for nodes on the home network |
fos status shows the node key, the addresses it listens on (with /p2p/…,
ready to give to another node), the peers, the folders and the apps.
Connect two nodes
Section titled “Connect two nodes”On the home network, nodes find each other with mDNS. In other places, give one node the address of the other:
fos dial /ip4/192.0.2.10/tcp/4001/p2p/12D3KooW…The network is libp2p: TCP with Noise and Yamux, relays and hole punching. There is no DHT: a node only talks to the nodes you connect it to, and only sends a folder to the nodes that its rules allow.
The data directory
Section titled “The data directory”node.key the key of the node (keep it secret)root the ID of the root folderengine/ the engine of this nodeblobs/ file contents, named by their hashfolders/*.log the signed log of each folderlocal/*.kv the data each app keeps on this node onlygateway.token the token for the gatewayA copy of the directory, made while the node is stopped, is a full backup. When the node starts, it reads every log again and checks each entry with the engine.
When something is wrong
Section titled “When something is wrong”- A folder does not come. Check that the nodes are connected
(
fos statuslists the peers), and that the owner of the folder gave your node keystoreon it. - Writes wait.
fos statussays how many writes wait for their ordering node. They are sent when that node is connected again. FORKinfos status. Your engine did not take an entry that the ordering node took. The status says which entry and why.- More detail. Run the node with
RUST_LOG=debug fos run.