User Guide: OSC CLI - EyevinnOSC/community GitHub Wiki

OSC CLI

Eyevinn OSC Command Line Interface (OSC CLI) is a tool to manage your open web services. With this tool you can create and remove open web service instances from the command line and automate through scripts.

How it works

The OSC Command Line Interface (OSC CLI) is an open source tool that enables you to interact with open web services using commands in your command-line shell. With minimal configuration, the OSC CLI enables you to run commands that implement functionality equivalent to that provided by the browser-based OSC console from the command prompt in your terminal program.

Getting Started

A prerequisite is that you have an account at Eyevinn Open Source Cloud. If not you can create an account here by only entering your email.

Step 1: Install OSC CLI

The OSC CLI is a NodeJS script so you need to first download and install NodeJS unless you already have it installed. Follow the instructions described on the download and installation page for NodeJS.

Open a command-line shell and run the following command to install it using the Node Package Manager (npm):

% sudo npm install -g @osaas/cli

Verify that it is correctly installed:

% osc -v
4.7.0

For a list of available commands and options you run:

% osc help
Usage: osc [options] [command]

Options:
  -v, --version                        Output the current version
  --env <environment>                  Environment to use
  -h, --help    
...

Step 2: Configure the OSC CLI

Before you can do anything you need to provide the CLI with your personal access token (PAT) through an environment variable. To obtain the PAT you go to the OSC web console and click on the menu item "Settings" down to the left. Then click on the tab "{ } API" and copy the personal access token to the clipboard. Set this value in the environment variable OSC_ACCESS_TOKEN:

Linux or MacOS:

% export OSC_ACCESS_TOKEN=<PAT>

Step 3: Create an open web service instance

We can now for example create a new open web service instance of a MariaDB database using the create command. The linuxserver-docker-mariadb is the service id for the MariaDB open web service.

% osc create linuxserver-docker-mariadb mydb -o RootPassword=demo

You can then verify that the instance has been created with the list command

% osc list linuxserver-docker-mariadb
mydb

To describe the details of an instance you use the describe command

% osc describe linuxserver-docker-mariadb mydb
name: mydb
url: https://eyevinnlab-mydb.linuxserver-docker-mariadb.auto.prod.osaas.io
RootPassword: demo
Database: undefined
User: undefined
Password: undefined

Step 4: Remove an open web service instance

To remove the instance we just created you use the remove command

% osc remove linuxserver-docker-mariadb mydb
Are you sure you want to remove mydb? (yes/no) yes
Instance removed

Command Reference

create

Create a new instance of an open web service.

% osc create eyevinn-test-adserver myadserver

describe

Get details for an instance of an open web service.

% osc describe encore demo
name: demo
url: https://eyevinnlab-demo.encore.prod.osaas.io/
profilesUrl: 
s3AccessKeyId: 
s3SecretAccessKey: 
s3SessionToken: 
s3Region: 
s3Endpoint: 

list

List all running instances of an open web service

% osc list encore
demo

logs

Obtain the logs for an open web service instance.

% osc logs eyevinn-ad-normalizer demo
2025-01-23T14:49:56.640Z [info] : starting server 
2025-01-23T14:49:56.653Z [info] : Service access token provided. You should be able to access the API. 
2025-01-23T14:49:56.654Z [info] : Connecting to Redis {"url":"redis://172.232.131.169:10513"}
2025-01-23T14:49:56.807Z [info] : Server listening on http://0.0.0.0:8080

remove

Remove an instance of an open web service

% osc remove eyevinn-test-adserver myadserver
Are you sure you want to remove myadserver? (yes/no) yes
Instance removed

service-access-token

Get a service access token for a service for accessing a service instance via HTTP API.

% osc service-access-token encore
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV...

For example listing all Encore jobs through the API:

curl -v -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV...' https://eyevinnlab-demo.encore.prod.osaas.io/encoreJobs
⚠️ **GitHub.com Fallback** ⚠️