~ knotless Search/
↑↓ move↵ open⇧↵ all results

socialweb.computer/socialweb-computer-kcp

socialweb.computer: a compute market on atproto (kcp)

1 collaborator
0
0
87 lines · 2.7 KB Raw History
# A local market on one machine

One kcp with its own PLC, relay, PDSes and a bidder, on one Linux machine; nothing touches prod. You need the binary
([README](../README.md#install)), `/dev/kvm`, a subordinate id range and a normal account (not root).

## Check the host

```sh
socialweb-computer check-host -role bidder -state-dir ~/.swc/demo
```

Every line `OK` (an `INFO` line is a note); a `FAIL` line names its fix. A home of mode `0701` passes but its VMs do
not boot; `0700` works.

## Start it

```sh
S=~/.swc/demo
socialweb-computer dev up --instance demo --profile market-network --host-backend proc --state-dir $S
socialweb-computer dev status --instance demo --state-dir $S | jq -r '.network.status.phase'
```

`Ready` after about 35 s. `--bidders N` adds bidders, `--with-gateway` a Kubernetes gateway, `--compute-kinds vm,deno`
Deno sandboxes.

## Request a VM in it

```sh
socialweb-computer run request --network demo --state-dir $S --name vm1 --exec -- id
```

You see `uid=0(root) gid=0(root) groups=0(root)`; the VM is released when the command ends.

## Hold, ssh, release

```sh
socialweb-computer run request --network demo --state-dir $S --name vm2 --hold --exec -- uname -m
```

```sh
socialweb-computer run request ssh vm2 --state-dir $S
```

```sh
socialweb-computer run request list --state-dir $S
socialweb-computer run request release vm2 --state-dir $S
```

`list` shows `vm2 ... Held`, then `release` ends it (`"phase": "Released"`).

## kubectl: a requester that stays up

From a clone of this repo (`examples/infra/`). In one terminal:

```sh
socialweb-computer run requester --name qs --network demo --state-dir $S
```

In another (`S=~/.swc/demo` again):

```sh
eval "$(socialweb-computer run requester env qs --state-dir $S)"
sed "s|ssh-ed25519 AAAAREPLACE-WITH-YOUR-PUBLIC-KEY you@laptop|$(cat "$(jq -r .sshPublicKey $S/requesters/qs/ready.json)")|" \
  examples/infra/vm.yaml | kubectl apply -f -
kubectl wait infras.socialweb.computer/quickstart-vm --for=jsonpath='{.status.phase}'=Deployed --timeout=5m
socialweb-computer run requester ssh qs --state-dir $S --contract infra-quickstart-vm-vm1 --exec -- cat /root/quickstart
```

You see `quickstart-vm-ok`. Release it, then Ctrl-C the requester (it keeps its state):

```sh
kubectl delete infras.socialweb.computer quickstart-vm
```

## Stop it

```sh
socialweb-computer dev down --instance demo --state-dir $S
```

It releases every VM and removes `$S/dev/demo`.

## Tenant clusters, Deno, agents

A tenant Kubernetes cluster (`--with-gateway`), a Deno sandbox (`--compute-kinds vm,deno`), `EphemeralInfra` and an
agent VM: [acceptance/0012](acceptance/0012-infra-quickstart.md) and [../examples/infra/](../examples/infra/). The
network itself: [../deploy/market-network/README.md](../deploy/market-network/README.md).