Giter Club home page Giter Club logo

wagi's Introduction

WAGI: WebAssembly Gateway Interface

WAGI is the easiest way to get started writing WebAssembly microservices and web apps.

WARNING: This is experimental code. It is not considered production-grade by its developers, neither is it "supported" software.

DeisLabs is experimenting with many WASM technologies right now. This is one of a multitude of projects (including Krustlet) designed to test the limits of WebAssembly as a cloud-based runtime.

tl;dr

WAGI allows you to run WebAssembly WASI binaries as HTTP handlers. Write a "command line" application that prints a few headers, and compile it to WASM32-WASI. Add an entry to the modules.toml matching URL to WASM module. That's it.

You can use any programming language that can compile to WASM32-WASI.

Quickstart

Here's the fastest way to try out WAGI. For details, checkout out the documentation.

  1. Get the latest binary release
  2. Unpack it tar -zxf wagi-VERSION-OS.tar.gz
  3. Run the wagi --help command

If you would like to try out a few simple configurations, we recommend cloning this repository and then using the examples directory:

$ wagi -c examples/modules.toml
No log_dir specified, using temporary directory /var/folders/hk/l1mlxz1x01x9yl33ll9vh9980000gp/T/.tmpx55XkJ for logs

This will start WAGI on http://localhost:3000. Use a browser or a tool like curl to test:

$ curl -v http://localhost:3000/hello/world
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /hello/world HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 200 OK
< content-type: text/html; charset=UTF-8
< content-length: 12
< date: Wed, 14 Oct 2020 22:00:59 GMT
<
hello world
* Connection #0 to host localhost left intact
* Closing connection 0

To add your own modules, compile your code to wasm32-wasi format and add them to the modules.toml file. Check out our Yo-Wasm project for a quick way to build Wasm modules in a variety of languages.

Examples and Demos

Wagi is an implementation of CGI for WebAssembly. That means that writing a Wagi module is as easy as sending properly formatted content to standard output. If you want to understand the details, read the Common Gateway Interface 1.1 specification.

Take a look at the Wagi Examples Repository for examples in various languages.

For a "production grade" (whatever that means for a pre-release project) module, checkout out the Wagi Fileserver: A fileserver written in Grain, compiled to Wasm, and ready to run in Wagi.

Contributing

Want to chat? We hang out in the #krustlet channel of the Kubernetes Slack.

WAGI is experimental, and we welcome contributions to improve the project. In fact, we're delighted that you're even reading this section of the docs!

For bug fixes:

  • Please, pretty please, file issues for anything you find. This is a new project, and we are SURE there are some bugs to work out.
  • If you want to write some code, feel free to open PRs to fix issues. You may want to drop a comment on the issue to let us know you're working on it (so we don't duplicate effort).

For refactors and tests:

  • We welcome any changes to improve performance, clean up code, add tests, etc.
  • For style/idiom guidelines, we follow the same conventions as Krustlet

For features:

  • If there is already an issue for that feature, please let us know in the comments if you plan on working on it.
  • If you have a new idea, file an issue describing it, and we will happily discuss it.

Since this is an experimental repository, we might be a little slow to answer.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

wagi's People

Contributors

adamreese avatar bketelsen avatar brooksmtownsend avatar carolynvs avatar colineberhardt avatar dicej avatar fibonacci1729 avatar itowlson avatar michellen avatar nitishm avatar radu-matei avatar simongdavies avatar technosophos avatar thomastaylor312 avatar vdice avatar vishnujin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wagi's Issues

Allow modules to dynamically register sub-paths and map to functions

Say we have a module declared like this:

[[module]]
route = "/hello"
module = "my.wasm"

It would be nice for the module to be able to claim several sub-routes, and have those mapped automatically. For example, the module may want to add a /hello/foo path that maps to the function foo() and a /hello/bar path that maps to bar().

We could create a reserved function name that WAGI can call to register subpaths. For example, we could map the _routes() function for this. The expectation is that the function would return a TOML document that described its routes:

[[route]]
path = "/foo"
entrypoint = "foo"


[[route]]
path = "/bar"
entrypoint = "bar"

The module's base path (/hello) would then be combined with the _route()'s relative paths to form absolute paths (/hello/foo and /hello/bar). This would prevent a module from usurping another module's namespace. (And would be easier to debug)

The TOML structure makes it possible for us to add new dynamic configuration in the future. But I think the above represents the minimal.

Now, when it comes to generating the lookup tables, WAGI could take a few strategies:

  • It could generate the full path lookup table every time that it loaded. This is obviously heavy in cost.
  • It could call _routes() only when a prefix was matched. So if the client sends /hello/foo/bar/baz, WAGI would do a prefix match on its known routes, find that a module matched the prefix, and then invoke the _routes() call on the module to find out if /foo/bar/baz matched one of the subpaths

Of course, neither of these approaches preclude caching.

Normalize more incoming HTTP headers

Right now, we only remove the following HTTP headers from the ones that are injected into the environment:

  • HTTP_AUTHORIZATION
  • HTTP_CONNECTION

The specification notes that other security-sensitive headers should also be removed. What headers should be removed?

File serving is not working

The static fileserver demo (wagi-fileserver) is returning 500 errors for all paths under static. This appears to be a recent issue e.g. it works on commit da17547 (PR 96).

Support `.env` file for bulk-loading guest environment variables

Right now, if you want to pass environment variables to the guest module, you do so on the CLI like this:

$ wagi -e FOO=1 -e BAR=2

We could support a Docker-style (or Heroku style) .env file that had a simple format like this:

FOO=1
BAR=2

I think this could be done simply with an existing Rust crate.

I think the default behavior would be to try to load a $(PWD)/.env file, but with a CLI flag to override. Though if we are reluctant to load by default, we could just add an --env-file=$PATH option.

Swift WASM+WASI does not work

Modules built from swift-wasm do not execute. The error is: Err(Exited with i32 exit status 71)

Example Hello World code:

print("content-type: text/plain\n\n");
print("Hello WAGI!\n");    

Better 500 errors

Right now, the 500 errors are completely uninformative and we print the error to the system's STDOUT. We should log the error and give a way to correlate the log message to the error response.

Allow sharing memory across modules

Since we don't have networking, our best way to share information between two modules would be to share virtual files across multiple modules. That might require a new top-level object in the Wagi config.

outbound networking

Nice project.

Wondering about "In the future, as WASI matures, we will relax the restrictions on outbound networking."

Could you explain what this implies? Thxs.

Bindle always pulled from remote

I am pointing Wagi to a remote Bindle, and I expected that after the first pull, the module to be cached. However, it seems that Wagi is always pulling from the remote.

(the issue exists regardless of whether the Wasmtime cache is used or not)

Below is Wagi responding to two identical consecutive requests:

$ RUST_LOG=wagi=debug wagi --bindle-server https://bindle.deislabs.io/v1 --bindle hippos.rocks/helloworld/2.0.0  --cache examples/cache.toml --listen 0.0.0.0:3000
Jun 30 18:37:01.665  INFO wagi: Starting server addr=0.0.0.0:3000
No log_dir specified, using temporary directory /tmp/.tmpyYh1Nq for logs
Jun 30 18:37:01.666  INFO wagi: Loading bindle name="hippos.rocks/helloworld/2.0.0"
Jun 30 18:37:01.923 DEBUG wagi::runtime::bindle: Loaded modules from the default group (parcels that do not have conditions.memberOf set) default_modules=1
Jun 30 18:37:01.945 DEBUG route_instantiation:load_cached_module{cache=/tmp/.tmpZ387eR module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}: wagi::runtime: module cache miss. Loading module from remote.

Jun 30 18:37:14.125 DEBUG run_wasm{entrypoint="_start" use_tls=false uri=/ module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}:module instantiation: wagi::runtime: Overriding port port="3000"
Jun 30 18:37:14.125 DEBUG run_wasm{entrypoint="_start" use_tls=false uri=/ module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}:module instantiation: wagi::runtime: Overriding port port="3000"
Jun 30 18:37:14.125  INFO run_wasm{entrypoint="_start" use_tls=false uri=/ module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}:module instantiation: wagi::runtime: Using log dir log_dir=/tmp/.tmpyYh1Nq/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1
Jun 30 18:37:14.128 DEBUG run_wasm{entrypoint="_start" use_tls=false uri=/ module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}:module instantiation:load_cached_module{cache=/tmp/.tmpZ387eR module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}: wagi::runtime: module cache miss. Loading module from remote.


