Filesystem

Mount

Serve a branch as a live folder on Linux, without downloading it first.

Mount a branch when you want to work on it as an ordinary folder on a Linux machine. Nothing is downloaded before you start.

sudo skywaked --store s3://my-bucket &          # once per machine
skywake mount app@main /work --fork agent-37
# ... work in /work; changes reach the bucket every 2 seconds ...
skywake sync /work
skywake unmount /work
skywake merge app@agent-37 --local

Mounts run in skywaked, one daemon per Linux machine, on the store it was started with. The skywake command sends it requests over a Unix socket. The listing of every folder arrives with the mount. File contents are read chunk by chunk through a cache on local disk.

A skywaked store is one disk, so in app@agent-37 only the branch counts. The other branch commands (fork, merge, diff, log) reach the same store with --local, and go through the daemon when it is running. On macOS, or without a store of your own, use download and upload instead.

Flags

FlagWhat it does
--fork NAMEFork the branch as NAME first, and mount the fork.
--read-onlyMount the current commit read-only, without claiming the branch. Any number of readers can do this at once.
--owner UID:GIDWho owns the branch's files in the mount.
--allow-otherLet other users use the mount too. Permission bits still apply.
--vmServe the branch to a VM over a vhost-user socket instead of a folder.

Mount commands

CommandWhat it does
skywake mountsList the folders skywaked has mounted.
skywake statusShow each mount's save lag, unsaved bytes and last error, and the chunk cache.
skywake sync /workSave now. Returns when the changes are in the bucket.
skywake unmount /workSave the last changes and unmount. Fails if a process still uses the folder.

A mount saves on its own; see autosave. v2 has no command to save a mount as one named commit.

Moving a branch

Mounting a branch claims it. If the same branch is mounted on another machine, that mount finds out at its next save (or within 5 seconds if it is idle) and turns read-only. Writes to it fail with EROFS, and skywake mounts shows it as moved. Its unsaved changes are kept so you can recover them. If you unmount first, the move loses nothing.

skywaked settings

Each setting can be given as a flag or as an environment variable.

FlagEnvDefaultMeaning
--storeSKYWAKE_STORE.skywakeThe store: s3://bucket, gs://bucket, az://container or a folder.
--rootSKYWAKE_ROOT/var/lib/skywake as root, else ~/.local/state/skywakeSocket, chunk cache and local files.
--save-every-msSKYWAKE_SAVE_EVERY_MS2000How often each mount saves.
--head-check-msSKYWAKE_HEAD_CHECK_MS5000How often an idle mount checks whether another machine took its branch.
--cache-gbSKYWAKE_CACHE_GB10Disk for the chunk cache.
--mount-local-gbSKYWAKE_MOUNT_LOCAL_GB20Disk per mount for unsaved and not-yet-freed files. 0 is no limit.
--cache-nodesSKYWAKE_CACHE_NODESShared cache nodes to ask before the bucket. One address that reaches any of them is enough, such as a Kubernetes service: the rest are found from it.
--cache-tokenSKYWAKE_CACHE_TOKENThe cache nodes' token.
--log-copiesSKYWAKE_LOG_COPIES3Cache nodes, each in its own zone, that hold a write before fsync returns. 0 waits for the bucket.
--headsSKYWAKE_HEADSbucketWhere branch heads live. tier: the cache nodes own them and copy them to the bucket. Needs cache nodes started with --url or --peers.
--groupSKYWAKE_GROUPMembers of this group may use skywaked too.
--accessSKYWAKE_ACCESSaccess in the rootWhich members may read or write which branches.
--metrics-listenSKYWAKE_METRICS_LISTENServe Prometheus metrics at /metrics.

Run skywaked as root for the best write speed. The root folder must belong to the user who runs skywaked.

Sharing a machine

Several people or agents can share one skywaked. With --group, members of that group may mount over folders they own and manage their own mounts. An access file says which branches each of them may use:

# who         how    which branches
user:ann      write  agent-*
group:ci      read   *
  • write includes read.
  • agent-* matches agent-1 but not agent.
  • A read-only mount needs read. A writable mount needs write. fork and merge need read on the source and write on the target.

The file must belong to root or to the daemon's user, and no one else may be able to write to it. Without an access file, every member may use every branch. Don't give the members any store keys, so that every change goes through the daemon.

Build output

Inside a mount, the folders that .skywakeignore names (/target and /node_modules by default) are symlinks to folders on local disk. That way builds run at disk speed. These folders belong to the mount's owner and are not kept after you unmount.

VMs

To give a branch to a virtual machine instead of a folder, mount it on a socket with --vm:

skywake mount app@agent-37 /run/vm.sock --vm

Point the hypervisor at the socket (QEMU: -chardev socket,id=fs,path=/run/vm.sock -device vhost-user-fs-pci,chardev=fs,tag=skywake, with shared guest memory). Then, inside the VM, run mount -t virtiofs skywake /mnt.

Next