|
| 1 | +# Debugging Blueprints |
| 2 | + |
| 3 | +Blueprints can be deployed to multiple different [sources](/developers/deployment/sources/introduction), with each one |
| 4 | +having its own constraints. The CLI has commands to test your blueprint in these environments, assuming your machine is |
| 5 | +capable of hosting them, see [requirements](/operators/manager/requirements). |
| 6 | + |
| 7 | +Supported spawn methods: |
| 8 | + |
| 9 | +- `native` (no-vm) |
| 10 | +- `vm` |
| 11 | +- `container` |
| 12 | +- `tee` (WIP) |
| 13 | + |
| 14 | +Note that in any case, the commands need to be run at the root of the blueprint's directory, as the CLI will read the |
| 15 | +generated `blueprint.json`. |
| 16 | + |
| 17 | +# Native Debugging |
| 18 | + |
| 19 | +See the [requirements](/operators/manager/requirements#native-sources) |
| 20 | + |
| 21 | +To test your blueprint natively (as a host process): |
| 22 | + |
| 23 | +1. Build the binary |
| 24 | + ```shell |
| 25 | + $ cargo build |
| 26 | + ``` |
| 27 | +2. Find the path to the binary |
| 28 | + For example, `./target/debug/my-blueprint-bin` |
| 29 | +3. Spawn it with the CLI |
| 30 | + ```shell |
| 31 | + $ cargo tangle debug spawn --method native --binary "./target/debug/my-blueprint-bin" |
| 32 | + ``` |
| 33 | + |
| 34 | +# VM Debugging |
| 35 | + |
| 36 | +See the [requirements](/operators/manager/requirements#native-sources) |
| 37 | + |
| 38 | +To test your blueprint in a VM sandbox: |
| 39 | + |
| 40 | +1. Build the binary |
| 41 | + ```shell |
| 42 | + $ cargo build |
| 43 | + ``` |
| 44 | +2. Find the path to the binary |
| 45 | + For example, `./target/debug/my-blueprint-bin` |
| 46 | +3. Spawn it with the CLI |
| 47 | + ```shell |
| 48 | + $ cargo tangle debug spawn --method vm --binary "./target/debug/my-blueprint-bin" |
| 49 | + ``` |
| 50 | + |
| 51 | +Once spawned, the VM's output will be printed to the terminal (you may need to press `enter` first). |
| 52 | + |
| 53 | +# Container Debugging |
| 54 | + |
| 55 | +See the [requirements](/operators/manager/requirements#container-sources) |
| 56 | + |
| 57 | +For testing, you'll likely want to set up a [local registry](https://www.docker.com/blog/how-to-use-your-own-registry-2/). |
| 58 | + |
| 59 | +1. Build, tag, and push the image to your registry |
| 60 | + If your blueprint is based off the [blueprint template], it will come with a basic [Dockerfile] that should be suitable |
| 61 | + for most blueprints, and can be edited if necessary. |
| 62 | +2. Spawn it with the CLI |
| 63 | + ```shell |
| 64 | + $ cargo tangle debug spawn --method container --image "my.registry:5000/my-blueprint:latest" |
| 65 | + ``` |
| 66 | + |
| 67 | +This will start a Pod named `service` under the `blueprint-manager` namespace. |
| 68 | + |
| 69 | +You can view its logs with: |
| 70 | + |
| 71 | +```shell |
| 72 | +$ kubectl logs service -n blueprint-manager |
| 73 | +``` |
| 74 | + |
| 75 | +And its status with: |
| 76 | + |
| 77 | +```shell |
| 78 | +$ kubectl describe pod service -n blueprint-manager |
| 79 | +``` |
| 80 | + |
| 81 | +# TEE Debugging |
| 82 | + |
| 83 | +See the [requirements](/operators/manager/requirements#tee-sources-wip-linux-only) |
| 84 | + |
| 85 | +1. Create a Docker image for your blueprint, see [Container Debugging](#container-debugging) |
| 86 | +2. TODO |
| 87 | + |
| 88 | +[blueprint template]: https://github.com/tangle-network/blueprint-template |
| 89 | +[Dockerfile]: https://github.com/tangle-network/blueprint-template/blob/main/Dockerfile |
0 commit comments