Closed runabol closed 4 months ago
This PR provides the ability to proxy requests to running tasks.
Potential use-cases:
Example:
ports
# examples/service.yaml name: my service job tasks: - name: my service task image: node:14 run: | node server.js ports: - port: 8080 files: server.js: | const http = require('http'); const hostname = '0.0.0.0'; const port = 8080; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World\n'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); });
JOB_ID=$(curl -s -X POST \ --data-binary @examples/service.yaml \ -H "Content-type: text/yaml" http://localhost:8000/jobs | jq -r .id)
TASK_ID=$(curl -s http://localhost:8000/jobs/$JOB_ID | jq -r '.execution[0].id')
RUNNING
curl -s http://localhost:8000/tasks/$TASK_ID/proxy/8080/some/path Hello World
This PR provides the ability to proxy requests to running tasks.
Potential use-cases:
Example:
ports
block.RUNNING
, Route requests to the task container: