News for hackers. Stuff that matters.
Re:Fun with Unix domain sockets by leephillips on Saturday July 24, 2021 @11:15AM (#27941614)
“It turns out both nginx and Apache have the ability to proxy traffic to a Unix domain socket rather than to an HTTP port, which makes this a useful mechanism for running backend servers without attaching them to TCP ports.”

That’s one useful nugget of information! I had no idea.

Re:Fun with Unix domain sockets by z3t4 on Saturday July 24, 2021 @01:14PM (#27942670)
On webide.se (free shell and web IDE) I use unix sockets alot!, for example nginx proxy from https://foo.user.webide.se to /home/user/socket/foo so that users can test their apps using HTTPS/SSL as many browser features need a httpS URL to work. Unix sockers are also used for accessing a shared mySQL server, and an x11 server so you can test out "native" apps and run Android emulator in the browser.
Re:Fun with Unix domain sockets by girishso on Saturday July 24, 2021 @02:34PM (#27943375)
TIL
Re:Fun with Unix domain sockets by phoyd on Saturday July 24, 2021 @12:29PM (#27942264)
Now Docker should provide some way to bridge container ports to UDS. That would be perfect.
Re:Fun with Unix domain sockets by TechBro8615 on Saturday July 24, 2021 @02:24PM (#27943281)
You can bind mount the socket in a volume. You can also do this with named volumes shared between containers. You’ll need to make sure the GID/UIDs match, but it works great. It’s often faster for inter service communication than the Docker proxy.
Re:Fun with Unix domain sockets by yrro on Saturday July 24, 2021 @01:34PM (#27942854)
Quick hack for you:

socat TCP-LISTEN:4000,fork UNIX-CONNECT:/run/yoursock

Re:Fun with Unix domain sockets by rogerdonut on Saturday July 24, 2021 @11:26AM (#27941719)
HAProxy can as well (as well as listen on unix sockets)
Re:Fun with Unix domain sockets by moderation on Saturday July 24, 2021 @11:38AM (#27941812)
Re:Fun with Unix domain sockets by nerdponx on Sunday July 25, 2021 @04:52AM (#27947759)
Unfortunately and annoyingly not all applications support listening on Unix domain sockets.
Re:Fun with Unix domain sockets by colek42 on Saturday July 24, 2021 @12:07PM (#27942044)
socat is the tool for this. No need for a full blown webserver.
Re:Fun with Unix domain sockets by RedShift1 on Saturday July 24, 2021 @12:30PM (#27942279)
socat is a "dumb" tool. With a proxy that understands HTTP you have a lot more influence over what goes where and for example not direct requests to a down backend instance.
Re:Fun with Unix domain sockets by colek42 on Saturday July 24, 2021 @01:27PM (#27942787)
Are you challenging me to build a socat loadbalancer in bash? In all seriousness, I concur. But if you just need to redirect some data streams socat is a rock solid and simple solution.
Re:Fun with Unix domain sockets by jsjohnst on Saturday July 24, 2021 @01:44PM (#27942942)
> Are you challenging me to build a socat loadbalancer in bash?

It’s a Saturday and all, so yeah, I’m challenging you (for fun, not because I don’t think it’s possible).

Re:Fun with Unix domain sockets by marcosdumay on Saturday July 24, 2021 @02:28PM (#27943321)
From a quick read of the manpage, I don't think it's possible either, unless you mess with EXEC or create multiple listeners to a single address.

Anyway, the Linux kernel does have a builtin loadbalancer in the form of shared sockets that you can socat outside of the machine. But I wouldn't call that a socat loadbalancer.