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

feat: run workers in installed language runtimes #81

Merged
merged 6 commits into from
Feb 7, 2023

Conversation

Angelmmiguel
Copy link
Contributor

This PR configures wws to run new workers based on the installed language runtimes. Now, wws loads the configuration to detect if there're new file extensions available. Then, it will initiate the runtime for files with those extensions so they can receive requests.

I had to update the different structs that initiates the workers to ensure the Config is only load once.

Regarding how the runtimes are configured, the worker ExternalRuntime is in charge of preparing the source code when wws starts. Then, it will configure the WASI context on every request. All the required configuration is in the Runtime metadata (see #65)

Example

$ ls
worker.rb  wws

$ wws .
⚙️  Loading routes from: .
🗺  Detected routes:
🚀 Start serving requests at http://127.0.0.1:8080

$ wws runtimes install ruby 3.2.0
⚙️  Fetching data from the repository...
🚀 Installing the runtime...
✅ Done

$ wws . 
⚙️  Loading routes from: .
🗺  Detected routes:
    - http://127.0.0.1:8080/worker
      => ./worker.rb (name: default)
🚀 Start serving requests at http://127.0.0.1:8080

It closes #80

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Feb 2, 2023
@Angelmmiguel Angelmmiguel added this to the v1.0.0 milestone Feb 2, 2023
@Angelmmiguel Angelmmiguel requested a review from a team February 2, 2023 14:28
@Angelmmiguel Angelmmiguel self-assigned this Feb 2, 2023
Copy link
Contributor

@assambar assambar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Learned a lot while reading this!

src/config.rs Show resolved Hide resolved
src/router/files.rs Show resolved Hide resolved
src/runtimes/manager.rs Outdated Show resolved Hide resolved
@Angelmmiguel Angelmmiguel merged commit 9752cf2 into main Feb 7, 2023
@Angelmmiguel Angelmmiguel deleted the 80-run-installed-language-runtimes branch May 8, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Load and run workers with installed runtimes
4 participants