Hi! I am trying to use a unix socket as server in backend.
I’ve seen it is supported in frontend but I have not seen whether is or not supported in the backend.
I did an internet search and found a forum (link here) with some stating it is supported and others it is not.
I tried it and I have no Haproxy error stating it is not supported or anything like that, but it doesn’t work.
My haproxy configuration is with http:
frontend rpilibcam
bind-process 2-3
bind :8090 tfo ssl crt /etc/haproxy/certs/ process 2-3 alpn h2,http/1.1 curves X25519:P-256:secp384r1
bind abns@haproxy-clt7 accept-proxy tfo ssl crt /etc/haproxy/certs/ process 2-3 alpn h2,http/1.1 curves X25519:P-256:secp384r1
mode http
option forwardfor
default_backend rpicam_8089
backend rpicam_8089
mode http
option forwardfor
retry-on all-retryable-errors
#server rpicam 127.0.0.1:8089
server rpicam unix@ustreamer.sock
And this is the one with tcp:
frontend rpilibcam
bind-process 2-3
bind :8090 ssl crt /etc/haproxy/certs/ process 2-3 curves X25519:secp521r1:P-256:secp384r1 tfo
bind abns@haproxy-clt7 accept-proxy ssl crt /etc/haproxy/certs process 2-3 curves X25519:P-256:secp384r1
mode tcp
option tcp-smart-accept
default_backend rpicam_8089
backend rpicam_8089
mode tcp
option tcp-smart-connect
retry-on all-retryable-errors
#server rpicam 127.0.0.1:8089
#server rpicam /run/ustreamer.sock
server rpicam /run/ustreamer.sock
The application I am trying to use is Ustreamer(link here) which is a video streaming application with systemd socket activation.
I expect the user to connect to 8090 and watch the video streaming haproxy encrypts from the unix socket where the aplication listens for activation and transmits.
The aplication can be accessed with this command the developer provided me so to prove the application is working:
curl --unix /run/ustreamer.sock http://127.0.0.1:8080/state
{"ok": true, "result": { "encoder": {"type": "CPU", "quality": 80}, "source": {"resolution": {"width": 1296, "height": 972}, "online": true, "desired_fps": 6, "captured_fps": 2}, "stream": {"queued_fps": 0, "clients": 0, "clients_stat": {}}}}
Further information, I tested haproxy with IP instead of Unix socket and both work. My issue seems to be conecting the unix socket with Haproxy if that is possible.
So do you know if unix socket server is supported in the backend? And if so, do you know what is missing?
Thanks in advance!
Further system information below:
haproxy -v
HA-Proxy version 2.2.9-2+deb11u2 2021/09/05 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2025.
Known bugs: http://www.haproxy.org/bugs/bugs-2.2.9.html
Running on: Linux 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64
uname -a
Linux rpi4 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux
root@rpi4:/home/pi# cat /etc/debian_version
11.2
apt show haproxy
Package: haproxy
Version: 2.2.9-2+deb11u2
Priority: optional
Section: net
Maintainer: Debian HAProxy Maintainers <team+haproxy@tracker.debian.org>
Installed-Size: 3,839 kB
Pre-Depends: dpkg (>= 1.17.14), init-system-helpers (>= 1.54~)
Depends: libc6 (>= 2.17), libcrypt1 (>= 1:4.1.0), libgcc-s1 (>= 3.0), liblua5.3-0, libpcre2-8-0 (>= 10.22), libssl1.1 (>= 1.1.1), libsystemd0, zlib1g (>= 1:1.1.4), adduser, lsb-base (>= 3.0-6)
Suggests: vim-haproxy, haproxy-doc
Homepage: http://www.haproxy.org/
Tag: implemented-in::c, interface::daemon, network::hiavailability,
network::load-balancing, network::server, network::service,
protocol::http, protocol::tcp, role::program, use::filtering,
use::proxying
Download-Size: 1,846 kB
APT-Manual-Installed: yes
APT-Sources: http://deb.debian.org/debian bullseye/main arm64 Packages
Description: fast and reliable load balancing reverse proxy
HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high
availability environments. It features connection persistence through HTTP
cookies, load balancing, header addition, modification, deletion both ways. It
has request blocking capabilities and provides interface to display server
status.
2 posts - 2 participants