diff --git a/docs/contribute/source/plugin/ebpf.md b/docs/contribute/source/plugin/ebpf.md index 6a2757e9..514d8015 100644 --- a/docs/contribute/source/plugin/ebpf.md +++ b/docs/contribute/source/plugin/ebpf.md @@ -4,7 +4,101 @@ sidebar_position: 7 # Build with eBPF Plug-in - -:::info -Work in Progress -::: +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. + +## Build the eBPF Plug-in + +### Prerequisites + +Before building the eBPF plug-in, ensure that you have the following installed: + +* WasmEdge - If you haven't installed it, follow the [follow the guide to build from source](../os/linux.md). +* libbpf - This plug-in requires `libbpf >= 1.2`. See [Building libbpf](https://github.com/libbpf/libbpf#building-libbpf) for details. + +### Build steps + +To build the eBPF plug-in, run the following commands at the root of the WasmEdge project: + +```bash +cmake -DWASMEDGE_PLUGIN_WASM_BPF:BOOL=TRUE -B ./build -G "Unix Makefiles" +cmake --build ./build +``` + +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. + +## Use the eBPF Plug-in + +### Download Examples + +You can download examples of wasm-bpf programs from here: + +```bash +wget https://eunomia-bpf.github.io/wasm-bpf/examples/runqlat/runqlat.wasm +``` + +### Build Examples +You can also build examples of wasm-bpf programs from the `wasm-bpf` repository: + +1. Install the wasi-sdk if you don't have it: + +```bash +wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-17/wasi-sdk-17.0-linux.tar.gz +tar -zxf wasi-sdk-17.0-linux.tar.gz +sudo mkdir -p /opt/wasi-sdk/ && sudo mv wasi-sdk-17.0/* /opt/wasi-sdk/ +``` + +2. Build the examples: +```bash +git clone https://github.com/eunomia-bpf/wasm-bpf +cd wasm-bpf/examples +git submodule update --init --recursive +``` + +3. For example, to build the execve example: +```bash +cd execve && make +``` + +The available examples are: + +```bash +bootstrap execve go-execve go-lsm lsm opensnoop runqlat rust-bootstrap sockfilter sockops +``` + +### Run Examples + +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`. + +To run the examples, set `WASMEDGE_PLUGIN_PATH=./build/plugins/wasm_bpf/` and run wasmedge: + +```bash +WASMEDGE_PLUGIN_PATH=./build/plugins/wasm_bpf/ ./build/tools/wasmedge/wasmedge execve.wasm +``` + +Adjust `WASMEDGE_PLUGIN_PATH` according to your build directory of the plug-in. + +## Host Functions + +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: + +```c +/// lookup a bpf map fd by name. +i32 wasm_bpf_map_fd_by_name(u64 obj, u32 name); +/// detach and close a bpf program. +i32 wasm_close_bpf_object(u64 obj); +/// CO-RE load a bpf object into the kernel. +u64 wasm_load_bpf_object(u32 obj_buf, u32 obj_buf_sz); +/// attach a bpf program to a kernel hook. +i32 wasm_attach_bpf_program(u64 obj, u32 name, + u32 attach_target); +/// poll a bpf buffer, and call a wasm callback indicated by sample_func. +/// the first time to call this function will open and create a bpf buffer. +i32 wasm_bpf_buffer_poll(u64 program, i32 fd, u32 sample_func, + u32 ctx, u32 data, i32 max_size, + i32 timeout_ms); +/// lookup, update, delete, and get_next_key operations on a bpf map. +i32 wasm_bpf_map_operate(u64 fd, i32 cmd, u32 key, u32 value, + u32 next_key, u64 flags); +``` + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_bpf). diff --git a/docs/contribute/source/plugin/image.md b/docs/contribute/source/plugin/image.md index 42c685c5..fa2001cc 100644 --- a/docs/contribute/source/plugin/image.md +++ b/docs/contribute/source/plugin/image.md @@ -4,6 +4,8 @@ sidebar_position: 4 # Build WasmEdge With WasmEdge-Image Plug-in +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. + ## Prerequisites 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 ::: 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. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_image). \ No newline at end of file diff --git a/docs/contribute/source/plugin/process.md b/docs/contribute/source/plugin/process.md index a43dae3b..16d11145 100644 --- a/docs/contribute/source/plugin/process.md +++ b/docs/contribute/source/plugin/process.md @@ -4,6 +4,8 @@ sidebar_position: 3 # Build WasmEdge With WasmEdge-Process Plug-in +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. + ## Prerequisites 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 cd cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_PROCESS=On cmake --build build -# For the WasmEdge-Process plugin, you should install this project. +# For the WasmEdge-Process plug-in, you should install this project. cmake --install build ``` @@ -26,3 +28,16 @@ If the built `wasmedge` CLI tool cannot find the WasmEdge-Process plug-in, you c ::: 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. + +## Usage +To use the plug-in with WasmEdge, you need to specify it when starting the WasmEdge runtime: + +```bash +wasmedge --dir .:. --reactor --process_plugin target/release/libwasmedge_process.so your_wasm_file.wasm +``` + +Replace `your_wasm_file.wasm` with the path to your WebAssembly file. The `--process_plugin `flag specifies the path to the Process plug-in. + +That's it! You have successfully built and installed the WasmEdge Process plug-in. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_process). \ No newline at end of file diff --git a/docs/contribute/source/plugin/rusttls.md b/docs/contribute/source/plugin/rusttls.md index d822717f..c357484c 100644 --- a/docs/contribute/source/plugin/rusttls.md +++ b/docs/contribute/source/plugin/rusttls.md @@ -2,9 +2,71 @@ sidebar_position: 8 --- -# Build with Rusttls Plugin +# Build with Rusttls Plug-in - -:::info -Work in Progress -::: +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. + +Here's a step-by-step guide on how to build the WasmEdge Rustls plug-in: + +# Building the WasmEdge Rustls Plug-in + +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. + +Here's a step-by-step guide on how to build the WasmEdge Rustls plug-in: + +## Prerequisites + +Ensure the following dependencies are installed on your system: + +- Rust: You can install it from the [official website](https://www.rust-lang.org/tools/install). +- CMake: Minimum version 3.12. Install it from the [official website](https://cmake.org/download/). + +## Clone the WasmEdge Repository + +First, clone the WasmEdge repository from GitHub: + +```bash +git clone https://github.com/WasmEdge/WasmEdge.git +``` + +## Navigate to the Rustls Plug-in Directory + +Navigate to the `wasmedge_rustls` directory within the cloned repository: + +```bash +cd WasmEdge/plugins/wasmedge_rustls +``` + +## Build the Plug-in + +Now you can build the Rustls plug-in. Run the following command: + +```bash +cargo build --release +``` + +This command builds the plug-in in release mode. The compiled binary will be located in the `target/release` directory. + +## Install the Plug-in + +To install the plug-in, you can use the `cargo install` command: + +```bash +cargo install --path . +``` + +This command will install the built plug-in into your Rust binary directory. + +## Usage + +To use the plug-in with WasmEdge, you need to specify it when starting the WasmEdge runtime: + +```bash +wasmedge --dir .:. --reactor --rustls_plugin target/release/libwasmedge_rustls.so your_wasm_file.wasm +``` + +Replace `your_wasm_file.wasm` with the path to your WebAssembly file. The `--rustls_plugin` flag specifies the path to the Rustls plug-in. + +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. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_crypto). diff --git a/docs/contribute/source/plugin/tensorflow.md b/docs/contribute/source/plugin/tensorflow.md index 89fedb5f..135f8089 100644 --- a/docs/contribute/source/plugin/tensorflow.md +++ b/docs/contribute/source/plugin/tensorflow.md @@ -4,6 +4,8 @@ sidebar_position: 5 # Build WasmEdge With WasmEdge-Tensorflow Plug-in +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. + ## Prerequisites 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 ``` Or create the symbolic link in the current directory and set the environment variable `export LD_LIBRARY_PATH=$(pwd):${LD_LIBRARY_PATH}`. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_tensorflow). \ No newline at end of file diff --git a/docs/contribute/source/plugin/tensorflowlite.md b/docs/contribute/source/plugin/tensorflowlite.md index 0ad91376..773c9eee 100644 --- a/docs/contribute/source/plugin/tensorflowlite.md +++ b/docs/contribute/source/plugin/tensorflowlite.md @@ -4,6 +4,8 @@ sidebar_position: 6 # Build WasmEdge With WasmEdge-TensorflowLite Plug-in +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. + ## Prerequisites 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 ``` Or set the environment variable `export LD_LIBRARY_PATH=$(pwd):${LD_LIBRARY_PATH}`. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_tensorflowlite). diff --git a/docs/contribute/source/plugin/wasi_crypto.md b/docs/contribute/source/plugin/wasi_crypto.md index de3757b7..4f83efa8 100644 --- a/docs/contribute/source/plugin/wasi_crypto.md +++ b/docs/contribute/source/plugin/wasi_crypto.md @@ -4,6 +4,8 @@ sidebar_position: 1 # Build with WASI-Crypto Plug-in +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. + ## Prerequisites 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 ::: 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. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_process). diff --git a/docs/contribute/source/plugin/wasi_logging.md b/docs/contribute/source/plugin/wasi_logging.md index a1e6447f..0bf20a01 100644 --- a/docs/contribute/source/plugin/wasi_logging.md +++ b/docs/contribute/source/plugin/wasi_logging.md @@ -4,6 +4,8 @@ sidebar_position: 1 # Build WasmEdge With WASI-Logging Plug-in +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. + ## Prerequisites 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 . 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` ::: -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. +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. + +## Loading WASI-Logging Plug-in +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. + +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`. + +## Using WASI-Logging in Your Applications +You can use the WASI-Logging plug-in in your WebAssembly applications to log messages in a standardized way. + + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_logging). \ No newline at end of file diff --git a/docs/contribute/source/plugin/wasi_nn.md b/docs/contribute/source/plugin/wasi_nn.md index 60e67e6e..005fb33c 100644 --- a/docs/contribute/source/plugin/wasi_nn.md +++ b/docs/contribute/source/plugin/wasi_nn.md @@ -4,6 +4,8 @@ sidebar_position: 2 # Build with WASI-nn Plug-in +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. + ## Prerequisites 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 :::note We also provided the `darwin_x86_64`, `darwin_arm64`, and `manylinux_aarch64` versions of the TensorFlow-Lite pre-built shared libraries. ::: + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_nn). \ No newline at end of file diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/ebpf.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/ebpf.md index 6a2757e9..514d8015 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/ebpf.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/ebpf.md @@ -4,7 +4,101 @@ sidebar_position: 7 # Build with eBPF Plug-in - -:::info -Work in Progress -::: +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. + +## Build the eBPF Plug-in + +### Prerequisites + +Before building the eBPF plug-in, ensure that you have the following installed: + +* WasmEdge - If you haven't installed it, follow the [follow the guide to build from source](../os/linux.md). +* libbpf - This plug-in requires `libbpf >= 1.2`. See [Building libbpf](https://github.com/libbpf/libbpf#building-libbpf) for details. + +### Build steps + +To build the eBPF plug-in, run the following commands at the root of the WasmEdge project: + +```bash +cmake -DWASMEDGE_PLUGIN_WASM_BPF:BOOL=TRUE -B ./build -G "Unix Makefiles" +cmake --build ./build +``` + +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. + +## Use the eBPF Plug-in + +### Download Examples + +You can download examples of wasm-bpf programs from here: + +```bash +wget https://eunomia-bpf.github.io/wasm-bpf/examples/runqlat/runqlat.wasm +``` + +### Build Examples +You can also build examples of wasm-bpf programs from the `wasm-bpf` repository: + +1. Install the wasi-sdk if you don't have it: + +```bash +wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-17/wasi-sdk-17.0-linux.tar.gz +tar -zxf wasi-sdk-17.0-linux.tar.gz +sudo mkdir -p /opt/wasi-sdk/ && sudo mv wasi-sdk-17.0/* /opt/wasi-sdk/ +``` + +2. Build the examples: +```bash +git clone https://github.com/eunomia-bpf/wasm-bpf +cd wasm-bpf/examples +git submodule update --init --recursive +``` + +3. For example, to build the execve example: +```bash +cd execve && make +``` + +The available examples are: + +```bash +bootstrap execve go-execve go-lsm lsm opensnoop runqlat rust-bootstrap sockfilter sockops +``` + +### Run Examples + +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`. + +To run the examples, set `WASMEDGE_PLUGIN_PATH=./build/plugins/wasm_bpf/` and run wasmedge: + +```bash +WASMEDGE_PLUGIN_PATH=./build/plugins/wasm_bpf/ ./build/tools/wasmedge/wasmedge execve.wasm +``` + +Adjust `WASMEDGE_PLUGIN_PATH` according to your build directory of the plug-in. + +## Host Functions + +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: + +```c +/// lookup a bpf map fd by name. +i32 wasm_bpf_map_fd_by_name(u64 obj, u32 name); +/// detach and close a bpf program. +i32 wasm_close_bpf_object(u64 obj); +/// CO-RE load a bpf object into the kernel. +u64 wasm_load_bpf_object(u32 obj_buf, u32 obj_buf_sz); +/// attach a bpf program to a kernel hook. +i32 wasm_attach_bpf_program(u64 obj, u32 name, + u32 attach_target); +/// poll a bpf buffer, and call a wasm callback indicated by sample_func. +/// the first time to call this function will open and create a bpf buffer. +i32 wasm_bpf_buffer_poll(u64 program, i32 fd, u32 sample_func, + u32 ctx, u32 data, i32 max_size, + i32 timeout_ms); +/// lookup, update, delete, and get_next_key operations on a bpf map. +i32 wasm_bpf_map_operate(u64 fd, i32 cmd, u32 key, u32 value, + u32 next_key, u64 flags); +``` + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_bpf). diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/image.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/image.md index 42c685c5..fa2001cc 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/image.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/image.md @@ -4,6 +4,8 @@ sidebar_position: 4 # Build WasmEdge With WasmEdge-Image Plug-in +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. + ## Prerequisites 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 ::: 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. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_image). \ No newline at end of file diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/process.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/process.md index a43dae3b..16d11145 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/process.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/process.md @@ -4,6 +4,8 @@ sidebar_position: 3 # Build WasmEdge With WasmEdge-Process Plug-in +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. + ## Prerequisites 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 cd cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_PROCESS=On cmake --build build -# For the WasmEdge-Process plugin, you should install this project. +# For the WasmEdge-Process plug-in, you should install this project. cmake --install build ``` @@ -26,3 +28,16 @@ If the built `wasmedge` CLI tool cannot find the WasmEdge-Process plug-in, you c ::: 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. + +## Usage +To use the plug-in with WasmEdge, you need to specify it when starting the WasmEdge runtime: + +```bash +wasmedge --dir .:. --reactor --process_plugin target/release/libwasmedge_process.so your_wasm_file.wasm +``` + +Replace `your_wasm_file.wasm` with the path to your WebAssembly file. The `--process_plugin `flag specifies the path to the Process plug-in. + +That's it! You have successfully built and installed the WasmEdge Process plug-in. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_process). \ No newline at end of file diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/rusttls.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/rusttls.md index d822717f..c357484c 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/rusttls.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/rusttls.md @@ -2,9 +2,71 @@ sidebar_position: 8 --- -# Build with Rusttls Plugin +# Build with Rusttls Plug-in - -:::info -Work in Progress -::: +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. + +Here's a step-by-step guide on how to build the WasmEdge Rustls plug-in: + +# Building the WasmEdge Rustls Plug-in + +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. + +Here's a step-by-step guide on how to build the WasmEdge Rustls plug-in: + +## Prerequisites + +Ensure the following dependencies are installed on your system: + +- Rust: You can install it from the [official website](https://www.rust-lang.org/tools/install). +- CMake: Minimum version 3.12. Install it from the [official website](https://cmake.org/download/). + +## Clone the WasmEdge Repository + +First, clone the WasmEdge repository from GitHub: + +```bash +git clone https://github.com/WasmEdge/WasmEdge.git +``` + +## Navigate to the Rustls Plug-in Directory + +Navigate to the `wasmedge_rustls` directory within the cloned repository: + +```bash +cd WasmEdge/plugins/wasmedge_rustls +``` + +## Build the Plug-in + +Now you can build the Rustls plug-in. Run the following command: + +```bash +cargo build --release +``` + +This command builds the plug-in in release mode. The compiled binary will be located in the `target/release` directory. + +## Install the Plug-in + +To install the plug-in, you can use the `cargo install` command: + +```bash +cargo install --path . +``` + +This command will install the built plug-in into your Rust binary directory. + +## Usage + +To use the plug-in with WasmEdge, you need to specify it when starting the WasmEdge runtime: + +```bash +wasmedge --dir .:. --reactor --rustls_plugin target/release/libwasmedge_rustls.so your_wasm_file.wasm +``` + +Replace `your_wasm_file.wasm` with the path to your WebAssembly file. The `--rustls_plugin` flag specifies the path to the Rustls plug-in. + +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. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_crypto). diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/tensorflow.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/tensorflow.md index 89fedb5f..135f8089 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/tensorflow.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/tensorflow.md @@ -4,6 +4,8 @@ sidebar_position: 5 # Build WasmEdge With WasmEdge-Tensorflow Plug-in +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. + ## Prerequisites 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 ``` Or create the symbolic link in the current directory and set the environment variable `export LD_LIBRARY_PATH=$(pwd):${LD_LIBRARY_PATH}`. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_tensorflow). \ No newline at end of file diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/tensorflowlite.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/tensorflowlite.md index 0ad91376..773c9eee 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/tensorflowlite.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/tensorflowlite.md @@ -4,6 +4,8 @@ sidebar_position: 6 # Build WasmEdge With WasmEdge-TensorflowLite Plug-in +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. + ## Prerequisites 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 ``` Or set the environment variable `export LD_LIBRARY_PATH=$(pwd):${LD_LIBRARY_PATH}`. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_tensorflowlite). diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_crypto.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_crypto.md index de3757b7..4f83efa8 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_crypto.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_crypto.md @@ -4,6 +4,8 @@ sidebar_position: 1 # Build with WASI-Crypto Plug-in +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. + ## Prerequisites 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 ::: 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. + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasmedge_process). diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_logging.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_logging.md index a1e6447f..0bf20a01 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_logging.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_logging.md @@ -4,6 +4,8 @@ sidebar_position: 1 # Build WasmEdge With WASI-Logging Plug-in +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. + ## Prerequisites 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 . 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` ::: -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. +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. + +## Loading WASI-Logging Plug-in +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. + +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`. + +## Using WASI-Logging in Your Applications +You can use the WASI-Logging plug-in in your WebAssembly applications to log messages in a standardized way. + + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_logging). \ No newline at end of file diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_nn.md b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_nn.md index 60e67e6e..005fb33c 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_nn.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/contribute/source/plugin/wasi_nn.md @@ -4,6 +4,8 @@ sidebar_position: 2 # Build with WASI-nn Plug-in +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. + ## Prerequisites 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 :::note We also provided the `darwin_x86_64`, `darwin_arm64`, and `manylinux_aarch64` versions of the TensorFlow-Lite pre-built shared libraries. ::: + +For more information, you can refer to the [GitHub repository](https://github.com/WasmEdge/WasmEdge/tree/master/plugins/wasi_nn). \ No newline at end of file