Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding multi-language support (multiple language runtimes) #63

Closed
10 tasks done
Angelmmiguel opened this issue Jan 20, 2023 · 1 comment
Closed
10 tasks done

Adding multi-language support (multiple language runtimes) #63

Angelmmiguel opened this issue Jan 20, 2023 · 1 comment
Assignees
Labels
🚀 enhancement New feature or request
Milestone

Comments

@Angelmmiguel
Copy link
Contributor

Angelmmiguel commented Jan 20, 2023

This issue tracks an ongoing effort. The implementation will be done in the related issues you can find at the end

Wasm Workers Servers aim to create serverless applications based on different languages. As a starting point, we added support for Wasm modules (compiled from Rust) and JavaScript (by embedding the QuickJS runtime). All these workers run inside the WebAssembly sandbox.

For v1.0.0, the goal is to extend the number of languages by allowing different language runtimes. Even though the size of other runtimes like Ruby and Python are not big (see our python and ruby releases), including them in the main wws is not an option.

In addition to that, we want to make wws extensible. Any developer may implement new language runtimes and use them. For this reason, wws will allow to import runtimes from different sources.

CLI experience

In this section, I will explore the desired CLI experience for this feature. All the examples assume a project has two or more workers. One is a "native" worker (.wasm) file that doesn't require any runtime. The other file requires a runtime to run (.rb or .py). 

$ tree ./examples/multi-lang 
./examples/ multi-lang 
├── hello.rb 
├── basic.toml 
└──  basic.wasm 

Repositories

A repository is an index file that points to different runtimes. It can be hosted in a git repository or in any service that can expose files. wws will retrieve the index file from the given repository. This index file contains pointers to the available runtimes. The repository is configurable via arguments, so anyone can develop their own repository. If no --repo parameter is provided, the WebAssembly Language Runtimes will be the default repo. 

The CLI experience would be: 

$ wws runtimes list 
NAME            VERSION         EXTENSION       BINARY          STATUS 
ruby            3.2.0           .rb             https://...     not installed 
ruby-std        3.2.0           .rb             https://...     not installed 
python          2.3             .py             https://...     not installed 

$ wws runtimes install ruby-std 3.2.0 
Pulling the runtime binary... 
Installing it in ./wws/runtimes/wlr/ruby-std/3.2.0/... 
Validating checksum... 
Done!

$ wws ./examples/multi-lang 

To use a different repository, you can use the --repo flag:

$ wws runtimes list --repo=https://my-repo... 
NAME            VERSION         EXTENSION       BINARY          STATUS 
ruby            3.2.0           .rb             https://...     not installed 
ruby-std        3.2.0           .rb             https://...     not installed 
python          2.3             .py             https://...     not installed 

$ wws runtimes install ruby-std 3.2.0 --repo=https://my-repo... 
Pulling the runtime binary... 
Installing it in ./wws/runtimes/my-repo/ruby-std/3.2.0/... 
Validating checksum... 
Done! 

$ wws ./examples/multi-lang 

You may point by default to a specific repository by setting up an environment variable. If the --repo argument is also present, it will take precedence to the environment variable. 

Runtime metadata files

wws will read runtime metadata files. These files include all the information required to install and use a language runtime in wws. For example, they will have a name, version, extension they can manage and a pointer to the Wasm binary. It may include other configuration parameters to ensure wws knows how to run it. You have the full list available in #65.

These files can be hosted anywhere. We will provide the default set of runtimes from the WebAssembly Languages Runtime project. However, any other file repository can be used instead in wws.

Index file

To simplify the installation process, wws will rely on an index file that will live in the repository the CLI is configured to point to. This file points to the different runtimes available on that repository, so wws can list them and install easily. By default, wws will point to the WebAssembly Languages Runtime project, although developers can change it via flag and environment variable.

Project metadata

For reproducibility, wws will create a local .wws.toml file with all the installed runtimes. This file contains all the details to retrieve the runtimes in the future. When it's committed to the application repo, wws will install the required runtimes automatically.

Issues

This list will be updated during development as well as referencing GitHub issues

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Jan 20, 2023
@Angelmmiguel Angelmmiguel self-assigned this Jan 20, 2023
@Angelmmiguel Angelmmiguel added this to the v1.0.0 milestone Jan 20, 2023
@Angelmmiguel Angelmmiguel pinned this issue Jan 20, 2023
@Angelmmiguel Angelmmiguel changed the title Multi-language runtime support Adding Multi-language support (multiple runtimes) Jan 20, 2023
@Angelmmiguel Angelmmiguel changed the title Adding Multi-language support (multiple runtimes) Adding multi-language support (multiple runtimes) Jan 20, 2023
@Angelmmiguel Angelmmiguel changed the title Adding multi-language support (multiple runtimes) Adding multi-language support (multiple language runtimes) Jan 30, 2023
@Angelmmiguel
Copy link
Contributor Author

All the subtasks are done! We can proceed and close this task too 🎉

@Angelmmiguel Angelmmiguel unpinned this issue Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant