From 7a407c6cc286f835518b42a3680023e96ebeb570 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Tue, 26 Sep 2023 22:55:45 +0200 Subject: [PATCH] docs: WebAssembly page and Wasmer Wasix example [skip ci] https://static-web-server.net/features/webassembly/ --- docs/content/download-and-install.md | 8 ++++++++ docs/content/features/webassembly.md | 22 ++++++++++++++++++++++ docs/mkdocs.yml | 1 + 3 files changed, 31 insertions(+) create mode 100644 docs/content/features/webassembly.md diff --git a/docs/content/download-and-install.md b/docs/content/download-and-install.md index 08e241c..a048717 100644 --- a/docs/content/download-and-install.md +++ b/docs/content/download-and-install.md @@ -70,6 +70,14 @@ Via [Scoop](https://scoop.sh/) scoop install static-web-server ``` +### WebAssembly + +Via [Wasmer](https://wasmer.io/wasmer/static-web-server/) + +```sh +wasmer run wasmer/static-web-server --net --enable-threads --mapdir /public:/my/host/dir -- --port 8787 +``` + ### TrueNAS SCALE If you use [TrueNAS SCALE](https://www.truenas.com/truenas-scale/) then visit [TrueCharts Community Website](https://truecharts.org/charts/stable/static-web-server/) and its [Introduction to SCALE](https://truecharts.org/manual/SCALE/guides/scale-intro) page to install SWS application in your instance. diff --git a/docs/content/features/webassembly.md b/docs/content/features/webassembly.md new file mode 100644 index 0000000..aa7daa9 --- /dev/null +++ b/docs/content/features/webassembly.md @@ -0,0 +1,22 @@ +# WebAssembly + +**SWS** can run in a [WebAssembly](https://webassembly.org/) context. + +!!! info "Wasm/Wasix targets are not officially supported by SWS yet" + We do not officially support Wasm or Wasix targets yet. But SWS project will eventually support Wasix as a target in a not remote future.
+ In the meantime, [Wasmer](https://wasmer.io/) folks made it possible to [run SWS via Wasix today](https://wasmer.io/posts/announcing-wasix) via a series of patches. + +## Wasix + +You can run SWS using [The Wasmer Runtime](https://wasmer.io/wasmer/static-web-server/) with [Wasix](https://wasix.org/). See the [wasmer/static-web-server](https://wasmer.io/wasmer/static-web-server) package. + +To run SWS, make sure to install Wasmer first and then enable its `net` and `threads` features as well as map your host directory via the `mapdir` option before starting the server. + +Here is an example. + +```sh +wasmer run wasmer/static-web-server \ + --net --enable-threads --mapdir /public:/my/host/dir -- --port 8787 +``` + +See [The WASIX with Axum Tutorial](https://wasix.org/docs/language-guide/rust/tutorials/wasix-axum) for more details. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 5c98861..1365499 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -163,6 +163,7 @@ nav: - 'Ignore Files': 'features/ignore-files.md' - 'Health endpoint': 'features/health-endpoint.md' - 'Virtual Hosting': 'features/virtual-hosting.md' + - 'WebAssembly': 'features/webassembly.md' - 'Platforms & Architectures': 'platforms-architectures.md' - 'Migrating from v1 to v2': 'migration.md' - 'Changelog v2 (stable)': 'https://github.com/static-web-server/static-web-server/blob/master/CHANGELOG.md' -- libgit2 1.7.2