Jun 30 18:37:18.399 DEBUG run_wasm{entrypoint="_start" use_tls=false uri=/ module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}:module instantiation: wagi::runtime: Overriding port port="3000"
Jun 30 18:37:18.399 DEBUG run_wasm{entrypoint="_start" use_tls=false uri=/ module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}:module instantiation: wagi::runtime: Overriding port port="3000"
Jun 30 18:37:18.399  INFO run_wasm{entrypoint="_start" use_tls=false uri=/ module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}:module instantiation: wagi::runtime: Using log dir log_dir=/tmp/.tmpyYh1Nq/8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1
Jun 30 18:37:18.403 DEBUG run_wasm{entrypoint="_start" use_tls=false uri=/ module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}:module instantiation:load_cached_module{cache=/tmp/.tmpZ387eR module=parcel:hippos.rocks/helloworld/2.0.0#6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26}: wagi::runtime: module cache miss. Loading module from remote.

Edit: it seems to keep re-writing the same file in the module cache:

$ ls -al bindle-cache/
total 1732
drwxr-xr-x 2 pi pi    4096 Jun 30 18:45 .
drwxr-xr-x 4 pi pi    4096 Jun 30 18:44 ..
-rw-r--r-- 1 pi pi 1762539 Jun 30 18:46 6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26

$ sha256sum bindle-cache/6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26
6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26  bindle-cache/6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26

# wait until next request, see the file has been overwritten:

$ ls -al bindle-cache/
total 1732
drwxr-xr-x 2 pi pi    4096 Jun 30 18:45 .
drwxr-xr-x 4 pi pi    4096 Jun 30 18:44 ..
-rw-r--r-- 1 pi pi 1762539 Jun 30 18:47 6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26
$ sha256sum bindle-cache/6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26
6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26  bindle-cache/6f88f066fd7fdde440ff3bbc5b7c0e3ef9d2fc0c7b7a98122b5c0f6fc75bed26

Switch to Apache license

We need to switch over to the Apache license before we can look at donating Wagi to a foundation. It's probably better to do this earlier rather than later.

Swap out `log` with `tracing`

This will bring WAGI in line with our other projects and allow us to have some good telemetry if needed for integration with other systems

Build script that creates necessary directories / files instead of platform-dependent Makefile

We recently added support for building and running Wagi on Windows (#60) -- but because of the platform-dependent Makefile, you cannot make run on Windows.

We should either add a separate target for Windows, or move the logic to create the directories and certificates in a build.rs script.

Note that setting the log environment variables still needs to be in the Makefile, and that is going to have to be platform dependent.

Add HTTPS support

Wagi should be able to serve TLS/HTTPS requests.

  • It should be configurable from the CLI
  • It should also set SERVER_PROTOCOL to https for guest modules

Send STDERR to log

Right now, the module's STDERR is sent directly to the process's STDERR. Probably we should indirect that and other messages to a log that can be independently configured.

Starting Wagi with -l causes panic

Starting Wagi multiple times on Windows (not checked linux or macos) can result in the following output and wagi not listening on the port specified in -l arg

[2021-07-06T14:15:31Z INFO wagi] Setting default host to localhost:3000
thread 'main' panicked at 'error binding to 127.0.0.1:32768: error creating server listener: Only one usage of each socket address (protocol/network address/port) is normally permitted. (os error 10048)', C:\Users\sdavies.cargo\registry\src\github.com-1ecc6299db9ec823\hyper-0.14.2\src\server\server.rs:65:13

Notes:

Wagi does not terminate when this panic occurs
The port that it complains about does not seem to be in use (but has been previously)
Seems like after some time (TIME_WAIT?) port becomes available.

Improve loading speed

Right now, WAGI loads the WASM module at request time. Big WASM modules can take seconds to load.

There is probably a way to cache or preload modules to speed this up. wasm3 interprets rather than JIT-ing, and that might be substantially faster in this case (though I don't think wasm3 currently has WASI support).

environment vars for single module removed?

wagi --env is good for global env vars for all modules, but for some cases, I need to inject some secret vars for a Wasm module only, not for all modules. I found the example from https://github.com/deislabs/wagi-examples/tree/main/env_wagi

[[module]]
# Mount this to example.com/env
route = "/env"
# Point to the directory that 'cargo build' wrote the WASM file
module = "/path/to/env_wagi/target/wasm32-wasi/release/env_wagi.wasm"
# Mount the source code of this repo
volumes = { "/" = "/path/to/env_wagi" }
# Set an environment variable
environment.TEST_NAME = "test value"

But it does not work on 0.3.0, any clue?

pub struct Module {
    /// The route, begining with a leading slash.
    ///
    /// The suffix "/..." means "this route and all sub-paths". For example, the route
    /// "/foo/..." will match "/foo" as well as "/foo/bar" and "/foo/bar/baz"
    pub route: String,
    /// The path to the module that will be loaded.
    ///
    /// This should be an absolute path. It must point to a WASM+WASI 32-bit program
    /// with the read bit set.
    pub module: String,
    /// Directories on the local filesystem that can be opened by this module
    /// The key (left value) is the name of the directory INSIDE the WASM. The value is
    /// the location OUTSIDE the WASM. Two inside locations can map to the same outside
    /// location.
    pub volumes: Option<HashMap<String, String>>,
    /// The name of the function that is the entrypoint for executing the module.
    /// The default is `_start`.
    pub entrypoint: Option<String>,
    /// The URL fragment for the bindle server.
    ///
    /// If none is supplied, then http://localhost:8080/v1 is used
    pub bindle_server: Option<String>,

    /// List of hosts that the guest module is allowed to make HTTP requests to.
    /// If none or an empty vector is supplied, the guest module cannot send
    /// requests to any server.
    pub allowed_hosts: Option<Vec<String>>,

    /// Max http concurrency that the guest module configures for the HTTP
    /// client. If none, the guest module uses the default concurrency provided
    /// by the WASM HTTP client module.
    pub http_max_concurrency: Option<u32>,
}

Loading bindles doesn't seem to work

I keep getting Error: Not all routes could be built: Invalid id: InvalidId with bindle: modules.

It seems like this is caused by

.get_parcel(bindle_cache_key(uri), first.label.sha256.as_str())
, which passes the bindle_cache_key as the bindle_id argument. So it passes some ghastly string instead of e.g. hello/1.0.0.

I believe that changing bindle_cache_key(uri) to bindle_name fixes it.

A/B testing and similar "conditional loading" scenarios

Today Brendan suggested a feature that I think would be really cool:

He suggested "dyanmic overrides packaged as part of the request." He's thinking along the lines of Launch Darkly or A/B testing frameworks.

In the simplest case, you could merely select which module to run based on host headers. But Brendan suggested taking it even further and being able to specify a module in an HTTP header and have that loaded in the request (think like a Bindle reference where the runtime could verify the integrity of the package before loading).

Probably, we can start with loading conditionally off of a Bindle + HTTP header or A/B flag cookie. Then we could work out this second part.

Feature: Static file serving

The goal of this feature is to take some files from a bindle and serve them via a Wasm module in the bindle. The target should be a wasm module that handles static file serving in a predictable and configurable way.

General overview:

  • One bindle can have more than one Wasm module
  • One module may serve out static assets
    • Ideally, we would be able to write a pretty good static file serving module and re-use it all over the place
  • Assets can be clearly identified as static assets that should be served at an understood path.

A Bindle with Static Assets and Multiple Modules

Here is an example invoice.toml with two modules and some files that should be served statically, along with another file that should never be served statically. I have omitted a bunch of boilerplate for brevity.

bindleVersion = "1.0.0"

# The top-level data
[bindle]
name = "example.com/static"
version = "1.0.0"

[[group]]
name = "static-files"
satisfiedBy = "allOf"

[[group]]
name = "private-files"
satisfiedBy = "allOf"

# An example of a custom app
[[parcel]]
label.name = "myapp.wasm"
label.mediaType = "application/wasm"
conditions.requires = ["private-files"]
features.wagi.path = "/app"   # From the hippofacts

# An example module that just serves static files
[[parcel]]
label.name = "static.wasm"
label.mediaType = "application/wasm"
conditions.requires = ["static-files"]
features.wagi.path = "/static/..."  # Note the wildcard /..., which matches all subpaths

# These three parcels are static files to be served by static.wasm
[[parcel]]
label.name = "img/penguin.jpg"
label.mediaType = "image/jpeg"
conditions.memberOf = ["static-files"]
features.wagi.file = true   # Generated from hippofacts, designates this as a member of the `files = []` array in hippofacts

[[parcel]]
label.name = "img/cassowary.jpg"
label.mediaType = "image/jpeg"
conditions.memberOf = ["static-files"]
features.wagi.file = true

[[parcel]]
label.name = "css/style.css"
label.mediaType = "text/css"
conditions.memberOf = ["static-files"]
features.wagi.file = true

# This asset is private, is mounted to myapp.wasm, and can't be served via static.wasm
[[parcel]]
label.name = "super/secret/data.txt"
label.mediaType = "text/plain"
conditions.memberOf = ["private-files"]
features.wagi.file = true

(See comments on deislabs/hippo-cli#15 for how this would be generated from hippofacts)

Serving the Files

The bindle above is mounted to some URI paths:

  • http://example.com/app/ is mapped to myapp.wasm
  • http://example.com/static/ and all subpaths are sent to static.wasm

When WAGI encounters the features.wagi.file = true flag, the parcel is considered a file and is mounted as a file, attached to any modules that require this parcel.

In the bindle above, the mayapp.wasm module would have one file available to it, effectively mounted to the path /super/secret/data.txt. It would be able to access that data however it saw fit.

The static.wasm module has the following paths available, mounted by Wagi:

  • /img/cassowary.jpg
  • /img/penguin.jpg
  • /css/style.css

The static.wasm module effectively can translate HTTP paths to static file paths. Here's basic pseudocode:

var path_info = env.PATH_INFO            // Example: /static/img/penguin.jpg
var prefix = env.X_MATCHED_ROUTE  // Example: /static

var file = path_info.trim_prefix(prefix)  // Gives us /img/penguin.jpg
var mime = guess_mime_by_extension(file) // gives us image/jpeg

// Obviously, we'd want to do something more memory-efficient
var data = fs.read_file(file)

// Print a content-type header, an empty line, then the data
stdout.println("Content-Type: " + mime)
stdout.println("")
stdout.print(data)

Speed up the output

Right now, a module is entirely buffered, and then its contents are length-checked and sent back to the client. This is fine for small files, but would be both slow and resource intensive for larger responses. We can probably figure out a way to stream that content back.

This will break from the CGI spec, but that is okay since the spec was pre-HTTP/2

Environment Variables should be passed from CLI to every module that is running

The following option should be added to the Wagi CLI:

-e NAME=VALUE

This should be supported for multiple options (-e foo=bar baz=lurman). It should also support quoted values: -e foo="test -e".

This should parse the input into name/value string/string pairs, which will be passed to every running module as environment variables.

For example, if two a.wasm and b.wasm are both running, both should receive all of the name/value pairs sent using -e.

Way to extract content body data from request?

I started playing around with some of the example repos that are available, specifically the AssemblyScript one, and was wondering if there was a way to pull data from the body of a request like the example below or would you need to send the data in via query parameters?

curl -d 'hello world' -H 'Content-Type: text/plain' http://localhost:3000/as-hello

It looks like the CONTENT_LENGTH is updated correctly, but I dont see an env var available for request body data.

PATH_TRANSLATED should be different

According to the CGI spec, the PATH_TRANSLATED env var was a path to a file on the filesystem. We could use PATH_TRANSLATED to hold the path info with the prefix chopped off. E.g. if the route matches is /foo/... and the PATH_INFO is /foo/bar/baz, then the PATH_TRANSLATED would be /bar/baz.

Since this is a frequently needed transformation, it is probably a good idea to do it.

If we are worried about overloading a CGI term, we could use something like X_SUBPATH or something

Remove Virtual Hosting

Early on, we write Wagi to do multi-tenant hosting. So we had a number of features like virtual hosting that were designed to be strict and to reduce the possibility of accidentally loading the wrong site (information disclosure).

But our use case is rapidly evolving toward using a single Wagi instance per app. And in this case, it makes more sense to delegate the host mapping to Nomad or other services, and not have to explicitly configure a Wagi app. Rather, only Wagi itself would know about the host name, and that information would be supplied once for all endpoints hosted on that Wagi instance.

Should we remove virtual hosting, disallowing modules from declaring their own host name?

๐Ÿ‘ = Yes
๐Ÿ‘Ž = No

Remove _reload endpoint

Wagi currently supports reloading the modules.toml file dynamically with /_reload. However, it has introduced a few problems:

  • There is now race condition when writing modules files
  • The aysnc code has gotten very complicated, with strange things happening at strange places
  • This does not work well with Bindle and OCI

So it is probably good to just remove this.

Review host matching behaviour

I had a modules.toml that I assumed would not care about where it was served from - it specified routes and handlers but no hosting.

I ran my WAGI server on localhost:32768 and pointed it at this modules.toml. The routes failed to load, as far as I can tell because they did not match the default_host of localhost:3000.

Am I misunderstanding? Is this expected behaviour? It surprised the heck out of me.

On the plus side, it did give us much better tracing of the handler mapping logic.

Demo applications are missing or not public

The documentation points to the following examples:

  • env_wagi: Dump the environment that WAGI sets up, including env vars and args.
  • hello-wagi-as: AssemblyScript example using environment variables and query params.

Neither of which are publicly available.

Complete Bindle support

The current implementation of Wagi only uses the first free wasm module from a bindle.

It should instead do the following:

  • Support multiple modules
  • Support mapping volumes to modules, where a volume is a parcel in a group required by the module
  • Support mapping module configuration options (host, route, etc) from inside of the bindle using features

Docs: Need to document what headers can be sent back

The first section in Wagi module output is a set of headers. But there are specific headers that are supported. We need to document all of the.

I believe they are:

  • location
  • content-type
  • status

But there might be others.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.