This is a serverless platform built using Go and Docker. It allows users to upload a ZIP file containing either Python or Go code, which is then compiled and executed in a Docker container.
- Endpoint:
POST /api/submit
- Description: Accepts a ZIP file containing the user's code.
- Request:
- Parameter:
code
(file) - Example:
curl -X POST -F "code=@$(zip_file)" http://0.0.0.0:8080/api/submit
- Parameter:
- Endpoint:
GET /api/execute
- Description: Executes the previously submitted code.
- Query Parameter:
functionID
: The ID of the function to be executed.
- Example:
curl http://0.0.0.0:8080/api/execute\?functionID\=$(functionID)
The platform consists of the following components:
- Go Server: The main application that handles the incoming requests, extracts the code from the ZIP file, and compiles/executes it in a Docker container.
- Docker: Used to create and manage the runtime environment for the user's code.
- YAML Configuration: Defines the Docker image and build instructions as per programming language.
- Clone the repository:
git clone https://github.com/hardikkum444/go-serverless.git cd go-serverless
- Build the binary:
go build main.go
- Run the application:
chmod +x main ./main
- Submit a ZIP file:
make submit zip_file=<zip_file_name>
- Execute the submitted code:
make execute functionID=<functionID>
Make sure to replace in the Makefile with the correct domain or IP address of your server.
Make sure to replace in the Makefile with the correct domain or IP address of your server.
Below are the images of the Grafana and Prometheus dashboard setup for the go-serverless platform: