Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Adds notes on Hermes packaging requirements #71

Merged
merged 49 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
fc046a0
chore(docs): stubs chapter for Hermes packaging documentation
saibatizoku Jan 25, 2024
758fd2d
Add some notes for reference
stevenj Jan 25, 2024
5e8d4e5
Add design notes
stevenj Jan 25, 2024
c33fb9c
Add some design notes
stevenj Jan 25, 2024
0a8dbba
feat: sketches for file and metadata in hdf5 terms
saibatizoku Jan 29, 2024
6f5ac46
chore: update docs
saibatizoku Jan 29, 2024
c244d1e
chore: cleanup markdown lints
saibatizoku Jan 29, 2024
4dec2a4
chore: tidy up md lints
saibatizoku Jan 30, 2024
7bf4236
docs: organize application.md and cleanup
saibatizoku Jan 31, 2024
2e4928b
docs: add section and diagrams for metadata
saibatizoku Feb 1, 2024
cb8a8d0
docs: update diagrams and cleanup
saibatizoku Feb 1, 2024
d28d377
docs: specify sections, add metadata information
saibatizoku Feb 1, 2024
a951ad9
docs: add section for app data and signatures
saibatizoku Feb 1, 2024
273a6bc
docs: reorganize overview.md subsections
saibatizoku Feb 1, 2024
d89494d
docs: add references to overview
saibatizoku Feb 1, 2024
3c8341c
chore(docs): stubs chapter for Hermes packaging documentation
saibatizoku Jan 25, 2024
97a4bf2
Add some notes for reference
stevenj Jan 25, 2024
905355c
Add design notes
stevenj Jan 25, 2024
81f5e16
Add some design notes
stevenj Jan 25, 2024
fae205e
feat: sketches for file and metadata in hdf5 terms
saibatizoku Jan 29, 2024
c7ccb35
chore: update docs
saibatizoku Jan 29, 2024
cb6cbe2
chore: cleanup markdown lints
saibatizoku Jan 29, 2024
1e79b24
chore: tidy up md lints
saibatizoku Jan 30, 2024
82a7b83
docs: organize application.md and cleanup
saibatizoku Jan 31, 2024
dcad834
docs: add section and diagrams for metadata
saibatizoku Feb 1, 2024
2778de1
docs: update diagrams and cleanup
saibatizoku Feb 1, 2024
f9c741a
docs: specify sections, add metadata information
saibatizoku Feb 1, 2024
a84553f
docs: add section for app data and signatures
saibatizoku Feb 1, 2024
21972ef
docs: reorganize overview.md subsections
saibatizoku Feb 1, 2024
fe5c1c7
docs: add references to overview
saibatizoku Feb 1, 2024
587ea94
docs: first draft of overview
saibatizoku Feb 8, 2024
2948729
docs: update diagrams and cleanup
saibatizoku Feb 8, 2024
2ac6ae2
fix: typo
saibatizoku Feb 8, 2024
0bb5d5b
Merge branch 'main' into feat/hermes-packaging-docs
stevenj Feb 22, 2024
48b15a5
Merge branch 'feat/hermes-packaging-docs' of github.com:input-output-…
stevenj Feb 23, 2024
20e21c1
docs(docs): Update docs to use latest cat-ci version
stevenj Feb 23, 2024
bbe3e17
docs(docs): WIP update of the packaging docs
stevenj Feb 27, 2024
f4fef69
docs(docs): Define the hermes app metadata
stevenj Feb 27, 2024
efd7657
chore(vscode): Add d2 extensions to vscode recommendations
stevenj Feb 28, 2024
db9a082
docs(hermes): Add hermes application metadata schema initial revision
stevenj Feb 28, 2024
70cbd5e
docs(hermes): small improvements to the app metadata json schema.
stevenj Feb 28, 2024
b6ac4b4
docs(docs): Include json schemas and examples in docs and fix up refe…
stevenj Feb 28, 2024
b130b03
docs(hermes): Add Application Package Manifest File schema and example.
stevenj Feb 29, 2024
e3b36ca
docs(hermes): Add manifest details to the app packaging docs
stevenj Feb 29, 2024
243d835
docs(hermes): Document how the http gateway works and how the files a…
stevenj Feb 29, 2024
a28c754
docs(hermes): Add WASM module json schemas and examples
stevenj Mar 1, 2024
2af9f46
docs(hermes): Completed first draft of the Application packaging docs
stevenj Mar 1, 2024
996f5aa
docs(hermes): Fix markdown and spelling checks
stevenj Mar 1, 2024
34ff567
Merge branch 'main' into feat/hermes-packaging-docs
stevenj Mar 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 11 additions & 4 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ asyncio
auditability
backpressure
bindgen
blockdiag
blockfetch
bmac
BROTLI
cardano
cbor
Expand All @@ -19,6 +21,7 @@ coti
crontabs
cryptoxide
dbsync
dcbor
delegators
dockerhub
dotenv
Expand All @@ -35,6 +38,7 @@ fdatasync
fdstat
Filesize
filestat
filestorage
filesystems
fmtchk
fmtfix
Expand All @@ -46,7 +50,10 @@ futimens
genhtml
GETFL
gmtime
happ
hardano
hasher
hmod
ideascale
idents
IFMT
Expand Down Expand Up @@ -81,6 +88,7 @@ openat
opentelemetry
outlen
Outparam
parameterises
permissioned
permissionless
pg_isready
Expand All @@ -106,9 +114,11 @@ rustdoc
rustdocflags
rustflags
saibatizoku
sandboxed
Sched
seckey
slotno
smac
stevenj
symlinkat
tacho
Expand All @@ -120,6 +130,7 @@ timelike
toolsets
Traceback
txns
typenum
unlinkat
utimensat
vitss
Expand All @@ -132,7 +143,3 @@ webasm
webassembly
WORKDIR
yoroi
smac
bmac
typenum
hasher
3 changes: 2 additions & 1 deletion .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"ignores": [
".config/dictionaries/**",
"**/target/**",
"hermes/wasm/*/**"
"hermes/wasm/*/**",
"**/.dart_tool/**"
],
// Set standard config options in `/.markdownlint.jsonc`
"config": {
Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"bytecodealliance.wit-idl",
"foxundermoon.shell-format",
"dtsvet.vscode-wasm",
"terrastruct.d2",
]
}
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
"*.excalidraw",
".vscode/**",
"**/.idea/**",
"hermes/crates/cardano-chain-follower/examples/snapshot_data"
"hermes/crates/cardano-chain-follower/examples/snapshot_data",
"**/.dart_tool/**"
]
}
9 changes: 6 additions & 3 deletions docs/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@ VERSION 0.7
# Copy all the source we need to build the docs
src:
# Common src setup
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.7.0+SRC
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.9.4+SRC

