Skip to content
This repository was archived by the owner on Feb 12, 2021. It is now read-only.

Commit 1c6fce4

Browse files
committed
os: add user-docs on how to use custom torcx remotes and images
This adds a walk-through and CLC snippets on how to configure custom remotes and use addons from there.
1 parent f6787b7 commit 1c6fce4

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

Diff for: os/torcx-using-custom-remotes.md

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Using custom Torcx remotes
2+
3+
## Remotes Overview
4+
5+
A Torcx [remote][torcx-remotes-design] is a collection of addon images for torcx, served from a remote source, which can be fetched by a node for use by [torcx-generator][torcx-overview].
6+
Images for configured addons can be retrieved automatically on first-boot provisioning (i.e. in initramfs) and when preparing for new OS updates (i.e. before marking a node as "reboot needed").
7+
8+
## Usage notes
9+
10+
Before starting to configure Torcx remotes, a word of caution on their usage.
11+
Torcx is not a full package manager, and trying to use it as such may result in unexpected behaviors.
12+
13+
In particular, there is no dependency resolution across addons, and images are supposed to be self-contained and re-built for each specific Container Linux version.
14+
15+
Provisioning images from remotes is coupled with both first-boot setup and OS upgrade mechanisms.
16+
Configuring an image not available on a remote can result in first-boot provisioning failures or in blocked upgrades.
17+
18+
All of the above behaviors are by-design restrictions in order to minimize possible breakages at runtime.
19+
20+
Unless it is strictly required for very specific usecases, it is usually reccommended not use custom Torcx addons and remotes.
21+
22+
## Provisioning a Torcx remote
23+
24+
Torcx remotes use a reverse-domain naming scheme, and can be configured on nodes during first-boot provisioning via a JSON manifest and an armored OpenPGP keyring.
25+
The local manifest describes where a Torcx remote is located and which public keys to use for metadata verification, according to the documented [schema][schema-remote-manifest].
26+
27+
A sample remote named `com.example.my-remote` signed by key `4C8413AA38176150A8906994BB1A3A854F3BBEBF` can be provisioned with the following [Container Linux Config][ct-configs] snippet:
28+
29+
```yaml container-linux-config
30+
storage:
31+
files:
32+
- path: /etc/torcx/remotes/com.example.my-remote/remote.json
33+
filesystem: root
34+
mode: 0640
35+
contents:
36+
inline: |
37+
{
38+
"kind": "remote-manifest-v0",
39+
"value": {
40+
"base_url": "https://torcx-remotes.example.com/my-remote/${COREOS_BOARD}/${VERSION_ID}/",
41+
"keys": [
42+
{ "armored_keyring": "4C8413AA38176150A8906994BB1A3A854F3BBEBF.pgp.asc" }
43+
]
44+
}
45+
}
46+
47+
- path: /etc/torcx/remotes/com.example.my-remote/4C8413AA38176150A8906994BB1A3A854F3BBEBF.pgp.asc
48+
filesystem: root
49+
mode: 0640
50+
contents:
51+
inline: |
52+
-----BEGIN PGP PUBLIC KEY BLOCK-----
53+
54+
mQINBFPOTCkBEADVqHsjLwgh9RrDln/oOS3MQgYnYhI72IpAiNhp9j+kdKWCrc7S
55+
[...]
56+
DQzFS07A45A=
57+
=dYyN
58+
-----END PGP PUBLIC KEY BLOCK-----
59+
```
60+
61+
The base URL for a remote is a templated string which is evaluated at runtime for simple variable substitution.
62+
Commonly used variables include:
63+
64+
* `${COREOS_BOARD}`: board type (e.g. "amd64-usr")
65+
* `${VERSION_ID}`: OS version (e.g. "1680.2.0")
66+
* `${ID}`: OS vendor ID (e.g. "coreos")
67+
68+
69+
## Enabling a Torcx addon from a remote
70+
71+
In order to use a Torcx addon from a remote, it must be configured in the active profile and it should reference the remote where it can be located.
72+
73+
After having configured the remote `com.example.my-remote`, provisioning an addon named `my-addon` at version `1` out of it can be done with the following configuration snippet:
74+
75+
```yaml container-linux-config
76+
storage:
77+
files:
78+
- path: /etc/torcx/profiles/my-profile.json
79+
filesystem: root
80+
mode: 0640
81+
contents:
82+
inline: |
83+
{
84+
"kind": "profile-manifest-v1",
85+
"value": {
86+
"images": [
87+
{
88+
"name": "my-addon",
89+
"reference": "1",
90+
"remote": "com.example.my-remote"
91+
}
92+
]
93+
}
94+
}
95+
96+
- path: /etc/torcx/next-profile
97+
filesystem: root
98+
mode: 0640
99+
contents:
100+
inline: "my-profile\n"
101+
```
102+
103+
Please note that a single user-profile can be active at any point, thus further customizations should be done directly against the profile manifest above.
104+
105+
## Behavior on updates
106+
107+
Whenever a new OS update is available and before applying it to the running node, [Update Engine][update_engine] checks and tries to provision all configured Torcx addons from remotes.
108+
109+
If it is not possible to provision any of the configured addons for the upcoming OS, the update will not applied and the process will be re-tried later.
110+
111+
This can happen if an addon is not anymore present on a remote, if the image matching the new OS version is not yet available, or in case of any other error when fetching from a remote.
112+
113+
In that case, errors will be logged to the system journal and can be inspected as follows:
114+
115+
```
116+
$ sudo journalctl -t coreos-postinst
117+
```
118+
119+
[torcx-remotes-design]: https://github.com/coreos/torcx/blob/v0.2.0/Documentation/design/remotes.md
120+
[torcx-overview]: torcx-overview.md
121+
[schema-remote-manifest]: https://github.com/coreos/torcx/blob/master/Documentation/schemas/remote-manifest-v0.md
122+
[ct-configs]: provisioning.md
123+
[update_engine]: https://github.com/coreos/update_engine

0 commit comments

Comments
 (0)