CLI Client

Overview

What is SPS Client?

SPS Client is a command-line tool designed to allow you to easily interact with your Scalable Pixel Streaming servers and managed your applications and versions using commands, which makes it suitable for automation. The client currently supports the following commands:

  • config - allows you to manage the list of REST API servers registered inside the client
  • application - allows you to manage your applications on the registered servers, such as creating, deleting and updating them
  • version - allows you to manage your application versions and their configurations
  • quickdeploy - allows you quickly deploy an application and a version with minimal parameters required
  • capabilities - Displays the capabilities of the SPS client tool
  • completion - Generate the autocompletion script for the specified shell

Download

Download the latest version of the Scalable Pixel Streaming command-line client tool for your operating system and CPU architecture:

The client tool is a standalone command-line application that can be run from anywhere without needing to install any dependencies. You can simply download it and open a command prompt or terminal in the same directory to start using it.

Note that you will need to mark the downloaded binary as executable under Linux and macOS, due to security restrictions that prevent the accidental execution of downloaded files:

# Allow running the binary as an executable
chmod +x ./sps-client

If you want to avoid typing ./sps-client when running the tool under Linux and macOS then you can also move the binary to a directory from which it will be accessible system-wide:

# Move the sps-client executable from the current directory to /usr/local/bin
sudo mv ./sps-client /usr/local/bin/sps-client

Common Flags

Most commands will have mandatory flags to be correctly executed, as well as optional flags for additional configuration and parameters. As long as all mandatory flags are present, you can use as many optional flags in the same command as you like as long as they are not conflicting

The following flags are available for all commands:

  • -h, --help

These flags will return a brief description of a commands intended use, a use case example, and a full list of applicable subcommands and flags with their descriptions, for example:

sps-client config --help

The --dry-run flag

Every command that sends a request to the REST API supports dry-run flags -d and --dry-run that will display the JSON payload of the API request without actually executing it, for example:

sps-client application create --name <application-name> --dry-run

The REST API will return a JSON response containing which server we will be sending the payload to and the actual request payload, for example:

{
        "server": "sps",
        "method": "POST",
        "endpoint": "http://my-sps-server.com/api/v1/application",
        "request": {
                "cloudPlatformParameters": "",
                "hardware": [],
                "name": "myapp",
                "overProvisioning": {
                        "instances": 0,
                        "nodes": 0
                },
                "resources": {
                        "cpu": "",
                        "memory": ""
                },
                "signallingServer": {
                        "authPluginEndpoint": "",
                        "builtinPlugins": {
                                "authentication": {
                                        "authType": "noop",
                                        "maxReplicas": 10,
                                        "minReplicas": 1,
                                        "providers": [
                                                {
                                                        "name": "",
                                                        "oAuthConfig": {
                                                                "endpoint": {},
                                                                "scopes": []
                                                        }
                                                }
                                        ]
                                },
                                "instanceManager": {
                                        "customEndpoints": [],
                                        "maxReplicas": 10,
                                        "minReplicas": 1
                                }
                        },
                        "customDomainName": "",
                        "maxReplicas": 10,
                        "minReplicas": 1,
                        "peerConnectionOptions": ""
                }
        }
}

The --all-servers flag

Most commands support the optional --all-servers flag which will attempt to execute the command across all registered REST API servers.

sps-client application create --name myapp --all-servers

The REST API will return a JSON response containing two arrays, completed and failed, for example:

{
        "completed": [
                {
                        "server": "sps",
                        "method": "POST",
                        "endpoint": "http://my-sps-server.com/api/v1/application",
                        "statusCode": 200,
                        "status": "200 OK",
                        "response": {
                                "cloudPlatformParameters": "",
                                "hardware": null,
                                "name": "myapp",
                                "overProvisioning": {
                                        "instances": 0,
                                        "nodes": 0
                                },
                                "resources": {
                                        "cpu": null,
                                        "memory": null
                                },
                                "signallingServer": {
                                        "authPluginEndpoint": "",
                                        "builtinPlugins": {
                                                "authentication": {
                                                        "authType": "noop",
                                                        "maxReplicas": 10,
                                                        "minReplicas": 1,
                                                        "providers": []
                                                },
                                                "instanceManager": {
                                                        "customEndpoints": null,
                                                        "maxReplicas": 10,
                                                        "minReplicas": 1
                                                }
                                        },
                                        "customDomainName": "",
                                        "maxReplicas": 10,
                                        "minReplicas": 1,
                                        "peerConnectionOptions": "{\"iceServers\":[{\"urls\":[\"stun:stun.l.google.com:19302\"]}]}"
                                },
                                "timeCreated": "2023-08-14 03:41:05 +0000 UTC",
                                "timeLastUpdated": "2023-08-14 03:41:05 +0000 UTC"
                        }
                }
        ],
        "failed": [
                {
                        "server": "aws",
                        "method": "POST",
                        "endpoint": "http://this-server-does-not-exist.com/api/v1/application",
                        "response": "Post \"http://this-server-does-not-exist.com/api/v1/application\": dial tcp: lookup this-server-does-not-exist.com: no such host"
                }
        ]
}

The --server flag

Most commands support the optional --server flag accompanied with a particular server name to execute the command on the specified server, for example:

sps-client application create --name myapp --server <server-name>

The --config flag

Most commands support the optional --config flag which allows overriding the location that the configuration file is loaded from, for example:

sps-client application create --name myapp --config /path/to/myconfig.yaml