Skip to content

Commit

Permalink
Merge pull request #13 from faast-rt/feat/docs-reference
Browse files Browse the repository at this point in the history
docs: add post /run route documentation
  • Loading branch information
alexis-ascoz authored Dec 13, 2023
2 parents 5c652b3 + e39f026 commit f565da1
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 0 deletions.
1 change: 1 addition & 0 deletions pages/docs/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"index": "Introduction",
"getting-started": "Getting Started",
"user-guide": "User Guide",
"reference": "Reference",
"advanced": "Advanced"
}
4 changes: 4 additions & 0 deletions pages/docs/reference/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"api-rest": "API REST",
"configuration": "Configuration"
}
3 changes: 3 additions & 0 deletions pages/docs/reference/api-rest/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"post-run": "POST /run"
}
59 changes: 59 additions & 0 deletions pages/docs/reference/api-rest/post-run.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: 'POST /run'
description: 'Documentation for the POST /run API endpoint in Faast.'
---

import { Callout } from 'nextra/components';

# POST /run

This section provides documentation for the `POST /run` API endpoint in Faast.

## Request Body

The request body for the `POST /run` API endpoint should be a JSON object with
the following fields:

- `language` (String): The name of the programming language.
- `version` (String): The version of the language runtime.
- `input` (String): The input data for code execution (stdin).
- `code` (Array of FileModel): An array of code files required for execution.
Each `FileModel` object in the array should have the following fields:

- `filename` (String): The name of the file.
- `content` (String): The content of the file.

Here is an example request body for an API call that executes a Node.js program:

```json copy filename="request.json"
{
"language": "NODE",
"version": "12",
"input": "",
"code": [
{
"filename": "main.js",
"content": "console.log('Hello, World!');"
}
]
}
```

## Response Body

The response body for the `POST /run` API endpoint represents the execution
result. It is a JSON object with the following fields:

- `status` (Integer): The exit status code of the code execution.
- `stdout` (String): The standard output of the code execution.
- `stderr` (String): The standard error output of the code execution.

Here is an example response body:

```json
{
"status": 0,
"stdout": "Hello, World!\n",
"stderr": ""
}
```
132 changes: 132 additions & 0 deletions pages/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
title: 'Configuration Reference'
description: 'Reference guide for configuring Faast.'
---

import { Callout } from 'nextra/components';

# Configuration Reference

This reference guide provides details on configuring Faast for all parameters.

## API Configuration

Here is an example of the API configuration:

```yaml copy filename="config.yaml"
apiVersion: lambdo.io/v1alpha1
kind: Config
api:
web_host: 0.0.0.0
web_port: 3000
grpc_host: 0.0.0.0
gprc_port: 50051
bridge: lambdo0
ip: 10.0.50.0/8
```
### API Server
The API server configuration includes:
- **`web_host`**: The interface on which the API server will listen
> Example: `0.0.0.0` (all interfaces)
- **`web_port`**: The port on which the API server will listen
> Example: `3000`

### gRPC Server

The gRPC server configuration includes:

- **`grpc_host`**: The interface on which the gRPC server will listen
> Example: `0.0.0.0` (all interfaces)
- **`gprc_port`**: The port on which the gRPC server will listen
> Example: `50051`

### Bridge Configuration

The bridge configuration includes:

- **`bridge`**: The name of the bridge
> Example: `lambdo0`
- **`ip`**: The IP address of the bridge
> Example: `10.0.50.0/8`

## VMM Configuration (Virtual Machine Monitor)

Here is an example of the VMM configuration:

```yaml copy filename="config.yaml"
apiVersion: lambdo.io/v1alpha1
kind: Config
vmm:
kernel: /var/lib/lambdo/kernel/vmlinux.bin
```

The VMM configuration includes:

- **`kernel`**: The path to the Linux kernel binary utilized by the VMM
> Example: `/var/lib/lambdo/kernel/vmlinux.bin`

## Agent Configuration

<Callout type="warning">
The agent configuration is not implemented yet.
</Callout>

Here is an example of the agent configuration:

```yaml copy filename="config.yaml"
apiVersion: lambdo.io/v1alpha1
kind: Config
agent: # NOT IMPLEMENTED
path: /usr/local/bin/lambdo-agent
config: /etc/lambdo/agent.yaml
```

The agent configuration includes:

- **`path`**: The path to the agent binary
> Example: `/usr/local/bin/lambdo-agent`
- **`config`**: The path to the agent configuration file
> Example: `/etc/lambdo/agent.yaml`

## Language Runtime Configuration

Here is an example of the language runtime configuration:

```yaml copy filename="config.yaml"
apiVersion: lambdo.io/v1alpha1
kind: Config
languages:
- name: NODE
version: 12
initramfs: /var/lib/lambdo/initramfs/node-12.img
steps:
- name: Run the code
command: /usr/local/bin/node {{filename}}
output:
enabled: true
debug: false
```

The configuration for a Node.js runtime includes:

- **`name`**: The name of the runtime
> Example: `NODE`
- **`version`**: The version of the runtime
> Example: `12`
- **`initramfs`**: The path to the initramfs for the runtime
> Example: `/var/lib/lambdo/initramfs/node-12.img`
- **`steps`**: The steps to run the code. Each step includes the following
parameters:
- **`name`**: The name of the step
> Example: `Run the code`
- **`command`**: The command to run for the step
> Example: `/usr/local/bin/node {{filename}}`
- **`output`**: The output configuration for the step. This includes the
following parameters:
- **`enabled`**: Whether to enable the output
> Example: `true`
- **`debug`**: Whether to enable debug output (useful for build steps)
> Example: `false`

0 comments on commit f565da1

Please sign in to comment.