This guide will walk you through the process of getting two Fuchsia devices set up and synchronizing story state using the Ledger.
Follow the steps at in the top level docs to:
- Check out the source and build Fuchsia.
- Install it on two devices (or emulators).
- Connect the devices to the network.
Follow the instructions at go/tq-net-boot to set up a private test network.
Each Fuchsia device has a unique node name based on its MAC address. It is of
the form power-nerd-saved-santa
. You can list the nodes on your network with
the netls
command.
> netls
device glad-bats-hunk-lady (fe80::f64d:30ff:fe68:2620/6)
device blurt-chip-sugar-wish (fe80::8eae:4cff:feee:4f40/6)
The netruncmd <nodename> <command>
command can be used to run commands on
remote machines. The output of the command is not shown. If you need to see
the output, use the loglistener [<nodename>]
command.
Ledger is a distributed storage system for Fuchsia. Stories use it to synchronize their state across multiple devices. Follow the steps in Ledger's User Guide to:
- Set up persistent storage. (optional)
- Verify the network is connected.
- Configure a Firebase instance.
- Setup sync on each device using
configure_ledger
.
A booted Fuchsia system has shells running in two different environments. The
Magenta shell (magenta$
prompt) runs in an empty environment at the root
of the environment tree. The Fuchsia shell ($
prompt) runs further down
the environment tree and has access to many more resources including the
graphics server. For more information see
Fuchsia Boot Sequence.
The systems boots up with three Fuchsia shells and one Magenta shell. Alt-F1 through Alt-F4 can be used to switch between virtual consoles.
All of the examples below use netruncmd
on your host system. netruncmd
executes commands in the same environment as the Magenta shell. Because of
this, they need an @boot
prefix to run in the "boot" environment. This is
functionally the same as running them in the Fuchsia shell. The @boot is not
needed when entering commands in a Fuchsia shell ($
prompt).
The format of the Ledger as well as the format of the data each story syncs is
under rapid development and no effort is currently made towards forwards and
backwards compatibility. Because of this, after updating the Fuchsia code, it
is a good idea to wipe your remote and local data using cloud_sync clean
.
$ netruncmd <nodename> cloud_sync clean
Use the device_runner
to start a story on one device:
$ netruncmd <first-node-name> "@boot device_runner --user_shell=dev_user_shell \
--user_shell_args=--root_module=example_todo_story"
Using loglistener <first-node-name>
take note of the story ID from a line the
following:
... DevUserShell Starting story with id: IM7U9hBcCt
The story can be started on the second device either through the system UI or by specifying the story ID.
Launch the system UI using device_runner
:
$ netruncmd <second-node-name> "@boot device_runner"
Once the system UI starts, you should be able to see the story started in the step above. Click on that to open it.
With the story ID noted above from launch the story from a shell:
$ netruncmd <second-node-name> "@boot device_runner \
--user_shell=dev_user_shell \
--user_shell_args=--story_id=<story_id>