Skip to content

Commit b21a2f9

Browse files
authored
Update plugin information (#200)
* add faq page Signed-off-by: Mahfuza Humayra Mohona <[email protected]> * plugin Signed-off-by: Mahfuza Humayra Mohona <[email protected]> * update existing plugin Signed-off-by: Mahfuza Humayra Mohona <[email protected]> * add github link Signed-off-by: Mahfuza Humayra Mohona <[email protected]> * fix hyperlink Signed-off-by: Mahfuza Humayra Mohona <[email protected]> * fix hyperlink Signed-off-by: Mahfuza Humayra Mohona <[email protected]> --------- Signed-off-by: Mahfuza Humayra Mohona <[email protected]>
1 parent 699b992 commit b21a2f9

File tree

18 files changed

+430
-22
lines changed

18 files changed

+430
-22
lines changed

docs/contribute/source/plugin/ebpf.md

+98-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,101 @@ sidebar_position: 7
44

55
# Build with eBPF Plug-in
66

7-
<!-- prettier-ignore -->
8-
:::info
9-
Work in Progress
10-
:::
7+
The eBPF (extended Berkeley Packet Filter) plug-in provides an interface to execute eBPF programs in WasmEdge. It allows WasmEdge to execute eBPF code that is compiled into WebAssembly format. This guide will walk you through the steps to build WasmEdge with the eBPF plug-in.
8+
9+
## Build the eBPF Plug-in
10+
11+
### Prerequisites
12+
13+
Before building the eBPF plug-in, ensure that you have the following installed:
14+
15+
* WasmEdge - If you haven't installed it, follow the [follow the guide to build from source](../os/linux.md).
16+
* libbpf - This plug-in requires `libbpf >= 1.2`. See [Building libbpf](https://github.com/libbpf/libbpf#building-libbpf) for details.
17+
18+
### Build steps
19+
20+
To build the eBPF plug-in, run the following commands at the root of the WasmEdge project:
21+
22+
```bash
23+
cmake -DWASMEDGE_PLUGIN_WASM_BPF:BOOL=TRUE -B ./build -G "Unix Makefiles"
24+
cmake --build ./build
25+
```
26+
27+
Make sure to set `WASMEDGE_PLUGIN_WASM_BPF` to `TRUE` in the command line. This toggle controls the build of the `wasm_bpf` plug-in.
28+
29+
## Use the eBPF Plug-in
30+
31+
### Download Examples
32+
33+
You can download examples of wasm-bpf programs from here:
34+
35+
```bash
36+
wget https://eunomia-bpf.github.io/wasm-bpf/examples/runqlat/runqlat.wasm
37+
```
38+
39+
### Build Examples
40+
You can also build examples of wasm-bpf programs from the `wasm-bpf` repository:
41+
42+
1. Install the wasi-sdk if you don't have it:
43+
44+
```bash
45+
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-17/wasi-sdk-17.0-linux.tar.gz
46+
tar -zxf wasi-sdk-17.0-linux.tar.gz
47+
sudo mkdir -p /opt/wasi-sdk/ && sudo mv wasi-sdk-17.0/* /opt/wasi-sdk/
48+
```
49+
50+
2. Build the examples:
51+
```bash
52+
git clone https://github.com/eunomia-bpf/wasm-bpf
53+
cd wasm-bpf/examples
54+
git submodule update --init --recursive
55+
```
56+
57+
3. For example, to build the execve example:
58+
```bash
59+
cd execve && make
60+
```
61+
62+
The available examples are:
63+
64+
```bash
65+
bootstrap execve go-execve go-lsm lsm opensnoop runqlat rust-bootstrap sockfilter sockops
66+
```
67+
68+
### Run Examples
69+
70+
After building, you can find the plug-in at `./build/plugins/wasm_bpf/libwasmedgePluginWasmBpf.so` and the WasmEdge CLI tool at `./build/tools/wasmedge/wasmedge`.
71+
72+
To run the examples, set `WASMEDGE_PLUGIN_PATH=./build/plugins/wasm_bpf/` and run wasmedge:
73+
74+
```bash
75+
WASMEDGE_PLUGIN_PATH=./build/plugins/wasm_bpf/ ./build/tools/wasmedge/wasmedge execve.wasm
76+
```
77+
78+
Adjust `WASMEDGE_PLUGIN_PATH` according to your build directory of the plug-in.
79+
80+
## Host Functions
81+
82+
This plug-in adds six host functions that give your Wasm application access to eBPF. All of these functions are in the module `wasm_bpf`, if you loaded this plug-in:
83+
84+
```c
85+
/// lookup a bpf map fd by name.
86+
i32 wasm_bpf_map_fd_by_name(u64 obj, u32 name);
87+
/// detach and close a bpf program.
88+
i32 wasm_close_bpf_object(u64 obj);
89+
/// CO-RE load a bpf object into the kernel.
90+
u64 wasm_load_bpf_object(u32 obj_buf, u32 obj_buf_sz);
91+
/// attach a bpf program to a kernel hook.
92+
i32 wasm_attach_bpf_program(u64 obj, u32 name,
93+
u32 attach_target);
94+
/// poll a bpf buffer, and call a wasm callback indicated by sample_func.
95+
/// the first time to call this function will open and create a bpf buffer.
96+
i32 wasm_bpf_buffer_poll(u64 program, i32 fd, u32 sample_func,
97+
u32 ctx, u32 data, i32 max_size,
98+
i32 timeout_ms);
99+
/// lookup, update, delete, and get_next_key operations on a bpf map.
100+
i32 wasm_bpf_map_operate(u64 fd, i32 cmd, u32 key, u32 value,
101+
u32 next_key, u64 flags);
102+
```
103+
104+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_bpf).

docs/contribute/source/plugin/image.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebar_position: 4
44

55
# Build WasmEdge With WasmEdge-Image Plug-in
66

7+
The WasmEdge Image plug-in is a software component that extends the functionality of the WasmEdge runtime, enabling it to load and decode JPEG and PNG images and convert them into tensors. This plug-in is useful for developers who need to process image data within their WebAssembly applications.
8+
79
## Prerequisites
810

911
The prerequisites of the WasmEdge-Image plug-in is the same as the WasmEdge building environment on the [Linux platforms](../os/linux.md) or [MacOS platforms](../os/macos.md).
@@ -39,3 +41,5 @@ If the built `wasmedge` CLI tool cannot find the WasmEdge-Image plug-in, you can
3941
:::
4042

4143
Then you will have an executable `wasmedge` runtime under `/usr/local/bin` and the WasmEdge-Image plug-in under `/usr/local/lib/wasmedge/libwasmedgePluginWasmEdgeImage.so` after installation.
44+
45+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_image).

