Repository navigation
feat(admin): build a machine's setup command from the panel - #11
Merged
Merged
Conversation
Connecting a machine meant issuing a credential in one tab, reserving a name in another, then writing the drip command line by hand on the host and getting the flags right. The panel now builds that line. The new Patch in tab asks what the machine serves and renders the command it runs once the drip binary is on it: drip config set, drip config tunnel add, and optionally the step that leaves the tunnel running. Deployment stays two steps. Installing the binary is still whatever that fleet already does, and nothing here renders an installer or depends on how drip arrived. POST /api/provision resolves the credential and the allocation and renders the command in Go, not in the panel. Shell and PowerShell quoting is what keeps a value the operator typed from becoming syntax, and that belongs where it can be tested directly rather than in a template in app.js. An allocation the account already holds is adopted and bound to the machine rather than colliding with it, so rebuilding the command for a machine that is already deployed is safe. One owned by another account, or bound to another machine, is refused instead of stolen. An existing credential renders PASTE_TOKEN_HERE, because only sha256(secret) is stored and its token cannot be read back. Issuing a credential from the builder embeds the real one, returned exactly once the way POST /api/clients returns it. Two platform details the command has to get right on its own: Windows autostart passes --reseed, since the step before it rewrote the user config and service install would otherwise keep a stale machine-wide copy, and follows with service start, which install does not do. A tcp tunnel gets no --subdomain — the reservation pins the port and the client binds it by asking for nothing.
A select and an input with identical padding still came out a few pixels apart, because Chrome forces line-height: normal on a select and ignores the inherited one. Side by side in a form row that reads as a defect, so both are pinned to the same box and left to centre their own text. The native arrow also sits hard against the right edge of the control and no padding moves it. Both the form selects and the language picker now draw their own chevron with room around it. A background image cannot take currentColor, so the glyph is a token with one URI per theme, defined beside the colours it has to match.
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.
Connecting a machine meant issuing a credential in one tab, reserving a name in another, then writing the drip command line by hand on the host and getting the flags right. This adds a Patch in tab that builds that line.
Deployment stays two steps. Installing the binary is still whatever that fleet already does — nothing here renders an installer, and nothing depends on how drip arrived on the host.
What it does
The tab asks what the machine serves, then renders the command it runs once the binary is installed, in three platform variants with copy and download:
Decisions worth reviewing
PASTE_TOKEN_HERE. Onlysha256(secret)is stored, so a token issued earlier cannot be read back. Issuing one from the builder embeds the real token, returned exactly once the wayPOST /api/clientsreturns it.--reseed— the step before it rewrote the user config, andservice installwould otherwise keep a stale%ProgramData%copy — and follows withservice start, which install does not do. The Windows script is one command per line, since&&needs PowerShell 7.--subdomain. The reservation pins the port and the client binds it by asking for nothing.Testing
12 new tests in
api_provision_test.gocover the rendering, the quoting, allocation reuse, cross-account refusal and the credential paths.go vetandgo test -race ./...are clean.Also driven end to end against a local deployment: the generated command configured a machine with an isolated
HOME, the tunnel bound its reserved port, and traffic through the public port returned 200.Not in this PR
Reserving a TCP port still does not check the server's configured port range — the panel has never done this and
admin.Deploymentdoes not carrytcp_port_min/max, so a port outside it is accepted and refused later at registration. Recorded in AGENTS.md; fixing it belongs in both reservation paths or neither.