mirror of
https://github.com/hanzoai/chat.git
synced 2026-09-30 20:51:17 +00:00
74 lines
2.6 KiB
YAML
74 lines
2.6 KiB
YAML
# Temporary runtime service configuration
|
|
# This provides a mock runtime API for development until the full runtime is integrated
|
|
|
|
services:
|
|
runtime:
|
|
image: node:20-alpine
|
|
container_name: hanzo-runtime
|
|
ports:
|
|
- "3003:3000"
|
|
environment:
|
|
NODE_ENV: development
|
|
PORT: 3000
|
|
command: |
|
|
sh -c "
|
|
cat > server.js << 'EOF'
|
|
const http = require('http');
|
|
|
|
const server = http.createServer((req, res) => {
|
|
console.log(req.method, req.url);
|
|
|
|
// CORS headers
|
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
|
|
|
if (req.method === 'OPTIONS') {
|
|
res.writeHead(200);
|
|
res.end();
|
|
return;
|
|
}
|
|
|
|
if (req.url === '/api/health' || req.url === '/health') {
|
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
res.end(JSON.stringify({ status: 'ok', service: 'hanzo-runtime' }));
|
|
} else if (req.url === '/api/sandboxes' && req.method === 'POST') {
|
|
// Mock sandbox creation
|
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
res.end(JSON.stringify({
|
|
id: 'sandbox-' + Date.now(),
|
|
state: 'started',
|
|
language: 'python',
|
|
createdAt: new Date().toISOString()
|
|
}));
|
|
} else if (req.url.startsWith('/api/sandboxes/') && req.method === 'DELETE') {
|
|
// Mock sandbox deletion
|
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
res.end(JSON.stringify({ success: true }));
|
|
} else if (req.url.includes('/execute') && req.method === 'POST') {
|
|
// Mock code execution
|
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
res.end(JSON.stringify({
|
|
output: 'Hello from Hanzo Runtime!',
|
|
exitCode: 0,
|
|
executionTime: 100
|
|
}));
|
|
} else {
|
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
res.end(JSON.stringify({ error: 'Not found' }));
|
|
}
|
|
});
|
|
|
|
server.listen(3000, '0.0.0.0', () => {
|
|
console.log('Mock Hanzo Runtime API running on port 3000');
|
|
});
|
|
EOF
|
|
|
|
node server.js
|
|
"
|
|
networks:
|
|
- hanzo-network
|
|
|
|
networks:
|
|
hanzo-network:
|
|
external: true |