Skip to content

Add Go/TinyGo support, daemon shutdown, and log capture (#31)#35

Merged
richardkiene merged 1 commit into
mainfrom
feature/31-go-dotnet-support
Feb 1, 2026
Merged

Add Go/TinyGo support, daemon shutdown, and log capture (#31)#35
richardkiene merged 1 commit into
mainfrom
feature/31-go-dotnet-support

Conversation

@richardkiene
Copy link
Copy Markdown
Contributor

Summary

This PR implements comprehensive Go/TinyGo support, graceful daemon shutdown, and per-service log capture functionality.

Go Builder

  • Implemented GoBuilder using TinyGo 0.32+ with wasip2 target for WASI Preview 2 component generation
  • Added toolchain verification for both TinyGo and wasm-tools
  • Supports both command-line and HTTP service types
  • Added working go-hello and go-http examples that build and run successfully

Daemon Shutdown

  • Added fabricks daemon stop CLI command for graceful shutdown
  • Implemented POST /v1/daemon/shutdown API endpoint
  • Reduced shutdown timeout from 30s to 5s for faster termination
  • Ensures clean service and resource cleanup on shutdown

Log Capture

  • Implemented per-service bounded ring buffer (default: 10,000 lines)
  • Captures stdout/stderr with timestamps and stream type differentiation
  • Added fabricks service logs CLI command with -n/--tail flag
  • Implemented GET /v1/services/:id/logs API endpoint
  • Supports retrieval by both service ID and service name
  • Provides both text and JSON output formats

Runtime Improvements

  • Fixed critical bug: RuntimePool had fuel metering enabled but no fuel limit set, causing WASM to run out of fuel immediately
  • Added default fuel limit of 10 billion when spawning instances
  • Implemented LogCaptureSink and LogWriter for custom stdio capture
  • Added run_with_output() method to Runtime for custom stdout/stderr handling
  • Cleaned up excessive debug logging

Network Access

  • Added auto-created "default" network with external access at daemon startup
  • Made standalone services internal-only by default (secure by default)
  • Requires explicit --network flag for external access
  • Supports multiple networks via repeated --network flag

Documentation

  • Updated architecture.md with log capture architecture and network design
  • Updated cli-reference.md with daemon stop and service logs commands
  • Updated daemon-api-reference.md with shutdown and logs API endpoints
  • Documented network access patterns and security model

Test Plan

  • Built and tested go-hello example (command-line service)
  • Built and tested go-http example (HTTP service with health check)
  • Verified daemon graceful shutdown with fabricks daemon stop
  • Verified log capture for both stdout and stderr
  • Tested log retrieval by service ID and name
  • Verified network access with and without --network default
  • Confirmed fuel limit fix resolves WASM execution issues
  • Verified toolchain checks for TinyGo and wasm-tools

Related Issues

Closes #31

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
@richardkiene richardkiene merged commit ceae220 into main Feb 1, 2026
0 of 3 checks passed
@richardkiene richardkiene deleted the feature/31-go-dotnet-support branch February 1, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Go and C# .NET language support

1 participant