-
Notifications
You must be signed in to change notification settings - Fork 0
1. Start Here
-
Laptop or Computer (Mac/Linux/Windows) π»
-
Internet access π
-
Practical working knowledge of a programming language, preferably one of the supported SDK languages listed below. πππ
-
Git https://git-scm.com/book/en/v2/Getting-Started-Installing-Git πππ
-
Your preferred development language tooling π»π*οΈβ£
- Fastly currently supports the following languages with SDKs:
- JavaScript / NodeJS https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
- Compiling JavaScript applications for Compute requires a recent version of Node.js (>= 16.6). Before building the app, you also need to be able to install dependencies using the npm package manager or an alternative.
- Compiling Rust applications for Compute requires that you have rustup installed, along with Rust's stable channel and the wasm32-wasi toolchain. Install Rust and its dependencies using rustup so you can begin building Compute services. More detailed steps can be found at https://developer.fastly.com/learning/compute/#install-language-tooling under the "Rust" section.
- Compiling Go applications for Compute requires Go 1.21 or higher.
- Compiling TinyGo applications for Compute requires TinyGo 0.26.0 or higher.
- You may also choose to use another language if you are prepared and able to compile your code to a WASM binary (This will be much more work and possibly too time-consuming during this workshop.)
-
Your IDE (Visual Studio Code) or code editor (VIM ftw!) β
-
(Mac only - this step is not required for Windows or Linux) Homebrew https://brew.sh/ (There are pre-built binaries for Linux/Windows.) π
-
Install the Fastly CLI. π
Fastly's CLI "fastly" is an open-source command line tool for interacting with the Fastly API. Use it to create services, manage backends and domains, upload VCL or build and deploy Compute packages. Convenient access to Fastly from where you are working with your code, or from your CI environment https://developer.fastly.com/learning/tools/cli/#installing
- Check the installation π οΈ
$ fastly version
- Create a new empty directory for your project and go into it
mkdir stardust && cd stardust
(or the equivalent in your OS)
In this case we are naming the project "stardust" but feel free to use a name of your choice.
- Initialise a project
$ fastly compute init
Follow the instructions in the prompts.
- If you are using JavaScript, you should say yes to run
npm install
. - I am using the project name "stardust".
- Locally run and test
$ fastly compute serve
- You will see a warning about no backends defined, just ignore that for now.
Visit the URL provided in the output. It should look like this "http://127.0.0.1:7676". If everything works as expected you should see this in the terminal:
In your browser you should see this:
If you are only developing locally for now, this step is OPTIONAL, and you can go to the next step. Return here once you are ready to push to the Fastly platform.
Use a token supplied to you in the Workshop, or create a new Fastly API User Token https://docs.fastly.com/en/guides/using-api-tokens (not an Automation token for now).
2. Set up your credentials in the Fastly CLI. This is optional until you reach the publish or deploy step and want to push your code to Fastly. For this, you will need your API Token from the previous step.
$ fastly profile create
Note: if you did create an automation token in the previous step instead of a user token, you will need to supply the "--automation-token" flag. This is NOT required for a user token.
$ fastly profile create --automation-token
Follow the prompts to publish your compute service to Fastly.
$ fastly compute publish
Once the code has been pushed to the Fastly platform, the output log will provide a URL to your new service.
Once you are ready, please go to https://github.com/mandyscott/EdgeComputeWorkshop/wiki/2.-Edge-Compute-Workshop