Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Write HTTP handlers in WebAssembly with a minimal amount of work

License

NotificationsYou must be signed in to change notification settings

deislabs/wagi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (includingKrustlet)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 toWASM32-WASI.Add an entry to themodules.toml matching URL to WASM module.That's it.

You can use any programming language that can compile toWASM32-WASI.

Quickstart

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

  1. Get thelatest binary release
  2. Unpack ittar -zxf wagi-VERSION-OS.tar.gz
  3. Run thewagi --help command

If you would like to try out a few simple configurations, we recommend cloning this repositoryand then using theexamples directory:

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

This will start WAGI onhttp://localhost:3000. Use a browser or a tool likecurl 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 towasm32-wasi format and add them to themodules.toml file.Check out ourYo-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 theCommon Gateway Interface 1.1 specification.

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

For a "production grade" (whatever that means for a pre-release project) module, checkout out theWagi 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 theKubernetes 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 asKrustlet

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 theMicrosoft Open Source Code ofConduct.

For more information see theCode of ConductFAQ or contactopencode@microsoft.com with any additional questions or comments.


[8]ページ先頭

©2009-2025 Movatter.jp