The scripts in this directory are convenience wrappers around primarily two tools: make-fuchsia-vol
that is a host tool in the build, and gcloud
which is the command like client for Google Cloud.
The scripts are usable via //scripts/gce/gce
as an executable bash script.
gcloud auth login gcloud config set project my-awesome-cloud gcloud config set compute/region us-west1 gcloud config set compute/zone us-west1-a
The following incantation will create the relevant disk images and boot a Fuchsia instance:
cd $FUCHSIA_ROOT fx set x86-64 --release fx full-build gce create-grub-image gce create-fuchsia-image gce create-instance sleep 60 gce serial
The gce script suite comes with an env.sh
that sets default environment variables used by gce subcommands. The gce
entrypoint script sources this. Users can override all of the variables seen in env.sh
, for example, altering the name of the GCE instance you create/delete can be done by setting $FUCHSIA_GCE_INSTANCE
. See the contents of the script for more options.
The approach these scripts use create two disks for your GCE instance. One contains a minimal preconfigured GRUB bootloader that searches for, and boots, a Zircon image in an EFI-style directory layout on any disk in the system.
The Fuchsia disk images are built as standard x86-64 EFI bootable GPT volumes. The Grub image is mostly static and rarely needs to change. It can be shared between members of the same cloud project.
When instances are created, the grub disk is used as a system image (this is copied to the booting machine, and being small it facilitates fast boot times). The Fuchsia image is attached as a new persistent disk.
The gce
entrpoint script sources env.sh
, then looks for a command script in the gce
scripts directory that matches the first argument given to it. If it finds one, it shifts the first argument and execs that script.
make-fuchsia-vol
tool.~/.ssh/google_compute_engine
to your ssh-agent
.