-
Notifications
You must be signed in to change notification settings - Fork 41
Updating the readme doc #70
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ The JS Compute Runtime for Fastly's [Compute@Edge platform](https://www.fastly.c | |
|
|
||
| Note that this repository uses Git submodules, so you will need to run | ||
|
|
||
| ``` | ||
| ```sh | ||
| git submodule update --recursive --init | ||
| ``` | ||
|
|
||
|
|
@@ -21,13 +21,63 @@ To build from source, you need to ensure that the headers and object files for t | |
| (cd c-dependencies/spidermonkey && sh download-engine.sh) | ||
| ``` | ||
|
|
||
|
|
||
| Alternatively, the engine can also be built from source using `c-dependencies/spidermonkey/build-engine.sh`. That should only be required if you want to modify the engine itself, however. | ||
|
|
||
| In additon you need to have the following tools installed to successfully build, and build from a linux based system. | ||
|
|
||
| - Rust | ||
| ``` | ||
| curl -so rust.sh https://sh.rustup.rs && sh rust.sh -y | ||
| restart shell or run source $HOME/.cargo/env | ||
| ``` | ||
| - Build tools | ||
| ```sh | ||
| sudo apt install build-essential | ||
| ``` | ||
| - binaryen | ||
| ```sh | ||
| sudo apt install binaryen | ||
| ``` | ||
| - rust target wasm32-wasi | ||
| ```sh | ||
| rustup target add wasm32-wasi | ||
| ``` | ||
| - cbindgen | ||
| ```sh | ||
| cargo install cbindgen | ||
| ``` | ||
| - wasi-sdk | ||
| ```sh | ||
| curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz | ||
| tar xf wasi-sdk-12.0-linux.tar.gz | ||
| sudo mkdir -p /opt/wasi-sdk | ||
| sudo mv wasi-sdk-12.0/* /opt/wasi-sdk/ | ||
| ``` | ||
| - rust version - the rust version may need to be pinned due to the WASI spidermonkey version, the current version can be found at [main.yml](.github/workflows/main.yml) under "Install pinned Rust version and wasm32-wasi target" | ||
| ``` | ||
| rustup update 1.57.0 --no-self-update | ||
| rustup default 1.57.0 | ||
| ``` | ||
|
|
||
| Once that is done, the runtime and the CLI tool for applying it to JS source code can be built using cargo: | ||
| ```sh | ||
| cargo build --release | ||
| ``` | ||
|
|
||
| #### Build a windows executable | ||
| To build for windows on a linux system you need to install the following modules: | ||
|
|
||
| ``` | ||
| sudo apt-get install gcc-mingw-w64 | ||
| rustup target add x86_64-pc-windows-gnu | ||
| ``` | ||
|
|
||
| then you can run the following | ||
| ```sh | ||
| cargo build --target x86_64-pc-windows-gnu --release | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| The JS Compute Runtime doesn't currently contain automated tests itself. Instead, Fastly runs an automated test suite for an internal repository for the JavaScript SDK using the runtime. | ||
|
|
@@ -43,6 +93,20 @@ addEventListener('fetch', e => { | |
| console.log("Hello World!"); | ||
| }); | ||
| ``` | ||
| Create a fastly.toml file which is required for the application to run: | ||
| ```toml | ||
| # This file describes a Fastly Compute@Edge package. To learn more visit: | ||
| # https://developer.fastly.com/reference/fastly-toml/ | ||
|
|
||
| authors = ["[email protected]"] | ||
| description = "test service" | ||
| language = "javascript" | ||
| manifest_version = 2 | ||
| name = "test" | ||
| service_id = "" | ||
|
|
||
| ``` | ||
|
|
||
| into a C@E service with your build of the CLI tool, run the following command: | ||
| ```sh | ||
| cargo run --release -- test.js test.wasm | ||
|
|
@@ -52,3 +116,10 @@ Then test your service in Viceroy: | |
| ```sh | ||
| viceroy test.wasm | ||
| ``` | ||
|
|
||
| ## Testing a Dev Release | ||
| :warning: **You should not use this for production workloads!!!!!!!!** | ||
|
|
||
| Dev builds are released before production releases to allow for further testing. These are not released upstream to NPM, however you can acquire them from the [Releases](https://github.com/fastly/js-compute-runtime/releases/) section. Download the runtime for your platform, extract the executable and place it in the /node_modules/@fastly/js-compute/bin/PLATFORM folder of your Compute@Edge project. Then you can use the normal [Fastly CLI](https://github.com/fastly/cli) to build your service. | ||
|
|
||
| Please submit an [issue](https://github.com/fastly/js-compute-runtime/issues) if you find any problems during testing. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth pointing out that there's a
.debavailable for ubuntu/debian users?