docs/contribute/source/plugin/process.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebar_position: 3
44

55
# Build WasmEdge With WasmEdge-Process Plug-in
66

7+
The WasmEdge Process plug-in provides a sandboxed environment to execute system processes in a secured manner. This guide will walk you through the steps to build the WasmEdge Process plug-in.
8+
79
## Prerequisites
810

911
The prerequisites of the WasmEdge-Process plug-in is the same as the [WasmEdge building environment on the Linux platforms](../os/linux.md).
@@ -16,7 +18,7 @@ To enable the WasmEdge WasmEdge-Process, developers need to [building the WasmEd
1618
cd <path/to/your/wasmedge/source/folder>
1719
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_PROCESS=On
1820
cmake --build build
19-
# For the WasmEdge-Process plugin, you should install this project.
21+
# For the WasmEdge-Process plug-in, you should install this project.
2022
cmake --install build
2123
```
2224

@@ -26,3 +28,16 @@ If the built `wasmedge` CLI tool cannot find the WasmEdge-Process plug-in, you c
2628
:::
2729

2830
Then you will have an executable `wasmedge` runtime under `/usr/local/bin` and the WasmEdge-Process plug-in under `/usr/local/lib/wasmedge/libwasmedgePluginWasmEdgeProcess.so` after installation.
31+
32+
## Usage
33+
To use the plug-in with WasmEdge, you need to specify it when starting the WasmEdge runtime:
34+
35+
```bash
36+
wasmedge --dir .:. --reactor --process_plugin target/release/libwasmedge_process.so your_wasm_file.wasm
37+
```
38+
39+
Replace `your_wasm_file.wasm` with the path to your WebAssembly file. The `--process_plugin `flag specifies the path to the Process plug-in.
40+
41+
That's it! You have successfully built and installed the WasmEdge Process plug-in.
42+
43+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_process).

docs/contribute/source/plugin/rusttls.md

+67-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,71 @@
22
sidebar_position: 8
33
---
44

5-
# Build with Rusttls Plugin
5+
# Build with Rusttls Plug-in
66

7-
<!-- prettier-ignore -->
8-
:::info
9-
Work in Progress
10-
:::
7+
The WasmEdge Rustls plug-in is a replacement for the OpenSSL plug-in in WasmEdge. It provides a Rust-friendly interface to the Rustls library, which is a modern, fast, and more secure alternative to OpenSSL.
8+
9+
Here's a step-by-step guide on how to build the WasmEdge Rustls plug-in:
10+
11+
# Building the WasmEdge Rustls Plug-in
12+
13+
The WasmEdge Rustls plug-in is a replacement for the OpenSSL plug-in in WasmEdge. It provides a Rust-friendly interface to the Rustls library, which is a modern, fast, and more secure alternative to OpenSSL.
14+
15+
Here's a step-by-step guide on how to build the WasmEdge Rustls plug-in:
16+
17+
## Prerequisites
18+
19+
Ensure the following dependencies are installed on your system:
20+
21+
- Rust: You can install it from the [official website](https://www.rust-lang.org/tools/install).
22+
- CMake: Minimum version 3.12. Install it from the [official website](https://cmake.org/download/).
23+
24+
## Clone the WasmEdge Repository
25+
26+
First, clone the WasmEdge repository from GitHub:
27+
28+
```bash
29+
git clone https://github.com/WasmEdge/WasmEdge.git
30+
```
31+
32+
## Navigate to the Rustls Plug-in Directory
33+
34+
Navigate to the `wasmedge_rustls` directory within the cloned repository:
35+
36+
```bash
37+
cd WasmEdge/plugins/wasmedge_rustls
38+
```
39+
40+
## Build the Plug-in
41+
42+
Now you can build the Rustls plug-in. Run the following command:
43+
44+
```bash
45+
cargo build --release
46+
```
47+
48+
This command builds the plug-in in release mode. The compiled binary will be located in the `target/release` directory.
49+
50+
## Install the Plug-in
51+
52+
To install the plug-in, you can use the `cargo install` command:
53+
54+
```bash
55+
cargo install --path .
56+
```
57+
58+
This command will install the built plug-in into your Rust binary directory.
59+
60+
## Usage
61+
62+
To use the plug-in with WasmEdge, you need to specify it when starting the WasmEdge runtime:
63+
64+
```bash
65+
wasmedge --dir .:. --reactor --rustls_plugin target/release/libwasmedge_rustls.so your_wasm_file.wasm
66+
```
67+
68+
Replace `your_wasm_file.wasm` with the path to your WebAssembly file. The `--rustls_plugin` flag specifies the path to the Rustls plug-in.
69+
70+
That's it! You have successfully built and installed the WasmEdge Rustls plug-in. Please ensure to replace the OpenSSL plug-in with the Rustls plug-in in your WasmEdge runtime configuration if you were previously using OpenSSL.
71+
72+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_crypto).

docs/contribute/source/plugin/tensorflow.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebar_position: 5
44

55
# Build WasmEdge With WasmEdge-Tensorflow Plug-in
66

7+
The WasmEdge-TensorFlow plug-in is a software component that extends the functionality of the WasmEdge runtime. It allows developers to perform TensorFlow model inference with similar APIs to Python. The plug-in is designed for Rust to WebAssembly applications and depends on the TensorFlow C library for its operations.
8+
79
## Prerequisites
810

911
The prerequisites of the WasmEdge-Tensorflow plug-in is the same as the WasmEdge building environment on the [Linux platforms](../os/linux.md) or [MacOS platforms](../os/macos.md).
@@ -70,3 +72,5 @@ ln -s libtensorflow_framework.2.dylib /usr/local/lib/libtensorflow_framework.dyl
7072
```
7173

7274
Or create the symbolic link in the current directory and set the environment variable `export LD_LIBRARY_PATH=$(pwd):${LD_LIBRARY_PATH}`.
75+
76+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_tensorflow).

