Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 20 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,50 @@

**Alpha** is a little agent written in **Go** responsible for running function code on the host where it runs.

Currently, Alpha exposes only two HTTP endpoints on the port 3000 :
- `POST http://localhost:3000` : Invoke a function, see the [development](#development) section.
- `GET http://localhost:3000/healthz` : Get the health status of the agent.
Currently, Alpha exposes only two HTTP endpoints on the port 8080 :
- `POST http://localhost:8080` : Call the function, see the [development](#development) section.
- `GET http://localhost:8080/_/health` : Get the health status of the agent.

## State

The project is a mainly a PoC for now. We will need to refactor some things and add tests to ensure it works as expected. Don't hesitate to open issues or PR to fix / add features.

## Runtimes

Alpha has a support only the following runtimes for now :

- NodeJS (`node`)
- Python (`python`)

## Development

**Alpha was written using **Go 1.19**. We recommend you to install at least **Go 1.19** in order to be able to develop the project.** You need to have at least Node.JS installed locally.

Start the agent :

```bash
# You have to define the process to run when the agent starts. You can do it by setting the `ALPHA_INVOKE` environment variable. For example:
export ALPHA_INVOKE="node /tmp/index.js"

go run main.go

# You should see a similar output (your version of node can be different) :
INFO[0000] Runtime initialized runtime=node version=v19.4.0
INFO[0000] Executor ready. 1 runtime(s) available for this agent
INFO[0000] HTTP API Server is listening on 0.0.0.0:3000
INFO[0000] invoke : /usr/bin/node /tmp/index.js
Node v18.12.1 is listening on 0.0.0.0:3000

```

Alpha is now listening on the port 8080 and will forward http calls to port 3000.

Execute a function without variables through the agent :

```bash
curl -XPOST http://localhost:3000 -d '
{
"runtime": "node",
"code": "https://gitlab.com/N4rkos/js-lambda-showcase/-/archive/main/js-lambda-showcase-main.tar.gz"
}'

# You should have something like this (the animal name is random at each execution) :
{
"output": "{ message: 'Hello world !', animalName: 'Carnivorous Stinkbug' }\n",
"process_exit_code": 0
}
curl -XPOST http://localhost:8080

# You should receive the response from the function :
My first function !

# You can see the logs from the function in the agent's logs :
Random animal name : Curious Seahorse

```

Execute a function with variables through the agent :

```bash
curl -XPOST http://localhost:3000?name=Alpha -d '
{
"runtime": "node",
"code": "https://gitlab.com/N4rkos/js-lambda-showcase/-/archive/main/js-lambda-showcase-main.tar.gz"
}'

# You should have something like this (the animal name is random at each execution) :
{
"output": "{ message: 'Hello Alpha !', animalName: 'Carnivorous Stinkbug' }\n",
"process_exit_code": 0
}
```
WIP

The example function code can be found [here](https://gitlab.com/N4rkos/js-lambda-showcase).


49 changes: 0 additions & 49 deletions internal/api/http/handler.go

This file was deleted.

16 changes: 0 additions & 16 deletions internal/api/http/health.go

This file was deleted.

71 changes: 0 additions & 71 deletions internal/api/http/http.go

This file was deleted.

35 changes: 0 additions & 35 deletions internal/api/types.go

This file was deleted.

Loading