An open API service indexing awesome lists of open source software.

https://github.com/thorstenhans/demos-cli

Run tech demos of SSH
https://github.com/thorstenhans/demos-cli

conferences demo-or-die demos ssh

Last synced: 5 days ago
JSON representation

Run tech demos of SSH

Awesome Lists containing this project

README

          

# The `demos` CLI

> TL;DR: Don't let bad conference network nuke your demos. Instead offload network intense demos to a dedicated machine and execute them over SSH. Resulting in less data being transferred over the conference network.

## Installation

Download the `demos` binary from the recent [release page](https://github.com/ThorstenHans/demos-over-ssh/releases) and ensure it is executable (`chmod +x demos`). You can either execute the binary from the folder you've downloaded it to, or move it into your `PATH`.

## Available Sub Commands

The `demos` CLI provides the following sub commands:

- `set-config`: To set necessary configuration
- `get-config`: To get necessary configuration
- `initialize`: To generate a demos file (`%HOME/.demos/demos.json`)
- `validate`: To validate your demos
- `run`: To run particular demos (your demos will be added as sub command to `demos run` e.g., `demos run hello-world`)

## Configuration

The `demos` application requires two different sets of configuration data:

- Configuration for establishing an SSH connection to the "jump box"
- Your actual demos

### SSH Configuration

After you've downloaded the `demos` executable run the `demos set-config` command. It'will prompt for your SSH configuration data. You must provide:

- IPv4 address of the jump box
- Desired SSH Port (default `22`)
- SSH user name
- Password for the SSH user

Configuration data is encrypted at REST and stored in your user profile (`$HOME/.demos/demos.config`).

### Configuring Demos

The `demos` app comes with a sample demo backed in... However, you want to provide your own demos (obviously). To give you a head start, you can use the `demos initialize` command, which will create the `$HOME/.demos/demos.json` file for you. You can add as many demos to the JSON array as you want. Here some additional information for specifying your demos:

- A demo can consist of an unlimited number of steps.
- A demo step must have a `kind` specified.
- `kind` must be one of (
- code (`1`)
- sleep (`2`)
- text (`0`)
- Steps of kind `text` are printed locally directly to `stdout`
- Steps of kind `sleep` are executed locally
- Commands of kind `sleep` must be valid `int` values (validate by the CLI) at runtime, provided value is interpreted as seconds
- Every code step is executed over SSH in a dedicated session and it's output is forwarded to the local `stdout`
- A demo must have a `name`, a `cliCommand`, an `alias` and a `description`
- `cliCommand` and `alias` have unique constraints which are enforced when loading the demos into the binary at runtime

```jsonc
[
{
"name": "Sample Load Test",
"cliCommand": "load-test",
"alias": "lt",
"description": "Run the sample load test",
"steps": [
{
"command": "We'll sent 100 requests to Google now",
// text
"kind": 0
},
{
"command": "which hey",
// code
"kind": 1
},
{
"command": "6",
// sleep
"kind": 2
},
{
"command": "hey -c 10 -n 100 https://www.google.com",
// code
"kind": 1
},
{
"command": "100 requests sent!",
// text
"kind": 0
}
]
}
]

```

## Dynamic CLI Commands

For each demo provided, a new sub-command is added under `demos run` using the specified `cliCommand` as command name and setting the provided `alias` as command alias.

Taking the previously shown `demos.json` into context, you will end up with the following commands available as part of the `demos` CLI:

```bash
# default command name
demos run load-test

# command alias
demos run lt
```

## Printing your Demos

As demos are automatically hooked up into the CLI, you can simply execute `demos run` to get a list of all commands (demos) that could be executed.