Build the WASM tools with this command:
wasm-pack build --target webBefore doing this, you may have to install rust and cargo (either via rustup or your distro packages), and you have to do:
cargo install wasm-packLocal testing can be done with the simple-http-server tool, like this:
simple-http-server -p 8008 --nocache --cors .It can also be installed with cargo install.
Note that you have to rebuild the wasm pack every time you change the Rust code, for the changes to take effect on the web page.
The index.html file, main.css file, and the pkg/ subdirectory need to be installed at the web server. You may also deploy extra scripts next to index.html (see below). The page runs without any other server support.
You can deploy a file config.yaml to set the “title” and “description” of the page.
You can deploy a file local.css to add CSS rules to the page.
Tagging a commit with combustion-x.y.z (numeric x, y, and z) and pushing the tag to github will trigger a deployment to our github pages for the repo. This is controlled by .github/workflows/release.yml
In the deployed directory, next to the index.html file, edit the file config.yaml and add a “scripts” key that defines an array of dicts with keys:
- “name” (the option name presented to the user)
- “filename” (a script file under scripts/)
- an optional “tag” (a short text added to the image filename)
- an optional “preload: true” if the script should be run before the standard combustion activities (i.e. setting the root ssh keys).
- an optional “variables:” dict (defining template variables, see below)
The script files will be executed in lexical order, so adding a numeric prefix will order their execution. The preload and non-preload scripts have separate namespaces for this.
The scripts can contain template variables in the form {{VARNAME}} which will be substituted with values provided by the user of the webpage. This is configured in the “variables:” section of the script yaml, which contains an array of dicts. Each dict has these keys:
- “name:” (the name of the variable in the script, must be alphanumeric + underscore)
- “label:” (the user-facing label for this variable in the input form)
- “help:” (help text provided to the user for this variable)
- “optional: true” (if the user can omit the value for this variable)
Any variable in the script that is not defined in the yaml or not provided by the user will be deleted from the script, so that the {{VARNAME}} string disappears. The script can check for this by testing if “{{VARNAME}}” is the empty string.
title: Aardsoft Combustion Image Generation
description: Generate your combustion images here.
scripts:
- name: Some script
filename: 30-some-script.sh
tag: some
preload: true
- name: Other script
filename: 50-other-script.sh
variables:
- name: STATIC_IP
label: "Static IP"
help: "The IP address to use for this container."