You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/create-your-own-topo-templates/_index.md
+5-9Lines changed: 5 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,23 @@
1
1
---
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
7
3
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.
9
5
10
6
minutes_to_complete: 30
11
7
12
8
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.
13
9
14
10
learning_objectives:
15
11
- 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
18
13
- Create a new Topo Template from a Docker Compose project
19
14
- 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
20
16
21
17
prerequisites:
22
18
- This learning path builds on [Deploy containerized workloads to Arm-based Linux targets with Topo](/learning-paths/cross-platform/deploy-containerized-workloads-with-topo/).
23
19
- 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
25
21
- Docker installed on the host and target. For installation steps, see [Install Docker](/install-guides/docker/).
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):
Copy file name to clipboardExpand all lines: content/learning-paths/cross-platform/create-your-own-topo-templates/creating-a-new-template.md
+40-29Lines changed: 40 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,8 @@ The Template you create serves a small web page with configurable text and color
22
22
Create a new directory for the Template:
23
23
24
24
```bash
25
-
mkdir topo-message-card
26
-
cd topo-message-card
25
+
mkdir -p ~/topo-message-card
26
+
cd~/topo-message-card
27
27
```
28
28
29
29
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:
@@ -62,7 +62,7 @@ Create the application HTML file:
62
62
63
63
main {
64
64
width: min(720px, calc(100vw-40px));
65
-
border-top: 8pxsolid{{ACCENT_COLOR}};
65
+
border-top: 8pxsolid__ACCENT_COLOR__;
66
66
background: white;
67
67
padding: 40px;
68
68
box-shadow: 018px40pxrgba(15, 23, 42, 0.12);
@@ -82,14 +82,14 @@ Create the application HTML file:
82
82
</head>
83
83
<body>
84
84
<main>
85
-
<h1>{{CARD_TITLE}}</h1>
86
-
<p>{{CARD_MESSAGE}}</p>
85
+
<h1>__CARD_TITLE__</h1>
86
+
<p>__CARD_MESSAGE__</p>
87
87
</main>
88
88
</body>
89
89
</html>
90
90
```
91
91
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.
93
93
94
94
### Create the Dockerfile
95
95
@@ -104,9 +104,9 @@ ARG CARD_TITLE="Hello from Topo"
104
104
ARG CARD_MESSAGE="This page was created from a Topo Template."
105
105
ARG ACCENT_COLOR="#0091bd"
106
106
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
110
110
```
111
111
112
112
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:
136
136
message, and accent color.
137
137
type: "application"
138
138
deploy_success_message: |
139
-
Message Card is running. Open http://localhost:8088/ in your browser.
139
+
Message Card is running on port 8088.
140
140
args:
141
141
CARD_TITLE:
142
142
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.
170
170
171
171
### Clone the local Template
172
172
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).
The `build.args` values should contain the values you provided:
195
+
The `build.args` should contain the values you provided:
197
196
198
197
```yaml
199
198
services:
@@ -209,25 +208,33 @@ services:
209
208
210
209
### Deploy the new project
211
210
212
-
Deploy the cloned project to the host machine:
211
+
Deploy the cloned project to your target:
213
212
214
213
```bash
215
-
topo deploy --target localhost
214
+
topo deploy --target user@my-target
216
215
```
217
216
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
+

219
226
220
227
Confirm that the container is running:
221
228
222
229
```bash
223
-
topo ps --target localhost
230
+
topo ps --target user@my-target
224
231
```
225
232
226
233
The output should include the `message-card` service and port `8088`.
227
234
228
-
### Add hardware requirements
235
+
### Adding hardware requirements
229
236
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:
231
238
232
239
```yaml
233
240
x-topo:
@@ -257,4 +264,8 @@ If the Template is intended to be reusable by the wider Topo community, include:
257
264
- A license file
258
265
- Clear `x-topo` metadata and argument descriptions
259
266
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.
title: Clone Topo Hello World, deploy and modify it
2
+
title: Deploy the Topo 'Hello World' Template
3
3
weight: 3
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
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.
10
10
11
-
### List Topo Templates
11
+
##Clone the 'Hello World' Topo Template
12
12
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.
14
14
15
15
```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
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:
76
55
77
56
```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
80
58
```
81
59
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`.
83
61
84
-
```output
85
-
aarch64
86
-
```
87
-
88
-
### Deploy the template to localhost
62
+
## Deploy the template to your target
89
63
90
-
You can now deploy the project to the host/build machine:
64
+
You can now deploy the project to your target:
91
65
92
66
```bash
93
-
cd topo-welcome
94
-
topo deploy --target localhost
67
+
cd~/topo-welcome
68
+
topo deploy --target user@my-target
95
69
```
96
70
97
71
Wait for the build and deploy to complete. The expected output is similar to:
98
72
99
73
```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.
@@ -128,22 +99,37 @@ Run `topo ps` to see deployed containers 0.2s
128
99
Confirm that the container is running correctly:
129
100
130
101
```bash
131
-
topo ps
102
+
topo ps --target user@my-target
132
103
```
133
104
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:
135
106
136
107
```output
137
108
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
139
110
```
140
111
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
+
141
119
### Visualize the application
142
120
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.
144
130
145
131
146
132
The Hello World application appears as follows:
147
133
148
134
149
-

135
+

0 commit comments