Repository navigation
Add the boxes provider: hosted microVMs, onctl login, ssh through the provider - #1168
Merged
Merged
Conversation
… provider Rollout step 1 of docs/plans/boxes-provider.md: the hosted boxes service (boxctl.io) becomes an onctl provider, -p boxes. - internal/providerboxes: the API client, ported from boxctl's internal/client (list/create/destroy/pause/resume/exec/images, WaitReady, and DialPort -- the port tunnel as a net.Conn over WebSocket), plus the saved token: $ONCTL_BOXES_TOKEN, then ~/.onctl/boxes.json, then boxctl's own ~/.boxctl/config.json so boxctl users needn't log in again. - pkg/cloud.ProviderBoxes: CloudProviderInterface plus ImageLister. The service takes no ssh key at create, so Deploy (and SSHInto, for boxes made elsewhere) authorizes it over the exec endpoint. - cloud.Dialer and tools.Remote.Dial: a box has no address of its own, so create/ssh/deploy run their ssh over the provider's tunnel when it implements Dialer. A paused box is resumed first. - onctl ssh-proxy: relays stdio to a VM port through the provider, used as the system ssh's ProxyCommand by onctl ssh -- and usable from ~/.ssh/config for plain ssh, scp, rsync, git, VS Code. - onctl login/logout. - create: --image works for boxes; --type is taken only when given (its default is Hetzner's cpx21); --domain is refused (no public IP); the cloud-init wait is skipped. boxes needs no onctl.yaml. images lists boxes images. pause's 'snapshot saved, server deleted' is now Hetzner-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1168 +/- ##
==========================================
+ Coverage 36.93% 38.81% +1.87%
==========================================
Files 51 57 +6
Lines 5656 6073 +417
==========================================
+ Hits 2089 2357 +268
- Misses 3567 3716 +149 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Rollout step 1 of
docs/plans/boxes-provider.md: the hosted boxes service (boxctl.io) becomes an onctl provider.What's added
internal/providerboxes: the API client, ported from boxctl'sinternal/client.DialPortis the port tunnel as anet.Connover WebSocket.$ONCTL_BOXES_TOKEN, then~/.onctl/boxes.json(0600), then boxctl's~/.boxctl/config.json.pkg/cloud.ProviderBoxes: implementsCloudProviderInterfaceandImageLister. The service takes no ssh key at create, soDeployauthorizes it through the exec endpoint.SSHIntodoes too, so boxes made in the dashboard work. A key containing a quote or newline is refused before it reaches a shell.cloud.Dialerandtools.Remote.Dial: a box has no address of its own, socreate,sshanddeployrun ssh over the provider's tunnel. A paused box is resumed first.onctl ssh-proxy: relays stdio to a VM port through the provider.onctl sshuses it as the system ssh'sProxyCommand, and it also works from~/.ssh/config(Host *.box) for plain ssh, scp, rsync, git and VS Code.onctl login/onctl logout.Behaviour for
-p boxes--imageworks.--typeapplies only when given explicitly, because its default is Hetzner'scpx21.--domainis refused, since a box has no public IP.onctl.yamlis needed.Change for every provider:
pause's "snapshot saved, server deleted" message now appears for Hetzner only.The plan's open questions 1, 2 and 5 are settled as proposed: provider ID
boxes,onctl login,gorilla/websocket.Tests
httptest: auth header, the 401 →onctl loginmessage, the server's error text,WaitReady, and the tunnel as a byte stream.Remote.Dial, against an in-process ssh server.go test -race -shuffle=on ./...with an emptyHOME,go vetand golangci-lint are all clean.End-to-end against boxctl.io (throwaway boxes, destroyed afterwards):
createwith an apply script over the tunnel took about 8s;ssh -- cmdworks;pause -f, thensshresumed the box in about 2s;ssh -o ProxyCommand='onctl ssh-proxy -p boxes %h'works;destroyworks;ls/imageslist the account's real boxes and catalog.Next steps (2–5 in the plan):
port-forward/sizes/--idle-ttl,onctl claude, the plugin, then retiringboxctl.🤖 Generated with Claude Code
https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4