Add Go/TinyGo support, daemon shutdown, and log capture (#31)#35
Merged
Conversation
Implements comprehensive Go support using TinyGo, graceful daemon shutdown, and per-service log capture with bounded ring buffers. Go Builder: - Add GoBuilder using TinyGo 0.32+ with wasip2 target - Support both command and HTTP service types - Add toolchain verification for TinyGo and wasm-tools - Add go-hello and go-http working examples Daemon Shutdown: - Add 'fabricks daemon stop' CLI command - Add POST /v1/daemon/shutdown API endpoint - Implement graceful shutdown with 5s timeout - Clean service and resource cleanup on shutdown Log Capture: - Add per-service bounded ring buffer (10k lines default) - Capture stdout/stderr with timestamps and stream type - Add 'fabricks service logs' CLI command - Add GET /v1/services/:id/logs API endpoint - Support retrieval by service ID or name Runtime Improvements: - Fix fuel metering: add default 10 billion fuel limit - Add LogCaptureSink and LogWriter for output capture - Add run_with_output() method for custom stdio - Remove excessive debug logging Network Access: - Add auto-created "default" network with external access - Make standalone services internal-only by default (secure by default) - Require explicit --network flag for external access - Support multiple networks via repeated --network flag Documentation: - Update architecture.md with log capture design - Update CLI reference with daemon stop and service logs - Update API reference with shutdown and logs endpoints - Document network access patterns and security model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements comprehensive Go/TinyGo support, graceful daemon shutdown, and per-service log capture functionality.
Go Builder
GoBuilderusing TinyGo 0.32+ withwasip2target for WASI Preview 2 component generationgo-helloandgo-httpexamples that build and run successfullyDaemon Shutdown
fabricks daemon stopCLI command for graceful shutdownPOST /v1/daemon/shutdownAPI endpointLog Capture
fabricks service logsCLI command with-n/--tailflagGET /v1/services/:id/logsAPI endpointRuntime Improvements
LogCaptureSinkandLogWriterfor custom stdio capturerun_with_output()method to Runtime for custom stdout/stderr handlingNetwork Access
--networkflag for external access--networkflagDocumentation
architecture.mdwith log capture architecture and network designcli-reference.mdwith daemon stop and service logs commandsdaemon-api-reference.mdwith shutdown and logs API endpointsTest Plan
fabricks daemon stop--network defaultRelated Issues
Closes #31