# Now copy into that any artifacts we pull from the builds.
COPY --dir ../+repo-docs/repo /docs/includes
# copy Rust docs
COPY ./../hermes+build/doc /docs/src/api/rust-docs
# Copy the WASM Component model API Docs
COPY --dir ./../wasm/wasi+build/wasi-hermes-docs /docs/src/api/wasi-hermes
# Copy the Hermes JSON Schemas and Examples
COPY --dir ./../hermes+json-schemas/schemas /docs/includes/


# Build the docs here.
docs:
FROM +src

DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.7.0+BUILD
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.9.4+BUILD

# Make a locally runable container that can serve the docs.
local:
# Build a self contained service to show built docs locally.
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.7.0+PACKAGE
DO github.com/input-output-hk/catalyst-ci/earthly/docs:v2.9.4+PACKAGE

# Copy the static pages into the container
COPY +docs/ /usr/share/nginx/html
Expand Down
3 changes: 3 additions & 0 deletions docs/src/architecture/08_concepts/.pages
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
title: Cross Cutting Concepts
arrange:
- hermes_runtime_engine
- hermes_packaging_requirements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: Hermes Application Packaging Requirements
arrange:
- overview.md
- app_package.md
- app_metadata.md
- app_srv_www.md
- app_data.md
- wasm_modules.md
- app_signatures.md
- app_loading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Hermes Application Data

Applications can contain read-only shared embedded data.

This data is shared between all WASM Component Modules within the application.

