Skip to content

Commit 68e7802

Browse files
authored
Updating the readme doc (#70)
Updating to add additional steps for building as well as options for testing dev releases.
1 parent b174d37 commit 68e7802

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

README.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The JS Compute Runtime for Fastly's [Compute@Edge platform](https://www.fastly.c
88

99
Note that this repository uses Git submodules, so you will need to run
1010

11-
```
11+
```sh
1212
git submodule update --recursive --init
1313
```
1414

@@ -21,13 +21,63 @@ To build from source, you need to ensure that the headers and object files for t
2121
(cd c-dependencies/spidermonkey && sh download-engine.sh)
2222
```
2323

24+
2425
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.
2526

27+
In additon you need to have the following tools installed to successfully build, and build from a linux based system.
28+
29+
- Rust
30+
```
31+
curl -so rust.sh https://sh.rustup.rs && sh rust.sh -y
32+
restart shell or run source $HOME/.cargo/env
33+
```
34+
- Build tools
35+
```sh
36+
sudo apt install build-essential
37+
```
38+
- binaryen
39+
```sh
40+
sudo apt install binaryen
41+
```
42+
- rust target wasm32-wasi
43+
```sh
44+
rustup target add wasm32-wasi
45+
```
46+
- cbindgen
47+
```sh
48+
cargo install cbindgen
49+
```
50+
- wasi-sdk
51+
```sh
52+
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz
53+
tar xf wasi-sdk-12.0-linux.tar.gz
54+
sudo mkdir -p /opt/wasi-sdk
55+
sudo mv wasi-sdk-12.0/* /opt/wasi-sdk/
56+
```
57+
- 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"
58+
```
59+
rustup update 1.57.0 --no-self-update
60+
rustup default 1.57.0
61+
```
62+
2663
Once that is done, the runtime and the CLI tool for applying it to JS source code can be built using cargo:
2764
```sh
2865
cargo build --release
2966
```
3067

68+
#### Build a windows executable
69+
To build for windows on a linux system you need to install the following modules:
70+
71+
```
72+
sudo apt-get install gcc-mingw-w64
73+
rustup target add x86_64-pc-windows-gnu
74+
```
75+
76+
then you can run the following
77+
```sh
78+
cargo build --target x86_64-pc-windows-gnu --release
79+
```
80+
3181
## Testing
3282

3383
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 => {
4393
console.log("Hello World!");
4494
});
4595
```
96+
Create a fastly.toml file which is required for the application to run:
97+
```toml
98+
# This file describes a Fastly Compute@Edge package. To learn more visit:
99+
# https://developer.fastly.com/reference/fastly-toml/
100+
101+
authors = ["[email protected]"]
102+
description = "test service"
103+
language = "javascript"
104+
manifest_version = 2
105+
name = "test"
106+
service_id = ""
107+
108+
```
109+
46110
into a C@E service with your build of the CLI tool, run the following command:
47111
```sh
48112
cargo run --release -- test.js test.wasm
@@ -52,3 +116,10 @@ Then test your service in Viceroy:
52116
```sh
53117
viceroy test.wasm
54118
```
119+
120+
## Testing a Dev Release
121+
:warning: **You should not use this for production workloads!!!!!!!!**
122+
123+
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.
124+
125+
Please submit an [issue](https://github.com/fastly/js-compute-runtime/issues) if you find any problems during testing.

0 commit comments

Comments
 (0)