Skip to content

Commit 0195ae2

Browse files
committed
Topo template tech review
1 parent 8d7a85e commit 0195ae2

10 files changed

Lines changed: 180 additions & 124 deletions

File tree

content/learning-paths/cross-platform/create-your-own-topo-templates/_index.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
---
2-
title: Create your own Topo Templates
3-
4-
draft: true
5-
cascade:
6-
draft: true
2+
title: Create and deploy a custom Topo Template
73

8-
description: Create a Topo Template after your project to use Topo to deploy containerized workloads to Arm-based Linux targets over SSH.
4+
description: Understand how to create and modify Topo Templates, allowing you to deploy your projects as containerized workloads to Arm-based Linux targets over SSH.
95

106
minutes_to_complete: 30
117

128
who_is_this_for: This is an introductory topic for embedded, edge, and cloud software developers who want to create their own Topo Templates projects to be natively deployed with Topo.
139

1410
learning_objectives:
1511
- Explain the purpose and structure of a Topo Template
16-
- Clone and deploy an existing Topo Template to validate the Template workflow
17-
- Add clone-time arguments to customize a Topo Template
12+
- Clone and deploy an existing Topo Template and modify it by adding new clone-time arguments
1813
- Create a new Topo Template from a Docker Compose project
1914
- Add x-topo metadata for configurable arguments, deployment guidance, and hardware requirements
15+
- Understand where to find Agent Skills, for use when creating or modifying Topo Templates
2016