The data can be used for any purpose defined by the Application and is stored in `/srv/share`.

*Note: Even though the data is "shared" it is not available to any other application running inside a Hermes node.*
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# The Application Loading Process

The high level steps of the app loading process are:

![Diagram](images/app_loading_overview.d2)

## Loading/Creating the App RW HDF5 Filesystem

All Applications will need a RW Filesystem, even if its just for Hermes to store data about the application.
The Process of loading the application is actually the process of creating or validating the RW Filesystem.

Initially the Applications RW HDF5 Filesystem looks like this:

<!-- markdownlint-disable max-one-sentence-per-line line-length no-inline-html -->
| Name | Type | Description | Writable | Required |
| --- | ----------- | ---- | -------- | --- |
| `/` | :octicons-file-directory-fill-16: | Root Directory | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: green;">:octicons-check-circle-fill-12:</span> |
| `/tmp` | :octicons-file-directory-16: | Temporary Files stored in memory | <span style="color: green;">:octicons-check-circle-fill-12:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/etc` | :octicons-file-directory-fill-16: | Writable settings | <span style="color: green;">:octicons-check-circle-fill-12:</span> | <span style="color: green;">:octicons-check-circle-fill-12:</span> |
<!-- markdownlint-enable max-one-sentence-per-line line-length no-inline-html -->

The Application is at this stage un-configured.
Once the user has configured the Application,
the following files are created in the Application RW Storage and loading can continue.

<!-- markdownlint-disable max-one-sentence-per-line line-length no-inline-html -->
| Name | Type | Description | Writable | Required |
| --- | ----------- | ---- | -------- | --- |
| `/etc/settings.json` | :octicons-file-16: | Hermes Engine settings for this application. | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/etc/<module-name>/settings.json` | :octicons-file-16: | Module specific</br>Runtime Configurable Settings | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
<!-- markdownlint-enable max-one-sentence-per-line line-length no-inline-html -->

If the Application has requested RW storage, then it is created (and sized accordingly) at:

<!-- markdownlint-disable max-one-sentence-per-line line-length no-inline-html -->
| Name | Type | Description | Writable | Required |
| --- | ----------- | ---- | -------- | --- |
| `/var/` | :octicons-file-directory-fill-16: | Contains variable data files. (Persistent) | <span style="color: green;">:octicons-check-circle-fill-12:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
<!-- markdownlint-enable max-one-sentence-per-line line-length no-inline-html -->

## Loading the Application itself

At this stage, the RW Filesystem is now prepared.

HDF5 allows us to create symbolic links between different HDF5 files.
We use this capability to create RO symbolic links between the RW filesystem and the Application HDF5 package.

During this process, any files which are defined in `/usr/lib` which would over-ride the
contents of a module are linked inside the module, rather than the original module contents.

This allows us the re-create the view the application sees of itself, without editing the actual application at-all.

During this process symbolic RO links are created for the following files within the Application package:

