This guide explains the Veridock runtime environment and how to interact with it.
The Veridock runtime provides a sandboxed environment for executing commands and managing services. It includes:
The easiest way to interact with the runtime is through the web interface:
make run
http://localhost:2019/runtime
The veridock
CLI provides access to runtime features:
# Run a command
veridock run "echo 'Hello, Veridock!"
# List running services
veridock service list
# View logs
veridock logs
Interact with the runtime programmatically:
# Get runtime status
curl http://localhost:8082/status
# List available commands
curl http://localhost:8082/makefile/list_commands
# Execute a command
curl -X POST http://localhost:8082/makefile/run_command \
-H "Content-Type: application/json" \
-d '{"command": "echo \"Hello, Veridock!\""}'
Execute shell commands through the runtime:
// Example JavaScript using fetch
async function runCommand(command) {
const response = await fetch('http://localhost:8082/makefile/run_command', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ command })
});
return await response.json();
}
// Usage
runCommand('ls -la').then(console.log);
Manage services through the runtime:
# Start a service
curl -X POST http://localhost:8082/service/start \
-H "Content-Type: application/json" \
-d '{"name": "my-service"}'
# Stop a service
curl -X POST http://localhost:8082/service/stop \
-H "Content-Type: application/json" \
-d '{"name": "my-service"}'
The runtime provides an event system for real-time notifications:
// Subscribe to events
const eventSource = new EventSource('http://localhost:8082/events');
eventSource.onmessage = (event) => {
console.log('Event received:', JSON.parse(event.data));
};
eventSource.onerror = (error) => {
console.error('EventSource error:', error);
};
The runtime implements several security features:
Customize the runtime behavior using environment variables in your .env
file:
# Enable debug mode
VERIDOCK_DEBUG=true
# Set log level
LOG_LEVEL=DEBUG
# Configure command timeout (in seconds)
COMMAND_TIMEOUT=30
Add custom commands by creating Python modules in the veridock/commands
directory. Each module should define a register_commands
function that returns a dictionary of command names and their handlers.