This API execute code in remote containerised machine securely.
- Distributed Architecure
- High availability
- Low latency
- Asynchronous communication
- Resilient to mallicious program
- Handle infinite loop
- Handle recursive without exit condition
- Fork Bomb
- Manage CPU and memory heavy job
- Client sends a POST request with:
- Source code
- Programming language choice
- Input (if required)
- Time limit
- Server responds with a unique job ID.
- Server places the request in a task queue.
- Worker node processes the request in a secure environment.
- Worker node updates status in a cache (with expiry) after execution.
- Worker node sends acknowledgment to task queue:
- Positive acknowledgment: Task is deleted.
- Negative acknowledgment: Task remains.
- Client uses a GET request with the job ID to:
- Retrieve results
- Check status (queued, running)
After cloning run the following cmd.
docker compose up -d
This would spin up followig services:
- Server - Basically publisher
- RabbitMQ - Task Queue
- Workers - Executers
- RedisDB - Cache/store the result
Server would be up and listening on port 4000.
TODOS
- Error Handling - [in server]
- Handle File-system-tampering code - [in worker]
- Handle process alterating code - [in worker]
- Multiple queues with variable priority