Getting Started

The open web service WASM Runner enables you to run your WebAssembly application in Eyevinn Open Source Cloud as a server less application. Develop your high performance application, compile to WebAssembly and make it instantly available.

Prerequisites

Step 1: Create a Hello World application

Create a sample application (example in Rust) that just prints "Hello, world!":

fn main() {
  println!("Hello, world!");
}

Save this to a file called main.rs and then compile it to WebAssembly (WASM):

% rustup target add wasm32-wasip1
% rustc main.rs --target wasm32-wasip1

Now you have a file called main.wasm.

Step 2: Upload the file to a bucket

Next step is to make the file main.wasm available for download. In this tutorial we will create a bucket on a MinIO service where we will upload the file. Read the MinIO tutorial for a guide on how to create a bucket.

In this example we have uploaded the file to a bucket and it is accessible on the address https://eyevinnlab-birme.minio-minio.auto.prod.osaas.io/code/main.wasm.

Step 3: Create WASM runner

It is now time to create your WASM runner. Navigate to the WASM runner service in the Eyevinn Open Source Cloud web console. Click on the button "Create wasm-runner".

Skärmavbild 2025-06-04 kl  00 40 48

Instance Settings

Field Description Example Value
Name The name of your WASM Runner instance. guide
WasmUrl The URL to your WASM code. https://eyevinnlab-birme.minio-minio.auto.prod.osaas.io/code/main.wasm
OscAccessToken (Optional) Access token required if the Web Runner needs to interact with other Eyevinn OSC services.
ConfigService (Optional) The name of your Application Config Service instance used to configure the app.

When setting up your instance, you are also able to enter OscAccessToken and ConfigService - these are both optional parameters. OscAccessToken is a personal access token you need to set if the code you want to run in your WASM Runner interacts with other Eyevinn Open Source Cloud services. If you wish to set the OscAccessToken, you can locate it in your user settings in Eyevinn Open Source Cloud, under the "API" tab.

442736212-499bcf8c-577c-4248-8ec1-b1c29458c71b

If you have created an instance of the Application Config Service and wish to use it to provide configuration for the application in your WASM Runner, enter the name you gave the Config Service instance when creating it into the ConfigService field when creating your WASM Runner. This is the same way as you configure a Web Runner instance.

When you have entered the settings you want for your WASM Runner instance, press "Create", and you will soon have an instance of your application running.

To access the application click on the instance card or copy the URL and use for example curl to test your application. In this example we can run on the command line.

% curl https://eyevinnlab-guide.eyevinn-wasm-runner.auto.prod.osaas.io
Hello, world!

Echo application

This example shows how you can send data to the WASM application. We will develop a simple application that echo what is on STDIN to STDOUT. Create a file called echo.rs

use std::io::{self, BufRead, BufReader};

fn main() {
  let stdin = io::stdin();
  let reader = BufReader::new(stdin.lock());

  for line in reader.lines() {
    match line {
      Ok(content) => println!("{}", content),
      Err(e) => eprintln!("Error reading input: {}", e),
    }
  }
}

Compile and upload the WASM file to the bucket.

% rustc echo.rs --target wasm32-wasip1

Create a WASM runner with the URL to this WASM file.

Now we can do an HTTP POST to the runner and what we send in the body will be received on STDIN by the application and it will write the same thing on STDOUT and return to us.

% curl -X POST -H 'Content-Type: text/plain' -d 'Hello' https://eyevinnlab-echo.eyevinn-wasm-runner.auto.prod.osaas.io
Hello

Continuous integration (CI) workflow

You can create a continuous integration (CI) workflow to build and deploy your application as a serverless WASM runner with GitHub workflows and Open Source Cloud.

As an example we will create a GitHub workflow for this sample application that will build and deploy when code is pushed to main branch.

name: Deploy on push to main
on:
  push:
    branches:
      - main

Then we add a job for building and deploying the WASM code. First we checkout the code, install the WebAssembly target and compile the code to WASM.

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Install target for WebAssembly
        run: rustup target add wasm32-wasip1
      - name: Build WebAssembly
        run: rustc main.rs --target wasm32-wasip1

Then upload the WASM code to a bucket.

      - name: Upload WebAssembly artifact to bucket
        run: |
          aws s3 cp --endpoint-url https://eyevinnlab-birme.minio-minio.auto.prod.osaas.io main.wasm s3://artifacts/main.wasm
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

And final step is to deploy the code to a WASM Runner. We cannot update an existing WASM Runner instance so we need to first remove existing one and create a new one. We are using the OSC command line tool for this.

      - name: Deploy as WASM runner in Open Source Cloud
        run: |
          npx -y @osaas/cli remove eyevinn-wasm-runner ghdemo -y || true
          npx -y @osaas/cli create eyevinn-wasm-runner ghdemo -o WasmUrl=https://artifacts.osaas.io/artifacts/main.wasm
        env:
          OSC_ACCESS_TOKEN: ${{ secrets.OSC_ACCESS_TOKEN }}

We provide the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and OSC_ACCESS_TOKEN stored as secrets in GitHub repository.

Skärmavbild 2025-06-04 kl  14 29 28

Full example is available in this GitHub repository.

We can verify that this WASM runner is up and running in the Eyevinn Open Source Cloud web console.

Skärmavbild 2025-06-04 kl  14 31 08