Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmd/bbox-init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/stacklok/propolis/guest/boot"
"github.com/stacklok/propolis/guest/harden"
"github.com/stacklok/propolis/guest/reaper"
"github.com/stacklok/propolis/guest/vmconfig"
)

// lockPath is used to ensure only one bbox-init instance runs.
Expand Down Expand Up @@ -60,7 +61,16 @@ func main() {
stopReaper := reaper.Start(logger)
defer stopReaper()

shutdown, err := boot.Run(logger, boot.WithSSHAgentForwarding(true))
vmCfg, vmCfgErr := vmconfig.Read()
Comment thread
JAORMX marked this conversation as resolved.
if vmCfgErr != nil {
logger.Warn("failed to read vm config, using defaults", "error", vmCfgErr)
vmCfg = vmconfig.Config{}
}

shutdown, err := boot.Run(logger,
boot.WithSSHAgentForwarding(true),
boot.WithTmpSize(vmCfg.TmpSizeMiB),
)
if err != nil {
logger.Error("boot failed", "error", err)
halt()
Expand Down
15 changes: 15 additions & 0 deletions cmd/bbox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func rootCmd() *cobra.Command {
noGitSSHAgent bool
noSaveCredentials bool
seedCredentials bool
tmpSize string
noFirmwareDL bool
noImageCache bool
timings bool
Expand Down Expand Up @@ -126,6 +127,7 @@ Example:
return run(cmd.Context(), args[0], runFlags{
cpus: cpus,
memory: memory,
tmpSize: tmpSize,
workspace: wsPath,
sshPort: sshPort,
cfgPath: cfgPath,
Expand Down Expand Up @@ -158,6 +160,7 @@ Example:

cmd.Flags().Uint32Var(&cpus, "cpus", 0, "Number of vCPUs (0 = agent default)")
cmd.Flags().Uint32Var(&memory, "memory", 0, "RAM in MiB (0 = agent default)")
cmd.Flags().StringVar(&tmpSize, "tmp-size", "", "Size of /tmp tmpfs inside the VM, e.g. 512m or 2g (0 = agent default)")
cmd.Flags().StringVar(&wsPath, "workspace", "", "Workspace directory to mount (default: current directory)")
cmd.Flags().Uint16Var(&sshPort, "ssh-port", 0, "Host SSH port (0 = auto-pick)")
cmd.Flags().StringVar(&cfgPath, "config", "", "Config file path (default: ~/.config/broodbox/config.yaml)")
Expand Down Expand Up @@ -271,6 +274,7 @@ func authClearCmd() *cobra.Command {
type runFlags struct {
cpus uint32
memory uint32
tmpSize string
workspace string
sshPort uint16
cfgPath string
Expand Down Expand Up @@ -694,6 +698,16 @@ func run(parentCtx context.Context, agentName string, flags runFlags) error {
commandOverride = []string{flags.exec}
}

// Parse --tmp-size flag (human-readable string → MiB).
var tmpSizeMiB uint32
if flags.tmpSize != "" {
parsed, parseErr := domainconfig.ParseByteSize(flags.tmpSize)
if parseErr != nil {
return fmt.Errorf("--tmp-size: %w", parseErr)
}
tmpSizeMiB = parsed.MiB()
}

// Enable libkrun trace logging when --debug is set so vm.log
// captures hypervisor-level diagnostics.
var logLevel uint32
Expand All @@ -704,6 +718,7 @@ func run(parentCtx context.Context, agentName string, flags runFlags) error {
opts := sandbox.RunOpts{
CPUs: flags.cpus,
Memory: flags.memory,
TmpSizeMiB: tmpSizeMiB,
Workspace: ws,
SSHPort: flags.sshPort,
ImageOverride: flags.image,
Expand Down
32 changes: 16 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/sergi/go-diff v1.4.0
github.com/spf13/cobra v1.10.2
github.com/stacklok/propolis v0.0.20
github.com/stacklok/propolis v0.0.21
github.com/stacklok/toolhive v0.12.1
github.com/stacklok/toolhive-core v0.0.12
github.com/stretchr/testify v1.11.1
Expand Down Expand Up @@ -73,17 +73,17 @@ require (
github.com/coreos/go-oidc/v3 v3.17.0 // indirect
github.com/creack/pty v1.1.24 // indirect
github.com/cristalhq/jwt/v4 v4.0.2 // indirect
github.com/danieljoos/wincred v1.2.2 // indirect
github.com/danieljoos/wincred v1.2.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/dgraph-io/ristretto v1.0.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/docker/cli v29.2.1+incompatible // indirect
github.com/docker/cli v29.3.0+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v28.5.2+incompatible // indirect
github.com/docker/docker-credential-helpers v0.9.3 // indirect
github.com/docker/docker-credential-helpers v0.9.5 // indirect
github.com/docker/go-connections v0.6.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand Down Expand Up @@ -139,7 +139,7 @@ require (
github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/inetaf/tcpproxy v0.0.0-20250222171855-c4b9df066048 // indirect
github.com/insomniacslk/dhcp v0.0.0-20240710054256-ddd8a41251c9 // indirect
github.com/insomniacslk/dhcp v0.0.0-20260220084031-5adc3eb26f91 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand Down Expand Up @@ -176,7 +176,7 @@ require (
github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe // indirect
github.com/ory/go-convenience v0.1.0 // indirect
github.com/ory/x v0.0.665 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/pierrec/lz4/v4 v4.1.26 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
Expand Down Expand Up @@ -225,37 +225,37 @@ require (
github.com/zalando/go-keyring v0.2.6 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.21.0 // indirect
go.opentelemetry.io/contrib/propagators/jaeger v1.21.1 // indirect
go.opentelemetry.io/contrib/samplers/jaegerremote v0.15.1 // indirect
go.opentelemetry.io/otel v1.41.0 // indirect
go.opentelemetry.io/otel v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.40.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.63.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.41.0 // indirect
go.opentelemetry.io/otel/sdk v1.41.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.41.0 // indirect
go.opentelemetry.io/otel/trace v1.41.0 // indirect
go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.opentelemetry.io/otel/sdk v1.42.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.42.0 // indirect
go.opentelemetry.io/otel/trace v1.42.0 // indirect
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.ngrok.com/muxado/v2 v2.0.1 // indirect
golang.ngrok.com/ngrok/v2 v2.1.1 // indirect
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect
golang.org/x/exp/event v0.0.0-20260112195511-716be5621a96 // indirect
golang.org/x/exp/jsonrpc2 v0.0.0-20260218203240-3dfff04db8fa // indirect
golang.org/x/mod v0.33.0 // indirect
golang.org/x/mod v0.34.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/oauth2 v0.35.0 // indirect
golang.org/x/text v0.35.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/tools v0.42.0 // indirect
golang.org/x/time v0.15.0 // indirect
golang.org/x/tools v0.43.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260217215200-42d3e9bedb6d // indirect
Expand Down
Loading
Loading