<!-- markdownlint-disable max-one-sentence-per-line line-length no-inline-html -->
| Name | Type | Description | Writable | Required |
| --- | ----------- | ---- | -------- | --- |
| `/srv` | :octicons-file-directory-fill-16: | Data which is served by this system. | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/srv/www` | :octicons-file-directory-fill-16: | Files automatically served for this application on HTTP. | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/srv/share` | :octicons-file-directory-fill-16: | Data files which are not automatically served but can be shared by all Wasm Modules in the application. | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/usr` | :octicons-file-directory-fill-16: | Shareable, read-only data. | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/usr/lib` | :octicons-file-directory-fill-16: | Application over-rides for webasm library modules. | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/usr/lib/<module-name>` | :octicons-file-directory-fill-16: | Application over-rides for named webasm library module. | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/usr/lib/<module-name>/config.json` | :octicons-file-16: | Config to use for the module instead of its bundled config. | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/usr/lib/<module-name>/share` | :octicons-file-directory-fill-16: | Overrides for a modules shareable readonly data | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/lib` | :octicons-file-directory-fill-16: | Wasm Component Module Library Directory | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: green;">:octicons-check-circle-fill-12:</span> |
| `/lib/<module-name>/metadata.json` | :octicons-file-16: | Modules Metadata | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: green;">:octicons-check-circle-fill-12:</span> |
| `/lib/<module-name>/module.wasm` | :octicons-file-binary-16: | Actual WASM Module | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: green;">:octicons-check-circle-fill-12:</span> |
| `/lib/<module-name>/config.schema.json` | :octicons-file-16: | Modules Fixed Configuration Schema | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/lib/<module-name>/config.json` | :octicons-file-16: | Modules Fixed Configuration (Must match the schema) | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/lib/<module-name>/settings.schema.json` | :octicons-file-16: | Modules User Settings Schema | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/lib/<module-name>/share` | :octicons-file-directory-fill-16: | Modules shareable readonly data | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
| `/lib/<module-name>/author.cose` | :octicons-file-badge-16: | Modules Author Signature | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: green;">:octicons-check-circle-fill-12:</span> |
| `/metadata.json` | :octicons-file-16: | Applications Metadata | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: green;">:octicons-check-circle-fill-12:</span> |
| `/author.cose` | :octicons-file-badge-16: | Application Author Signature | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: green;">:octicons-check-circle-fill-12:</span> |
| `/publisher.cose` | :octicons-file-badge-16: | Application Publisher Signature | <span style="color: orange;">:octicons-circle-16:</span> | <span style="color: orange;">:octicons-circle-16:</span> |
<!-- markdownlint-enable max-one-sentence-per-line line-length no-inline-html -->

## Mounting the `/srv/www` filesystem in the HTTP gateway

At this stage the Applications `/srv/www` from the RW Filesystem (as linked to the application package itself)
is registered with the HTTP gateway inside the hermes node, and it can begin serving those files.

## Loading and Initializing the WASM Modules

The final step is to iterate all the WASM Modules in the RW Filesystem (as linked to the App) and load them
in canonical order into the WASM Executor.

This needs to be the final step because when a WASM Module is first loaded, it may be initialized.
That process may require access to any of the data or configuration stored within the Application.
It is only safe to access that data when the entire RW Filesystem and its cross linked
application resources are ready to be accessed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Application Metadata

Metadata for Hermes Applications is specified as a `metadata.json` file located in the root group
in the HDF5 File.
It is a `json` document and must conform to the Application metadata json schema to be valid.

## Application Metadata Contents

The Application Metadata is formally defined by [`hermes_app_metadata.schema.json`](#metadata-schema).

All Application metadata files MUST conform to that schema, or the Application will be considered invalid.

### Diagram: Hermes Application Metadata

![Diagram](images/application_metadata.d2)

*Note: Diagram is illustrative of metadata contents only.
See [`hermes_app_metadata.schema.json`](#metadata-schema) for the formal definition.*

### Application identifying Data

* Application Name : Single Line name of the application.
* Icon
* Version
* Description - Short Description of the Application
* About - Long form Description of the Application
* Copyright - Copyright Notices
* License - SPDX Strings and/or a Link to a License held within the app image.

### Application Developer/Author

* Developers Name
* Optional contact information
* Optional payment address

### Resources

Each application will need a minimum set of resources from Hermes.
The Metadata also lists the minimum viable resources required for the application.
It should also list what are the resources the Application would like to have available.
It can optionally list the maximum allocatable resources which could enable enhanced features or other functions in the application.

If a resource minimum is set as 0, then it means the resource can be denied by the user but the application can still operate.

### Permissions

When Hermes has permissioned resources, the metadata will list the permissions being requested by the application.

## Configuration

Other than resourcing and permissions, the `metadata.json` file does not contain the configuration of the application.
Application configuration is defined by the WASM Component modules.

## Metadata Schema

<!-- markdownlint-disable max-one-sentence-per-line -->

??? note "Schema: `hermes_app_metadata.schema.json`"

```json
{{ include_file('includes/schemas/hermes_app_metadata.schema.json', indent=4) }}
```

## Metadata Example

??? note "Example: `hermes_app_metadata.json`"

```json
{{ include_file('includes/schemas/example/hermes_app_metadata.json', indent=4) }}
```
<!-- markdownlint-enable max-one-sentence-per-line -->