Skip to content

Service: Web Runner

Jonas Birmé edited this page Feb 19, 2025 · 6 revisions

Getting Started

The open web service Web Runner enables you to run custom code in Eyevinn Open Source Cloud and a way to glue other open web services together. Orchestrate media workflows, provide custom webhooks or deploy a custom web application online, and much more. Deploy your Node application from your public or private GitHub repository and make it instantly available. This tutorial walks you through how to get started deploying your web application with Eyevinn Open Source Cloud.

Prerequisites

  • If you have not already done so, sign up for an OSC account.

Step 1: Create a GitHub personal access token

For access to you your GitHub repository you need to create a GitHub Personal Access Token first.

  1. Verify your email address, if it hasn't been verified yet.
  2. In the upper-right corner of any page on GitHub, click your profile photo, then click Settings.
  3. In the left sidebar, click Developer settings.
  4. In the left sidebar, under Personal access tokens, click Tokens (classic).
  5. Select Generate new token, then click Generate new token (classic).
  6. In the "Note" field, give your token a descriptive name.
  7. To give your token an expiration, select Expiration, then choose a default option or click Custom to enter a date.
  8. Select the scopes you'd like to grant this token. To use your token to access repositories from the command line, select repo. A token with no assigned scopes can only access public information. For more information, see Scopes for OAuth apps.
  9. Click Generate token and copy it to the clipboard.

Step 2: Store token as a Service Secret

Now navigate to the Web Runner service in Eyevinn Open Source Cloud web console. Click on the tab "Service Secrets" and click on the button "New Secret". Give the secret a name and paste the GitHub token from your clipboard.

Skärmavbild 2025-01-20 kl  17 13 14

Step 3: Create web runner

It is now time to launch an instance of your web application. Click on the tab "My web-runners" and then on the button "Create web-runner". Enter the GitHub URL for your application code and enter a reference to the secret you created in step 2.

orchestrator

Press create and you should now after a few minutes have an instance of your application ready.

Now you have deployed an instance of your application that is running. This example will listen on file events on a MinIO bucket and create a VOD transcoding job when a new file is created.

Configuring your application

To provide configuration to your application you can use the Application Config open web service. With this service you can manage configuration values and get the configuration values through the API it provides.

Skärmavbild 2025-02-19 kl  10 52 35

Provided as Environment Variables

appconfig_webrunner

When the Web Runner starts it will lookup an Application Config Service instance with the config service name provided when creating the web runner instance. If it is found it will load the configuration values as environment variables. In the example above it will add the following environment variables:

AWS_ACCESS_KEY_ID=admin
CHANNELURL=https://eyevinnlab.ce.prod.osaas.io/channels/mychannel/master.m3u8

These are now available in your application code process.env.CHANNELURL.

Manually fetch config value

To manually fetch a configuration during run time it can be done by access the config service API. Example code below to obtain the URL to a stream that is stored in the config value channelurl provided by the Application Config instance called tvappconfig.

mport { Context } from "@osaas/client-core";
import { getEyevinnAppConfigSvcInstance } from "@osaas/client-services";

let configUrl: string | undefined = undefined;

export async function getChannelUrl() {
  const ctx = new Context();
  if (!configUrl) {
    const configService = await getEyevinnAppConfigSvcInstance(ctx, 'tvappconfig');
    configUrl = configService.url;
  }
  const response = await fetch(new URL('/api/v1/config/channelurl', configUrl), {
    cache: 'no-store'
  });
  if (response.ok) {
    const data = await response.json();
    return data.value;
  }
  return undefined;
}
Clone this wiki locally