2117
prerequisites:
2218
- This learning path builds on [Deploy containerized workloads to Arm-based Linux targets with Topo](/learning-paths/cross-platform/deploy-containerized-workloads-with-topo/).
2319
- A host machine (x86 or Arm) with Linux, macOS, or Windows
24-
- (Optional) An Arm-based Linux target accessible over SSH, for example an Arm-based Linux VM, Raspberry Pi, DGX Spark, or NXP i.MX 93
20+
- An Arm-based Linux target accessible over SSH, for example an Arm-based Linux VM, Raspberry Pi, DGX Spark, or NXP i.MX 93
2521
- Docker installed on the host and target. For installation steps, see [Install Docker](/install-guides/docker/).
2622
- Basic familiarity with containers and CLI tools
2723

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Use agent skills for Topo Templates
3+
weight: 6
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Skills for authoring Templates
10+
11+
If you already have a Docker Compose project and want to convert it to a Topo Template, or you want to create your own Topo Template from scratch, you can do so with an Agent Skill.
12+
13+
Visit [Topo Skills](https://github.com/arm/topo-template-format#authoring-skills) for the most up-to-date list of the available Topo Template skills and instructions on how to install them.
14+
15+
At the time of writing, the [Topo Template Format Specification](https://github.com/arm/topo-template-format) provides the following skills:
16+
17+
1. `topo-template-context`: provides Topo and Topo Template reference context for questions about x-topo metadata, schema, docs, and CLI Template behavior.
18+
2. `topo-template-bootstrap`: converts a repository into a Topo Template by adding or improving `compose.yaml` and `x-topo` metadata.
19+
3. `topo-template-lint`: reviews an existing Topo Template for correctness, consistency, and authoring best practices.
20+
21+
## Install the skills
22+
23+
Install the Topo Template skills with [npx skills](https://github.com/vercel-labs/skills):
24+
25+
```bash
26+
npx skills add arm/topo-template-format --all --yes
27+
```
28+
29+
Restart your agent after installing or updating skills.
30+
31+
## Use the skills
32+
33+
You can then prompt your agent to use the skill to create a Topo Template from an existing project:
34+
35+
```text
36+
Use the topo-template-bootstrap skill to convert this repository into a Topo Template.
37+
```

content/learning-paths/cross-platform/create-your-own-topo-templates/creating-a-new-template.md

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ The Template you create serves a small web page with configurable text and color
2222
Create a new directory for the Template:
2323

2424
```bash
25-
mkdir topo-message-card
26-
cd topo-message-card
25+
mkdir -p ~/topo-message-card
26+
cd ~/topo-message-card
2727
```
2828

2929
A Topo Template is a normal project directory. At minimum, it must contain a `compose.yaml` file. Most Templates also include a `Dockerfile` and application source code.
@@ -48,7 +48,7 @@ Create the application HTML file:
4848
<head>
4949
<meta charset="utf-8">
5050
<meta name="viewport" content="width=device-width, initial-scale=1">
51-
<title>{{CARD_TITLE}}</title>
51+
<title>__CARD_TITLE__</title>
5252
<style>
5353
body {
5454
margin: 0;
@@ -62,7 +62,7 @@ Create the application HTML file:
6262
6363
main {
6464
width: min(720px, calc(100vw - 40px));
65-
border-top: 8px solid {{ACCENT_COLOR}};
65+
border-top: 8px solid __ACCENT_COLOR__;
6666
background: white;
6767
padding: 40px;
6868
box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
@@ -82,14 +82,14 @@ Create the application HTML file:
8282
</head>
8383
<body>
8484
<main>
85-
<h1>{{CARD_TITLE}}</h1>
86-
<p>{{CARD_MESSAGE}}</p>
85+
<h1>__CARD_TITLE__</h1>
86+
<p>__CARD_MESSAGE__</p>
8787
</main>
8888
</body>
8989
</html>
9090
```
9191

92-
The values wrapped in double braces are placeholders. The `Dockerfile` replaces them with values supplied by Topo.
92+
The values wrapped in double underscores are placeholders. The `Dockerfile` replaces them with values supplied by Topo.
9393

9494
### Create the Dockerfile
9595

@@ -104,9 +104,9 @@ ARG CARD_TITLE="Hello from Topo"
104104
ARG CARD_MESSAGE="This page was created from a Topo Template."
105105
ARG ACCENT_COLOR="#0091bd"
106106

107-
RUN sed -i "s|{{CARD_TITLE}}|${CARD_TITLE}|g" /usr/share/nginx/html/index.html
108-
RUN sed -i "s|{{CARD_MESSAGE}}|${CARD_MESSAGE}|g" /usr/share/nginx/html/index.html
109-
RUN sed -i "s|{{ACCENT_COLOR}}|${ACCENT_COLOR}|g" /usr/share/nginx/html/index.html
107+
RUN sed -i "s|__CARD_TITLE__|${CARD_TITLE}|g" /usr/share/nginx/html/index.html
108+
RUN sed -i "s|__CARD_MESSAGE__|${CARD_MESSAGE}|g" /usr/share/nginx/html/index.html
109+
RUN sed -i "s|__ACCENT_COLOR__|${ACCENT_COLOR}|g" /usr/share/nginx/html/index.html
110110
```
111111

112112
Topo passes configuration values to Templates through Docker build arguments. The `ARG` lines define the values consumed during the image build.
@@ -136,7 +136,7 @@ x-topo:
136136
message, and accent color.
137137
type: "application"
138138
deploy_success_message: |
139-
Message Card is running. Open http://localhost:8088/ in your browser.
139+
Message Card is running on port 8088.
140140
args:
141141
CARD_TITLE:
142142
description: "The title to show on the message card"
@@ -170,30 +170,29 @@ The argument names in `x-topo.args` match the keys under `services.message-card.
170170

171171
### Clone the local Template
172172

173-
Move to the parent directory and clone your local Template with Topo:
173+
Clone your local Template into a new project directory. You can choose to answer interactive prompts for the arguments (using the first command below), or you can opt to include the arguments in the command (using the second command).
174174

175+
Interactive argument prompts:
175176
```bash
176-
cd ..
177-
topo clone dir:./topo-message-card ./message-card-demo \
178-
CARD_TITLE="Hello from Arm" \
179-
CARD_MESSAGE="Created from a new Topo Template" \
180-
ACCENT_COLOR="#00a3a3"
177+
topo clone dir:$HOME/topo-message-card $HOME/message-card-demo
181178
```
182179

183-
You can also omit the argument values and answer the interactive prompts:
184-
180+
Arguments included in command:
185181
```bash
186-
topo clone dir:./topo-message-card ./message-card-demo
182+
topo clone dir:$HOME/topo-message-card $HOME/message-card-demo \
183+
CARD_TITLE="Hello from Arm" \
184+
CARD_MESSAGE="Created from a new Topo Template" \
185+
ACCENT_COLOR="#00a3a3"
187186
```
188187

189188
After cloning, inspect the generated project:
190189

191190
```bash
192-
cd message-card-demo
191+
cd ~/message-card-demo
193192
sed -n '1,80p' compose.yaml
194193
```
195194

196-
The `build.args` values should contain the values you provided:
195+
The `build.args` should contain the values you provided:
197196

198197
```yaml
199198
services:
@@ -209,25 +208,33 @@ services:
209208

210209
### Deploy the new project
211210

212-
Deploy the cloned project to the host machine:
211+
Deploy the cloned project to your target:
213212

214213
```bash
215-
topo deploy --target localhost
214+
topo deploy --target user@my-target
216215
```
217216

218-
When deployment completes, open `http://localhost:8088/` in your browser.
217+
When deployment completes, open `http://<target-ip-address>:8088/` in your browser. You can also forward the port over SSH:
218+
219+
```bash
220+
ssh -L 8088:localhost:8088 user@my-target
221+
```
222+
223+
Then open `http://localhost:8088/` in your browser.
224+
225+
![Screenshot of the new Topo Template - a simple web page. This confirms successful deployment and provides a visual reference for the expected result.#center](new_template.png "Hello from Arm web page")
219226

220227
Confirm that the container is running:
221228

222229
```bash
223-
topo ps --target localhost
230+
topo ps --target user@my-target
224231
```
225232

226233
The output should include the `message-card` service and port `8088`.
227234

228-
### Add hardware requirements
235+
### Adding hardware requirements
229236

230-
Only add `features` when your Template needs specific Arm hardware features. For example, a SIMD benchmark that requires SVE can declare:
237+
Only add `features` when your Template needs specific Arm hardware features. For example, a SIMD benchmark that requires SVE can declare that it needs SVE:
231238

232239
```yaml
233240
x-topo:
@@ -257,4 +264,8 @@ If the Template is intended to be reusable by the wider Topo community, include:
257264
- A license file
258265
- Clear `x-topo` metadata and argument descriptions
259266

260-
You now have a complete Topo Template created from scratch.
267+
## What you've accomplished and what's next
268+
269+
You have now created a complete Topo Template from scratch. You created the web page HTML, added a Compose file, described the Template with `x-topo` metadata, supplied clone-time arguments, and deployed the generated project to an Arm-based Linux target.
270+
271+
Next, you will learn where to find Agent Skills that can help you create, modify, and review Topo Templates.
Lines changed: 41 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,26 @@
11
---
2-
title: Clone Topo Hello World, deploy and modify it
2+
title: Deploy the Topo 'Hello World' Template
33
weight: 3
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## Clone and deploy the Hello World Template
9+
This section quickly runs through the deployment of the `Hello World` Template, similar to the LLM on CPU Template in the [Deploy containerized workloads to Arm-based Linux targets with Topo](/learning-paths/cross-platform/deploy-containerized-workloads-with-topo/) Learning Path.
1010

11-
### List Topo Templates
11+
## Clone the 'Hello World' Topo Template
1212

13-
List the available Topo Templates from the curated list in Topo:
13+
On your host machine, use the terminal to clone the template into your home directory.
1414

1515
```bash
16-
topo templates
17-
```
18-
19-
The output should be similar to the following, the Hello World Template should be present:
20-
21-
```output
22-
Hello World | https://github.com/Arm-Examples/topo-welcome.git | main
23-
A minimal "Hello, World" web app for validating a Topo setup and deployment.
24-
It runs a single service that exposes a web page on the target,
25-
with the greeting text customizable via the GREETING_NAME parameter.
26-
27-
Lightbulb Moment | https://github.com/Arm-Examples/topo-lightbulb-moment.git | main
28-
Features: remoteproc-runtime
29-
Reads a switch over GPIO pins on an M class cpu, reports switch state over
30-
Remoteproc Message, then a web application on the A class reads this and
31-
displays a lightbulb in either the on or off state. The lightbulb state is
32-
described by an LLM in any user-specified style.
33-
34-
(...)
35-
```
36-
37-
### Clone the Hello World Template
38-
39-
```bash
40-
topo clone https://github.com/Arm-Examples/topo-welcome.git
16+
topo clone https://github.com/Arm-Examples/topo-welcome.git ~/topo-welcome
4117
```
4218

4319
The output should be similar to the following. You will be prompted for configuration arguments:
4420

4521
```output
4622
┌─ Copy files ──────────────────────────────────────────
47-
Cloning into 'topo-welcome'...
23+
Cloning into '/home/user/topo-welcome'...
4824
remote: Enumerating objects: 12, done.
4925
remote: Counting objects: 100% (12/12), done.
5026
remote: Compressing objects: 100% (9/9), done.
@@ -58,48 +34,43 @@ Default: World
5834
GREETING_NAME (required)>
5935
```
6036

61-
You can fill the GREETING_NAME with your own name of press Enter to choose the defaults.
62-
You will then see something similar to the following output:
37+
Provide a name for the `GREETING_NAME` argument, e.g., 'Tomas'.
38+
39+
Press Enter to submit your entry. You will then see a similar output to below:
6340

6441
```output
6542
┌─ Project ready ───────────────────────────────────────
66-
Created in 'topo-welcome'
43+
Created in '/home/user/topo-welcome'
6744
6845
Now run:
69-
cd topo-welcome
46+
cd ~/topo-welcome
7047
topo deploy
7148
```
7249

73-
### Prepare the host machine for emulation
50+
## Prepare your target
7451

75-
Topo Templates are meant to be deployed to Arm-based Linux targets. In this learning path, we are going to be deploying to your host machine. If your machine is an x86 machine, you may need to install an arm64 emulator, such as:
52+
Topo Templates are meant to be deployed to Arm-based Linux targets. In this Learning Path, use the Arm-based Linux target you prepared in the previous Learning Path, for example a Raspberry Pi, AWS Arm instance, or other Linux target accessible over SSH.
53+
54+
Confirm that Topo can inspect your target, and that there are no compatibility issues:
7655

7756
```bash
78-
docker run --privileged --rm tonistiigi/binfmt --install arm64
79-
docker run --rm --platform linux/arm64 alpine uname -m
57+
topo health --target user@my-target
8058
```
8159

82-
The expected output should be:
60+
If your host machine is a Linux machine and you want to use it as the target, you can use `--target localhost`.
8361

84-
```output
85-
aarch64
86-
```
87-
88-
### Deploy the template to localhost
62+
## Deploy the template to your target
8963

90-
You can now deploy the project to the host/build machine:
64+
You can now deploy the project to your target:
9165

9266
```bash
93-
cd topo-welcome
94-
topo deploy --target localhost
67+
cd ~/topo-welcome
68+
topo deploy --target user@my-target
9569
```
9670

9771
Wait for the build and deploy to complete. The expected output is similar to:
9872

9973
```output
100-
$ topo deploy --target localhost
101-
10:52:52 WRN registry transfer is not yet supported with this configuration. Falling back to direct transfer.
102-
10374
┌─ Build images ────────────────────────────────────────
10475
[+] Building 6.4s (11/11) FINISHED
10576
=> [internal] load local bake definitions 0.0s
@@ -128,22 +99,37 @@ Run `topo ps` to see deployed containers 0.2s
12899
Confirm that the container is running correctly:
129100

130101
```bash
131-
topo ps
102+
topo ps --target user@my-target
132103
```
133104

134-
The output should be similar to:
105+
The `topo ps` command lists the services that Topo deployed to the target. The output should be similar to:
135106

136107
```output
137108
Image Status Processing Domain Address
138-
topo-welcome-app Up Less than a second Linux Host localhost:8000, [::]:8000
109+
topo-welcome-app Up 58 seconds Linux Host my-target:8000, [::]:8000
139110
```
140111

112+
The columns show:
113+
114+
- `Image`: the container image or service that Topo started
115+
- `Status`: whether the service is running, and how long it has been running
116+
- `Processing Domain`: where the workload is running, such as the Linux Host on the target
117+
- `Address`: the exposed address and port for the service
118+
141119
### Visualize the application
142120

143-
Open your browser on `http://localhost:8000/`, you should see the Hello World application running.
121+
If the target is reachable on your network, open `http://<target-ip-address>:8000/` in your browser.
122+
123+
If you prefer to forward the port over SSH, run:
124+
125+
```bash
126+
ssh -L 8000:localhost:8000 user@my-target
127+
```
128+
129+
Then open `http://localhost:8000/` in your browser.
144130

145131

146132
The Hello World application appears as follows:
147133

148134

149-
![Screenshot of the Hello World web interface running on localhost. This confirms successful deployment and provides a visual reference for the expected result.#center](topo_hello_world.png "Hello World web interface on localhost")
135+
![Screenshot of the Hello World web interface. This confirms successful deployment and provides a visual reference for the expected result.#center](hello_tomas.png "Hello World web interface")
41.5 KB
Loading

0 commit comments

Comments
 (0)