Skip to content

Commit 6200a0a

Browse files
authored
feat: document the blueprint sources (#130)
1 parent 6cb76c4 commit 6200a0a

File tree

15 files changed

+351
-9
lines changed

15 files changed

+351
-9
lines changed

pages/developers/_meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const meta: Meta = {
1919
"tangle-avs": "Build a Tangle Blueprint",
2020
"eigenlayer-avs": "Build an Eigenlayer AVS",
2121
"testing-with-tangle": "Testing with Tangle",
22+
deployment: "Deployment",
2223
troubleshooting: "Troubleshooting",
2324
"-- solution-developers": {
2425
type: "separator",

pages/developers/cli/quickstart.mdx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,4 @@ cargo tangle blueprint create --name <blueprint-name>
2525

2626
## Deploying your Blueprint
2727

28-
Once you're ready to deploy your blueprint, simply:
29-
30-
```shell
31-
export SIGNER="//Alice"
32-
export EVM_SIGNER="0xcb6df9de1efca7a3998a8ead4e02159d5fa99c3e0d4fd6432667390bb4726854"
33-
cargo tangle blueprint deploy tangle --devnet
34-
```
35-
36-
See [deploy command reference](./tangle.mdx#deploying-a-blueprint) for all options.
28+
See [Deployment](/developers/deployment/introduction)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Meta } from "nextra";
2+
3+
const meta: Meta = {
4+
introduction: "Introduction",
5+
sources: "Sources",
6+
};
7+
8+
export default meta;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Deploying Blueprints
2+
3+
In order for a blueprint to be instance-able, it'll need to be deployed and have one or more sources defined.
4+
5+
## Defining Sources
6+
7+
Before deploying, you must specify the sources from which to fetch the blueprint binaries.
8+
See [Sources](/developers/deployment/sources/introduction).
9+
10+
## Deploying via the CLI
11+
12+
Once you're ready to deploy your blueprint, simply:
13+
14+
Install the [cargo-tangle] CLI, if you haven't already.
15+
16+
For testing, you can deploy to a local devnet:
17+
18+
```shell
19+
export SIGNER="//Alice"
20+
export EVM_SIGNER="0xcb6df9de1efca7a3998a8ead4e02159d5fa99c3e0d4fd6432667390bb4726854"
21+
cargo tangle blueprint deploy tangle --devnet
22+
```
23+
24+
See [deploy command reference](/developers/cli/tangle#deploying-a-blueprint) for all options.
25+
26+
[cargo-tangle]: /developers/cli/installation
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Meta } from "nextra";
2+
3+
const meta: Meta = {
4+
introduction: "Introduction",
5+
native: "Native",
6+
container: "Container",
7+
tee: "Trusted Execution Environment (WIP)",
8+
wasm: "WASM (WIP)",
9+
testing: "Testing",
10+
};
11+
12+
export default meta;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Container Source
2+
3+
The `Container` source is used for blueprints that are intended to be built as container images and published to image
4+
registries, such as `docker.io`.
5+
6+
## Requirements
7+
8+
The requirements for running containerized blueprints are available [here](/operators/manager/requirements#container-sources)
9+
10+
## Format
11+
12+
The `Container` source has the following format:
13+
14+
```rust
15+
pub struct ContainerSource {
16+
pub registry: String,
17+
pub image: String,
18+
pub tag: String,
19+
}
20+
```
21+
22+
Where:
23+
24+
- `registry` - The registry to pull the image from (e.g., `docker.io`)
25+
- `image` - The name of the image (e.g., `some-user/my-blueprint`)
26+
- `tag` - The release tag of the image (e.g., `latest`)
27+
28+
And they can be specified in the manifest of your binary crate like so:
29+
30+
```toml
31+
[package.metadata.blueprint]
32+
sources = [
33+
{ type = "Container", registry = "docker.io", image = "some-user/my-blueprint", tag = "latest" }
34+
]
35+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Blueprint Sources
2+
3+
Blueprints can be built and distributed in multiple formats (visible on the sidebar).
4+
5+
A blueprint can define many sources of different types in the manifest of its binary crate:
6+
7+
```toml
8+
[package.metadata.blueprint]
9+
sources = [
10+
{ type = "Container", registry = "docker.io", image = "some-user/my-blueprint", tag = "latest" },
11+
# Fallback container source
12+
{ type = "Container", registry = "ghcr.io", image = "some-user/my-blueprint", tag = "latest" },
13+
# Native binary source
14+
{ type = "Native", owner = "some-github-user", repo = "some-blueprint", tag = "0.1.0", binaries = [
15+
{ arch = "Amd64", os = "Linux", name = "my-blueprint-bin" },
16+
] },
17+
]
18+
```
19+
20+
The above example has two container sources, which allows an operator to attempt a pull from different sources in the event
21+
that one of the registries is unreachable. Additionally, it has a native source which can act as a fallback for operators
22+
that either cannot or prefer not to support running containerized blueprints.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Native Sources
2+
3+
The `Native` source is used for blueprints that compile to a native binary and release via the [`release.yml`] GitHub workflow
4+
from the blueprint template.
5+
6+
## Requirements
7+
8+
The requirements for running native blueprints are available [here](/operators/manager/requirements#native-sources)
9+
10+
## Format
11+
12+
The `Native` source has the following format:
13+
14+
```rust
15+
pub struct NativeSource {
16+
pub owner: String,
17+
pub repo: String,
18+
pub tag: String,
19+
pub binaries: Vec<BlueprintBinary>,
20+
}
21+
22+
pub struct BlueprintBinary {
23+
pub arch: Architecture,
24+
pub os: OperatingSystem,
25+
pub name: String,
26+
}
27+
```
28+
29+
Where:
30+
31+
- `owner` - The owner of the GitHub repository (e.g., `tangle-network`)
32+
- `repo` - The name of the repository (e.g., `some-blueprint`)
33+
- `tag` - The release tag of the binary (e.g., `0.1.0`)
34+
- `binaries` - A list of binaries (e.g., see below)
35+
36+
And in `BlueprintBinary`:
37+
38+
- `arch` - The architecture the blueprint was built for (see [Architecture])
39+
- `os` - The operating system the blueprint was built for (see [OperatingSystem])
40+
- `name` - The name of the binary in the GitHub release (e.g., `my-blueprint-bin`)
41+
42+
And they can be specified in the manifest of your binary crate like so:
43+
44+
```toml
45+
[package.metadata.blueprint]
46+
sources = [
47+
{ type = "Native", owner = "some-github-user", repo = "some-blueprint", tag = "0.1.0", binaries = [
48+
{ arch = "Amd64", os = "Linux", name = "my-blueprint-bin" },
49+
] },
50+
]
51+
```
52+
53+
[`release.yml`]: https://github.com/tangle-network/blueprint-template/blob/main/.github/workflows/release.yml
54+
[Architecture]: https://docs.rs/tangle-subxt/latest/tangle_subxt/tangle_testnet_runtime/api/runtime_types/tangle_primitives/services/sources/enum.Architecture.html
55+
[OperatingSystem]: https://docs.rs/tangle-subxt/latest/tangle_subxt/tangle_testnet_runtime/api/runtime_types/tangle_primitives/services/sources/enum.OperatingSystem.html
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Trusted Execution Environment Sources
2+
3+
The `TEE` (Trusted Execution Environment) source is used for blueprints that are built as container images, and intended to
4+
be deployed to a [dstack] TEE.
5+
6+
## Requirements
7+
8+
The requirements for running TEE blueprints are available [here](/operators/manager/requirements#tee-sources)
9+
10+
## Format
11+
12+
The `TEE` source has the following format:
13+
14+
```rust
15+
// TBD...
16+
```
17+
18+
Where:
19+
20+
- TODO
21+
22+
And they can be specified in the manifest of your binary crate like so:
23+
24+
```toml
25+
[package.metadata.blueprint]
26+
sources = [
27+
{ type = "TEE", ... },
28+
]
29+
```
30+
31+
[dstack]: https://github.com/Dstack-TEE/dstack
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Testing Source
2+
3+
The `Testing` source is a special, automatically generated source that was historically used by the [Blueprint Manager]
4+
during integration tests. It has since been replaced with the [test harnesses](/developers/testing/introduction).
5+
6+
## Format
7+
8+
The `Testing` source has the following format:
9+
10+
```rust
11+
pub struct TestingSource {
12+
pub cargo_package: String,
13+
pub cargo_bin: String,
14+
pub base_path: String,
15+
}
16+
```
17+
18+
Where:
19+
20+
- `cargo_package` - The Cargo package name of the binary (e.g., `my-blueprint-bin`)
21+
- `cargo_bin` - The name of the built binary file (e.g., `my-blueprint-bin`)
22+
- `base_path` - The base path of the binary crate (e.g., `/home/user/my-blueprint/bin`)
23+
24+
And they can be specified in the manifest of your binary crate like so:
25+
26+
```toml
27+
[package.metadata.blueprint]
28+
sources = [
29+
{ type = "Testing", cargo_package = "some-package-name", cargo_bin = "some-binary", base_path = "/home/user/some-blueprint/bin" }
30+
]
31+
```
32+
33+
## Output
34+
35+
After building your blueprint, you'll notice something like the following in your `blueprint.json`:
36+
37+
```json
38+
{
39+
// ...
40+
"sources": [
41+
{
42+
"type": "Testing",
43+
"cargo_package": "my-blueprint-bin",
44+
"cargo_bin": "my-blueprint-bin",
45+
"base_path": "/home/user/my-blueprint/bin"
46+
}
47+
],
48+
}
49+
```
50+
51+
It can safely be ignored (or deleted if you prefer).
52+
53+
[Blueprint Manager]: /operators/manager/introduction

0 commit comments

Comments
 (0)