Skip to content

Serve engine session over unix sock/named pipe - #3983

Closed
sipsma wants to merge 7 commits into
dagger:mainfrom
sipsma:to-unix
Closed

sipsma wants to merge 7 commits into
dagger:mainfrom
sipsma:to-unix

Conversation

@sipsma

@sipsma sipsma commented Nov 24, 2022 •

Copy link
Copy Markdown
Contributor

context: #3830

TODO:

  • Fix catch 22 that causes this PR to be unbuildable by merging add hack/ helpers for bootstrapping engine image using stable SDK #3755
    • Basically, the Go SDK has to be updated here but the updated Go SDK is incompatible with the existing released engine
    • I test locally by doing some shenanigans w/ going back a commit to the old go sdk, building dev engine w/ new engine session bin, and then resetting back and running tests 😵‍💫
    • Technically there's other fixes to this but I'd rather just get that PR merged
  • Update Python SDK to connect over unix sockets (described by @helderco here)
  • Update NodeJS SDK to connect over unix (did a rough POC here)
  • (Probably saving for a follow-up) Add Windows support via a named pipe implementation

@sipsma

sipsma commented Nov 28, 2022

Copy link
Copy Markdown
Contributor Author

@slumbering have a commit that switches the nodejs sdk to use unix sockets instead of localhost: 9cc423a

Let me know if there's any different approaches you think would be better.

@sipsma

sipsma commented Nov 29, 2022

Copy link
Copy Markdown
Contributor Author

Pushed some commits to use named pipes on windows and ran some tests from windows VM, current state:

  1. Go seems to work. There are some existing SDK test failures but they appear to be unrelated (something about the engine session binary being invalid). At least a few of the test cases do successfully use the engine session binary though and I can see from running [System.IO.Directory]::GetFiles("\\.\\pipe\\") that the named pipe is actually being used
  2. Shockingly, nodejs also works without any extra commits on top of what I had before. Also verified by running the tests in a windows VM and seeing the named pipe get created
    • I think we lucked out that axios just passes socketPath on through to the lower-level http lib (here) and that lib will interpret socketPath as a named pipe when running on windows
  3. That leaves Python, which I discussed a bit with @helderco, seems like it should be possible thanks to the pluggable transports in httpx

@sipsma
sipsma force-pushed the to-unix branch 12 times, most recently from 6872a30 to ecee511 Compare November 29, 2022 05:07
@sipsma

sipsma commented Nov 29, 2022

Copy link
Copy Markdown
Contributor Author

Updated with an ugly but seemingly working python implementation of named pipe backend on windows. Similar to Go, there are some test failures but they appear to be pre-existing issues on Windows, test_integration.py and test_integration_sync.py both pass on Windows now.

Some minor cleanup left but I think that covers all the base features needed to make this change.

@sipsma
sipsma marked this pull request as ready for review November 29, 2022 05:14
@sipsma sipsma changed the title [WIP] Serve engine session over unix sock Serve engine session over unix sock/named pipe Nov 29, 2022
@sipsma

sipsma commented Nov 30, 2022

Copy link
Copy Markdown
Contributor Author

There was more discussion today, it seems most likely we won't be going the unix+npipe route for now after all, so going to close this.

Extremely terse summary is that unix+npipe is not usable from completely generic command line graphql clients/curl, so we want dagger run to continue using localhost but with some sort of safeguard (currently, probably going with http basic auth); so if dagger run is using localhost it's simpler to just have the SDKs do it too for now.

Will provide more context in #3830 once the dust is 100% settled. Or will reopen this someday if we want to revisit again.

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.

2 participants