Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Latest commit

 

History

History

vrl-web-server-warp

The VRL Web server

The VRL Web server is a Rust web server created using the Warp framework. It's essentially a thin HTTP layer over Vector Remap Language logic found in the main Vector repo, specifically the vrl libraries.

The server is deployed as a Docker image on the Fly PaaS platform. The current web address of the server is https://vrl-server.fly.dev.

Running locally

cargo run

CLI options

The default HTTP port is 8080. You can specify a different port using the -p or --port flag or the PORT environment variable.

Deploying

The server is deployed as a Docker image running on Fly. To build and push the image:

make docker-build && make docker-push

This currently uses the lucperkins org on Docker Hub but we will update this to the vectordotdev org later on.

API

The VRL Web server's API is described in OpenAPI format in openapi.yaml. Below are some example API calls (using HTTPie).

Get VRL function info

http :8080/functions

Resolve an event/program

http post :8080/resolve program='.id = uuid_v4(); .timestamp = now()' event:='{"message":"success"}'

Example result:

{
  "success": {
    "output": "2021-11-19T15:56:54.908681Z",
    "result": {
      "id": "b2d63616-a0b1-4943-aed8-d6be509371e9",
      "message": "success",
      "timestamp": "2021-11-19T15:56:54.908681Z"
    }
  }
}

Resolve just a program

http post :8080/resolve program='includes(["apple"], "orange")'

Result:

{
  "success": {
    "output": false,
    "result": {}
  }
}