Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix domain socket support #465

Open
igrishaev opened this issue Jan 23, 2019 · 7 comments
Open

Unix domain socket support #465

igrishaev opened this issue Jan 23, 2019 · 7 comments

Comments

@igrishaev
Copy link

Are there any plans on adding interaction with Unix domain sockets?

What I'd like to achieve is to interact with Docker daemon via socket as follows:

curl --unix-socket /var/run/docker.sock http:/v1.24/images/json

As I see it, there should be a separate unix.clj module that provides client and handler functions.

I found a small Java example which I'm going to port to Clojure using existing Aleph abstractions. I'm new to Netty so could you at least give me a tip whether that's a good example or not?

@igrishaev igrishaev changed the title Unix domain socket support Unix domain socket support [feature request] Jan 23, 2019
@kachayev kachayev changed the title Unix domain socket support [feature request] Unix domain socket support Jan 23, 2019
@kachayev
Copy link
Collaborator

@igrishaev Let me put "feature request" tag on this. There are no specific plans, but I've been thinking about extending a list of supported transports for a while.

@kachayev
Copy link
Collaborator

And.. yeah, there's an issue already for this :) #212

@kachayev
Copy link
Collaborator

kachayev commented Feb 1, 2019

I've managed to get HTTP client to work through the socket with epoll transport here. There's still one thing that bothers me a lot...

(def options {:connections-options {:unix-socket "/var/run/docker.sock"}})
(def through-socket (http/connection-pool options))
(http/get "/images/json" {:pool through-socket})

This is a valid request, although it would fail. Because here we would still try to parse a java.net.URL. Meaning I have to do something like

(def options {:connections-options {:unix-socket "/var/run/docker.sock"}})
(def through-socket (http/connection-pool options))
(http/get "http://this-is-dummy-host/images/json" {:pool through-socket})

That's the same problem cURL has: it still requires you to put a valid URL with scheme and hostname even if you've specified --unix-socket option. @ztellman are we okay with the latest or should we dig deeper to find a better solution?

I also do a substitution of the remote-address to DomainSocketAddress when creating the connection, which obviously causes trouble to SSL configuration: with the current implemention we need to carry host/port (when given) separately from remote-address. Which is doable, it just makes the code less readable with quite a few new if-else branches here and there. So I'm still looking for a better approach.

@olymk2
Copy link

olymk2 commented Nov 9, 2019

should either of these work in current versions ?

@olymk2
Copy link

olymk2 commented Nov 20, 2019

@kachayev @igrishaev @ztellman what's the status of this pr https://github.com/ztellman/aleph/compare/master...kachayev:ft-unix-socket?expand=1

are we likely to see it merged / what's blocking it ?

@tom-adsfund
Copy link

Was this solved with the merged #480 ? Looks like it just needs documentation now?

@DerGuteMoritz
Copy link
Collaborator

Was this solved with the merged #480 ? Looks like it just needs documentation now?

Nope, the respective changes for unix domain sockets support were reverted before merge. See #480 (comment) and a9736bf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants