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-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,27 @@
1
1
---
2
-
title: Create your own Topo Templates
2
+
title: Create and deploy a custom Topo Template
3
3
4
4
draft: true
5
5
cascade:
6
6
draft: true
7
7
8
-
description: Create a Topo Template after your project to use Topo to deploy containerized workloads to Arm-based Linux targets over SSH.
8
+
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
9
10
10
minutes_to_complete: 30
11
11
12
12
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
13
14
14
learning_objectives:
15
15
- 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
16
+
- Clone and deploy an existing Topo Template and modify it by adding new clone-time arguments
18
17
- Create a new Topo Template from a Docker Compose project
19
18
- Add x-topo metadata for configurable arguments, deployment guidance, and hardware requirements
19
+
- Understand where to find Agent Skills, for use when creating or modifying Topo Templates
20
20
21
21
prerequisites:
22
22
- 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
23
- 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
24
+
- 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
25
- 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
+
These skills are optional authoring aids. The Template you created in this Learning Path works with Topo without them.
14
+
15
+
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.
16
+
17
+
At the time of writing, the [Topo Template Format Specification](https://github.com/arm/topo-template-format) provides the following skills:
18
+
19
+
1.`topo-template-context`: provides Topo and Topo Template reference context for questions about x-topo metadata, schema, docs, and CLI Template behavior.
20
+
2.`topo-template-bootstrap`: converts a repository into a Topo Template by adding or improving `compose.yaml` and `x-topo` metadata.
21
+
3.`topo-template-lint`: reviews an existing Topo Template for correctness, consistency, and authoring best practices.
22
+
23
+
## Install the skills
24
+
25
+
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
+50-29Lines changed: 50 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,13 +104,15 @@ 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.
113
113
114
+
`sed` is a command-line text replacement tool. The `sed` commands replace placeholder text in `index.html` during the image build, so each cloned project can customize the web page without manually editing the source file.
115
+
114
116
### Create the compose file
115
117
116
118
Create `compose.yaml`:
@@ -136,7 +138,7 @@ x-topo:
136
138
message, and accent color.
137
139
type: "application"
138
140
deploy_success_message: |
139
-
Message Card is running. Open http://localhost:8088/ in your browser.
141
+
Message Card is running on port 8088.
140
142
args:
141
143
CARD_TITLE:
142
144
description: "The title to show on the message card"
@@ -168,32 +170,33 @@ The `x-topo` section is the Topo metadata block:
168
170
169
171
The argument names in `x-topo.args` match the keys under `services.message-card.build.args`. When Topo resolves the arguments, it writes the selected values into the build arguments.
170
172
173
+
The same argument name appears in three places: `x-topo.args`defines what Topo asks for, `build.args` passes the value to Docker, and the Dockerfile `ARG` consumes it.
174
+
171
175
### Clone the local Template
172
176
173
-
Move to the parent directory and clone your local Template with Topo:
177
+
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:
199
+
The `build.args` should contain the values you provided:
197
200
198
201
```yaml
199
202
services:
@@ -209,25 +212,39 @@ services:
209
212
210
213
### Deploy the new project
211
214
212
-
Deploy the cloned project to the host machine:
215
+
Check that your target is ready:
216
+
217
+
```bash
218
+
topo health --target user@my-target
219
+
```
220
+
221
+
Deploy the cloned project to your target:
222
+
223
+
```bash
224
+
topo deploy --target user@my-target
225
+
```
226
+
227
+
When deployment completes, open `http://<target-ip-address>:8088/` in your browser. You can also forward the port over SSH:
213
228
214
229
```bash
215
-
topo deploy --target localhost
230
+
ssh -L 8088:localhost:8088 user@my-target
216
231
```
217
232
218
-
When deployment completes, open `http://localhost:8088/` in your browser.
233
+
Then open `http://localhost:8088/` in your browser.
234
+
235
+

219
236
220
237
Confirm that the container is running:
221
238
222
239
```bash
223
-
topo ps --target localhost
240
+
topo ps --target user@my-target
224
241
```
225
242
226
243
The output should include the `message-card` service and port `8088`.
227
244
228
-
### Add hardware requirements
245
+
### Adding hardware requirements
229
246
230
-
Only add `features` when your Template needs specific Arm hardware features. For example, a SIMD benchmark that requires SVE can declare:
247
+
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
248
232
249
```yaml
233
250
x-topo:
@@ -257,4 +274,8 @@ If the Template is intended to be reusable by the wider Topo community, include:
257
274
- A license file
258
275
- Clear `x-topo` metadata and argument descriptions
259
276
260
-
You now have a complete Topo Template created from scratch.
277
+
## What you've accomplished and what's next
278
+
279
+
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.
280
+
281
+
Next, you will learn where to find Agent Skills that can help you create, modify, and review Topo Templates.
0 commit comments