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
{{ message }}
This repository was archived by the owner on Feb 26, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: docs/proplet.md
+65-6Lines changed: 65 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,70 @@
1
1
# Proplet
2
2
3
+
The `proplet` is a worker that executes WebAssembly functions. It can be configured to use either the embedded `wazero` runtime or an external WebAssembly runtime on the host system.
4
+
5
+
## Configuration
6
+
7
+
The `proplet` is configured using environment variables.
|`PROPLET_INSTANCE_ID`| A unique ID for this proplet instance. | A new UUID |
13
+
|`PROPLET_MQTT_ADDRESS`| The address of the MQTT broker. |`tcp://localhost:1883`|
14
+
|`PROPLET_MQTT_TIMEOUT`| The timeout for MQTT operations. |`30s`|
15
+
|`PROPLET_MQTT_QOS`| The Quality of Service level for MQTT messages. |`2`|
16
+
|`PROPLET_LIVELINESS_INTERVAL`| The interval at which the proplet sends liveliness messages. |`10s`|
17
+
|`PROPLET_DOMAIN_ID`| The domain ID for this proplet. ||
18
+
|`PROPLET_CHANNEL_ID`| The channel ID for this proplet. ||
19
+
|`PROPLET_CLIENT_ID`| The client ID for MQTT authentication. ||
20
+
|`PROPLET_CLIENT_KEY`| The client key for MQTT authentication. ||
21
+
|`PROPLET_EXTERNAL_WASM_RUNTIME`| The path to an external WebAssembly runtime. If not set, the embedded `wazero` runtime will be used. |`""` (empty string) |
22
+
23
+
## Usage
24
+
25
+
### Using the Embedded `wazero` Runtime
26
+
27
+
By default, `proplet` uses the embedded `wazero` runtime. To run it, simply set the required environment variables and start the application:
28
+
29
+
```bash
30
+
export PROPLET_DOMAIN_ID="your_domain_id"
31
+
export PROPLET_CHANNEL_ID="your_channel_id"
32
+
export PROPLET_CLIENT_ID="your_client_id"
33
+
export PROPLET_CLIENT_KEY="your_client_key"
34
+
propeller-proplet
35
+
```
36
+
37
+
### Using a Host WebAssembly Runtime
38
+
39
+
To use an external WebAssembly runtime (e.g., `wasmtime`, `wasmer`), set the `PROPLET_EXTERNAL_WASM_RUNTIME` environment variable to the path of the runtime executable.
You will also need to provide cli arguments to the task so that the runtime can be started. For example, to run the `addition` example with `wasmtime`:
Hence the cli aguments are `--invoke` and `add` and the path to the wasm file. The task will then be created as follows:
59
+
60
+
```json
61
+
{
62
+
"name": "add",
63
+
"cli_args": ["--invoke", "add"],
64
+
"inputs": [10, 20]
65
+
}
66
+
```
67
+
3
68
## **Proplet Command Handling**
4
69
5
70
### **Start Command Flow**
@@ -43,8 +108,6 @@ The `StartApp` function in `runtime.go` handles the instantiation and execution
43
108
44
109
A success message is logged if the application starts successfully, while detailed errors are logged if any step in the process (e.g., chunk assembly, instantiation, or execution) fails.
45
110
46
-
---
47
-
48
111
### **Stop Command Flow**
49
112
50
113
The stop command is sent by the Manager to the Proplet on the topic `m/:domain_id/c/:channel_id/control/manager/stop`
@@ -72,8 +135,6 @@ The `StopApp` function in `runtime.go` stops and cleans up a running Wasm module
72
135
73
136
A success message is logged with the text `"App '<AppName>' stopped successfully."` if the application stops successfully. If the application is not running or an error occurs during the stop operation, detailed error information is logged.
74
137
75
-
---
76
-
77
138
The Manager knows which Proplet is on which channel through the following mechanisms:
78
139
79
140
1.**Startup Notification (`create` topic):**
@@ -125,8 +186,6 @@ The Manager knows which Proplet is on which channel through the following mechan
125
186
126
187
These mechanisms ensure that the Manager is always aware of the active Proplets and their corresponding channels. The Manager can utilize this data to send specific control commands or monitor the Proplets effectively.
0 commit comments