-
Notifications
You must be signed in to change notification settings - Fork 0
Service: Web Runner
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.
- If you have not already done so, sign up for an OSC account.
For access to you your GitHub repository you need to create a GitHub Personal Access Token first.
- Verify your email address, if it hasn't been verified yet.
- In the upper-right corner of any page on GitHub, click your profile photo, then click Settings.
- In the left sidebar, click Developer settings.
- In the left sidebar, under Personal access tokens, click Tokens (classic).
- Select Generate new token, then click Generate new token (classic).
- In the "Note" field, give your token a descriptive name.
- To give your token an expiration, select Expiration, then choose a default option or click Custom to enter a date.
- 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.
- Click Generate token and copy it to the clipboard.
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.
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.

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.
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.

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
.
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;
}