Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/aventer-ug/vmm-agent

Agent for MicroVM's
https://github.com/aventer-ug/vmm-agent

firecracker golang mesos

Last synced: 24 days ago
JSON representation

Agent for MicroVM's

Awesome Lists containing this project

README

        

# Agent for MicroVM's

This is a fork of: https://github.com/codebench-dev/agent

## Build

### Build Rootfs and Kernel

```bash
make rootfs
```

### Start MicroVM

```bash
make start-vm
```

### Stop MicroVM

```bash
make stop-vm
```

## Healthcheck

```bash
» curl -i 127.0.0.1:8080/health
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Date: Sat, 31 Jul 2021 20:02:45 GMT
Content-Length: 2
```

## Shutdown

```bash
» curl -i 127.0.0.1:8080/shutdown
```

## Compile and run standalone code

### C

```sh
» curl -i localhost:8080/run -X POST --data '{"code":"#include \r\nint main() {\r\n printf(\"Hello, C!\");\r\n return 0;\r\n}","id":"123","variant":"gcc","language":"c"}' -H 'Content-Type: application/json'
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Sat, 31 Jul 2021 20:04:04 GMT
Content-Length: 104

{"message":"Success","error":"","stdout":"Hello, C!","stderr":"","exec_duration":1843,"mem_usage":9432}
```

### C++

```
» curl -i -H 'Content-Type: application/json' -X POST http://localhost:8080/run --data '{"id":"1235","code":"#include \n\nint main() {\n std::cout << \"Hello, C++!\";\n return 0;\n}\n","language":"cpp", "variant":"cpp"}'
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Sat, 31 Jul 2021 20:04:50 GMT
Content-Length: 106

{"message":"Success","error":"","stdout":"Hello, C++!","stderr":"","exec_duration":3899,"mem_usage":9972}
```

### Python

```
» curl -i -H 'Content-Type: application/json' -X POST http://localhost:8080/run --data '{"id":"1234","code":"print(\"Hello, Python!\")","language":"python", "variant":"cpython3"}'
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Sat, 31 Jul 2021 20:06:31 GMT
Content-Length: 113

{"message":"Success","error":"","stdout":"Hello, Python!\n","stderr":"","exec_duration":20958,"mem_usage":10620}
```

### Go

```
» curl -i localhost:8080/run -X POST --data '{"code":"package main\r\n\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n fmt.Println(\"Hello, Go!\")\r\n}","id":"123","variant":"go","language":"go"}' -H 'Content-Type: application/json'
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Sat, 31 Jul 2021 20:07:14 GMT
Content-Length: 108

{"message":"Success","error":"","stdout":"Hello, Go!\n","stderr":"","exec_duration":4706,"mem_usage":10620}
```

### Wasm

```
» curl -i localhost:8080/run -X POST -F [email protected] -F id=1234 -F language=wasm -F variant=wasm
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Sat, 31 Jul 2021 20:07:14 GMT
Content-Length: 108

{"message":"Success","error":"","stdout":"Hello, Go!\n","stderr":"","exec_duration":4706,"mem_usage":10620}
```

### Bash

```
» curl -i localhost:8080/run -X POST --data '{"code":"echo test","id":"123","variant":"bash","language":"bash"}' -H 'Content-Type: application/json'
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Sat, 31 Jul 2021 20:07:14 GMT
Content-Length: 108

{"message":"Success","error":"","stdout":"Hello, Go!\n","stderr":"","exec_duration":4706,"mem_usage":10620}
```