Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: nyagamunene <[email protected]>
  • Loading branch information
nyagamunene committed Dec 20, 2024
1 parent d7b5371 commit 39a31de
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
Binary file added docs/diagrams/Proxy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,21 @@ export PROPLET_THING_KEY=""
propeller-proplet
```

## Start the proxy

To start the proxy, run the following command

```bash
export PROXY_REGISTRY_URL=""
export PROXY_AUTHENTICATE="TRUE"
export PROXY_REGISTRY_USERNAME=""
export PROXY_REGISTRY_PASSWORD=""
export PROPLET_CHANNEL_ID=""
export PROPLET_THING_ID=""
export PROPLET_THING_KEY=""
propeller-proxy
```

## Postman Colletion

This is a [collection](./api/postman_collection.json) of the API calls that can be used to interact with the Propeller system.
Expand Down Expand Up @@ -278,3 +293,15 @@ curl -X POST "http://localhost:7070/tasks/e5bcc74e-9af3-4f09-b663-44dc260ab809/s
```bash
curl -X POST "http://localhost:7070/tasks/e5bcc74e-9af3-4f09-b663-44dc260ab809/stop"
```

### Creating Tasks from OCI Registry Images

For WebAssembly modules stored in an OCI registry, you can specify the image URL during task creation. The proxy will automatically retrieve the WASM file from the registry when the task starts, eliminating the need for manual file uploads.

```bash
curl -X POST "http://localhost:7070/tasks" \
-H "Content-Type: application/json" \
-d '{"name": "add", "inputs": [10, 20], "image_url": "docker.io/mrstevenyaga/add.wasm"}'
```

The proxy will handle pulling the image from the specified OCI registry during task execution, streamlining the deployment process.
38 changes: 20 additions & 18 deletions docs/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The proxy service performs two main functions:

The proxy service facilitates the download of WebAssembly (WASM) containers through a multi-step process:

![Proxy Service Architecture](diagrams/Proxy.png)

1. **Initial Request**
The proplet sends a download request via the MQTT topic: `channels/%s/messages/registry/proplet`
This request is received by the proxy service's MQTT subscriber
Expand Down Expand Up @@ -67,39 +69,39 @@ The service is configured using environment variables.

#### MQTT Configuration

| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `PROXY_MQTT_ADDRESS` | URL of the MQTT broker | `tcp://localhost:1883` | Yes |
| `PROXY_PROPLET_ID` | Unique identifier for the proplet | `""` | Yes |
| `PROXY_CHANNEL_ID` | Channel identifier for MQTT communication | `""` | Yes |
| `PROXY_PROPLET_KEY` | Password for MQTT authentication | `""` | Yes |
| Variable | Description | Default | Required |
|-------------------------|---------------------------------------|------------------------|-----------------------------------|
| `PROPLET_MQTT_ADDRESS` | URL of the MQTT broker | `tcp://localhost:1883` | Yes |
| `PROPLET_THING_ID` | Unique identifier for the proplet | `""` | Yes |
| `PROPLET_CHANNEL_ID` | Channel identifier for MQTT | `""` | Yes |
| `PROPLET_THING_KEY` | Password for MQTT authentication | `""` | Yes |

#### Registry Configuration

| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `PROXY_REGISTRY_URL` | URL of the HTTP registry | `""` | Yes |
| `PROXY_AUTHENTICATE` | Enable/disable registry authentication | `false` | No |
| `PROXY_REGISTRY_USERNAME` | Username for registry authentication | `""` | Only if `PROXY_AUTHENTICATE=true` |
| `PROXY_REGISTRY_PASSWORD` | Password for registry authentication | `""` | Only if `PROXY_AUTHENTICATE=true` |
| `PROXY_REGISTRY_TOKEN` | Access token for registry authentication | `""` | Alternative to username/password |
| `PROXY_CHUNK_SIZE` | Size of data chunks in bytes | `512000` | No |
| Variable | Description | Default | Required |
|-------------------------|---------------------------------------|------------------------|-----------------------------------|
| `PROXY_REGISTRY_URL` | URL of the HTTP registry | `""` | Yes |
| `PROXY_AUTHENTICATE` | Enable/disable registry auth | `false` | No |
| `PROXY_REGISTRY_USERNAME`| Username for registry auth | `""` | Only if `PROXY_AUTHENTICATE=true` |
| `PROXY_REGISTRY_PASSWORD`| Password for registry auth | `""` | Only if `PROXY_AUTHENTICATE=true` |
| `PROXY_REGISTRY_TOKEN` | Access token for registry auth | `""` | Alternative to username/password |
| `PROXY_CHUNK_SIZE` | Size of data chunks in bytes | `512000` | No |

### Example Configuration

Export the required environment variables in your terminal:

```bash
# Registry Configuration
export PROXY_REGISTRY_URL="docker.io"
export PROXY_REGISTRY_URL="<registry_url>"
export PROXY_AUTHENTICATE="TRUE"
export PROXY_REGISTRY_USERNAME="<your_docker_username>"
export PROXY_REGISTRY_PASSWORD="<your_docker_password>"

# MQTT Configuration
export PROXY_PROPLET_KEY="3ff93a13-c8ff-4d17-819b-45497e0d69d7"
export PROXY_PROPLET_ID="df61852a-5796-415b-a675-e63fa4aa9923"
export PROXY_CHANNEL_ID="aca3543e-91a4-44cd-885d-751fd0a326de"
export PROPLET_THING_KEY="<secret>"
export PROPLET_THING_ID="<proplet_id>"
export PROPLET_CHANNEL_ID="<channel_id>"
```

## Running the Service
Expand Down

0 comments on commit 39a31de

Please sign in to comment.