88 lines
3.6 KiB
Markdown
88 lines
3.6 KiB
Markdown
<!--
|
|
Copyright (c) 2023, Kry10 Limited. All rights reserved.
|
|
|
|
SPDX-License-Identifier: LicenseRef-Kry10
|
|
-->
|
|
|
|
# Admin Example
|
|
|
|
The admin example demonstrates a minimal system that runs the admin component on KOS. The admin
|
|
component is an Elixir app that coordinates on-device administration activities, such as system restart and upgrade.
|
|
The admin component also acts as a client to a Kry10 Server.
|
|
|
|
The admin example is entirely implemented by using the KOS Poukai manifest layer, requiring
|
|
no further augmentations. In particular, the KOS Poukai apps present in this system are:
|
|
|
|
- `admin_ex`: an Erlang BEAM VM running an Elixir app that coordinates
|
|
admin activities (such as restart and upgrade) and acts as a client to a
|
|
Kry10 Server.
|
|
- `key_store`: server that provides a way to store secrets (e.g private keys) that
|
|
applications can request at runtime.
|
|
- `ethernet`: contains an ethernet driver and implements the `ethernet` protocol
|
|
to provide ethernet access to other apps on the device.
|
|
- `tunnel`: a secure tunnel to a host machine (typically be managed by the
|
|
Studio or Fleet Server).
|
|
- `rng_server`: a CSPRNG server, providing an interface that allows applications to request
|
|
arbitrary length streams of random bytes.
|
|
- `log_server`: a system-wide logging service. The server provides an interface for
|
|
applications to emit semi-structured log strings with an associated log
|
|
level i.e. `INFO`, `WARN`, `ERROR` etc.
|
|
- `self_test`: an app that performs a series of tests on startup.
|
|
|
|
This system demonstrates a good project starting point that can then be further modified as needed.
|
|
|
|
### Build Instructions
|
|
|
|
Launch a KOS development shell for the target platform:
|
|
|
|
```console
|
|
$ kos-tool env -p <am335x|qemu-arm-virt|imx8mm-evk|portenta-x8|rpi4>
|
|
```
|
|
|
|
Checkout the admin example sources:
|
|
|
|
```console
|
|
$ mix kos.docs.example admin_example
|
|
$ cd admin_example
|
|
```
|
|
|
|
Build the admin example system:
|
|
|
|
```console
|
|
$ mix kos.build
|
|
```
|
|
|
|
Proceed to run the system using the Mix `kos.run` utility:
|
|
|
|
```console
|
|
$ kos-run
|
|
```
|
|
|
|
|
|
You will see the admin component start up with output similar to the following:
|
|
```
|
|
| 0.693| Poukai.admin |
|
|
| 0.693| Poukai.admin | ---- Poukai.admin ----
|
|
| 0.732| Poukai.admin | beam tunnel connection established:
|
|
| 0.732| Poukai.admin | IP addr: 192.168.2.6
|
|
| 0.733| Poukai.admin | Netmask: 255.255.255.0
|
|
| 0.733| Poukai.admin | Gateway: 192.168.2.100
|
|
| 2.931| Poukai.admin |
|
|
| 2.931| Poukai.admin | 08:21:57.837 [info] Starting connection with the Kry10 server on ws://192.168.2.100:4000/cnc
|
|
| 2.952| Poukai.admin |
|
|
| 2.952| Poukai.admin | 08:21:57.870 [info] starting KosSel4 server
|
|
| 2.962| Poukai.admin |
|
|
| 2.962| Poukai.admin | 08:21:57.879 [info] starting KosMsg server
|
|
| 2.993| Poukai.admin |
|
|
| 2.993| Poukai.admin | 08:21:57.909 [warning] Can't start KosTrace. Reason: Tracing Unavailable.
|
|
| 2.995| Poukai.admin |
|
|
| 2.995| Poukai.admin | 08:21:57.910 [info] Starting KosChannels server
|
|
| 3.026| Poukai.admin |
|
|
| 3.026| Poukai.admin | 08:21:57.941 [info] admin_ex's public key: 5paBAr9Cv+h6mZxus78c4BxBgIfyFLAdudrPn6xwR+Q=
|
|
| 3.033| Poukai.admin |
|
|
| 3.033| Poukai.admin | 08:21:57.950 [info] Starting SerialStream server
|
|
| 3.033| Poukai.admin | 08:23:21.065 [info] Connection has been lost. Reason: {:error, :timeout}. Attempting to reconnect
|
|
```
|
|
|
|
Follow the [Connecting a device to a Kry10 Server](server_connect_device) guide to connect it to a server so that you can interact
|
|
with the example through your browser. |