docs/contribute/source/plugin/tensorflowlite.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebar_position: 6
44

55
# Build WasmEdge With WasmEdge-TensorflowLite Plug-in
66

7+
The WasmEdge-TensorflowLite plug-in is a software component that extends the functionality of the WasmEdge runtime to perform TensorFlow-Lite model inference. It allows WebAssembly applications to access TensorFlow-Lite functionality when executed on the WasmEdge runtime. The plugin provides a bridge between the WasmEdge runtime and the TensorFlow-Lite backend, allowing developers to execute machine learning models within WebAssembly applications.
8+
79
## Prerequisites
810

911
The prerequisites of the WasmEdge-TensorflowLite plug-in is the same as the WasmEdge building environment on the [Linux platforms](../os/linux.md) or [MacOS platforms](../os/macos.md).
@@ -62,3 +64,5 @@ mv libtensorflowlite_flex.dylib /usr/local/lib
6264
```
6365

6466
Or set the environment variable `export LD_LIBRARY_PATH=$(pwd):${LD_LIBRARY_PATH}`.
67+
68+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_tensorflowlite).

docs/contribute/source/plugin/wasi_crypto.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebar_position: 1
44

55
# Build with WASI-Crypto Plug-in
66

7+
WebAssembly System Interface (WASI) Crypto is a proposal for a set of APIs that provide cryptographic operations for WebAssembly modules. It aims to provide a consistent, portable, and secure interface for cryptographic operations across different platforms. The WasmEdge WASI-Crypto plug-in is an implementation of this proposal, providing cryptographic functionalities to WebAssembly applications running on the WasmEdge runtime.
8+
79
## Prerequisites
810

911
Currently, WasmEdge used `OpenSSL 1.1` or `3.0` for the WASI-Crypto implementation.
@@ -75,3 +77,5 @@ If the built `wasmedge` CLI tool cannot find the WASI-Crypto plug-in, you can se
7577
:::
7678

7779
Then you will have an executable `wasmedge` runtime under `/usr/local/bin` and the WASI-Crypto plug-in under `/usr/local/lib/wasmedge/libwasmedgePluginWasiCrypto.so` after installation.
80+
81+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_process).

docs/contribute/source/plugin/wasi_logging.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebar_position: 1
44

55
# Build WasmEdge With WASI-Logging Plug-in
66

7+
WASI-Logging allows WebAssembly applications to log messages in a standardized way. This becomes particularly helpful when debugging applications or understanding the flow of execution within them. The WASI-Logging plug-in is designed to be straightforward to use, enabling developers to focus more on their application logic and less on logging mechanics.
8+
79
## Prerequisites
810

911
The prerequisite of the Wasi-Logging plug-in is the same as the WasmEdge building environment on the [Linux](../os/linux.md) and [MacOS](../os/macos.md) platforms.
@@ -25,4 +27,15 @@ cmake --install .
2527
If the built `wasmedge` CLI tool cannot find the WASI-Logging plug-in, you can set the `WASMEDGE_PLUGIN_PATH` environment variable to the plug-in installation path (`/usr/local/lib/wasmedge`, or the built plug-in path `build/plugins/wasi_logging`) to try to fix this issue. You should find `libwasmedgePluginWasiLogging.so` in your `WASMEDGE_PLUGIN_PATH`
2628
:::
2729

28-
Then you will have an executable `wasmedge` runtime under `/usr/local/bin` and the WASI-Logging plug-in under `/usr/local/lib/wasmedge/libwasmedgePluginWasiLogging.so` after installation.
30+
Then you will have an executable `wasmedge` runtime under `/usr/local/bin` and the WASI-Logging plugin under `/usr/local/lib/wasmedge/libwasmedgePluginWasiLogging.so` after installation.
31+
32+
## Loading WASI-Logging Plug-in
33+
If the built `wasmedge` CLI tool cannot find the WASI-Logging plug-in, set the `WASMEDGE_PLUGIN_PATH` environment variable to the plug-in installation path (such as `/usr/local/lib/wasmedge/`, or the built plug-in path `build/plugins/wasi_logging/`) to resolve this issue 1.
34+
35+
After installation, the `wasmedge` runtime will be located under `/usr/local/bin` and the WASI-Logging plug-in under `/usr/local/lib/wasmedge/libwasmedgePluginWasiLogging.so`.
36+
37+
## Using WASI-Logging in Your Applications
38+
You can use the WASI-Logging plug-in in your WebAssembly applications to log messages in a standardized way.
39+
40+
41+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_logging).

docs/contribute/source/plugin/wasi_nn.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ sidebar_position: 2
44

55
# Build with WASI-nn Plug-in
66

7+
The WASI-NN plug-in is a proposed WebAssembly System Interface (WASI) API for machine learning. It allows WebAssembly programs to access host-provided machine learning functions.
8+
79
## Prerequisites
810

911
Currently, WasmEdge used OpenVINO™ or PyTorch as the WASI-NN backend implementation. For using WASI-NN on WasmEdge, you need to install [OpenVINO™](https://docs.openvino.ai/2023.0/openvino_docs_install_guides_installing_openvino_apt.html)(2023) or [PyTorch 1.8.2 LTS](https://pytorch.org/get-started/locally/) for the backend.
@@ -125,3 +127,5 @@ Or set the environment variable `export LD_LIBRARY_PATH=$(pwd):${LD_LIBRARY_PATH
125127
:::note
126128
We also provided the `darwin_x86_64`, `darwin_arm64`, and `manylinux_aarch64` versions of the TensorFlow-Lite pre-built shared libraries.
127129
:::
130+
131+
For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_nn).

0 commit comments

Comments
 (0)