I’m trying to run my scala service “Docker Image” using HA Proxy Data Plane API.
here is docker compose:
version: "3"
services:
dataplaneapi:
image: haproxytech/haproxy-ubuntu
container_name: dataplaneapi
ports:
- "5555:5555"
volumes:
- ${PWD}/haproxy:/usr/local/etc/haproxy:rw
command:
- "/usr/local/bin/dataplaneapi"
- "-f"
- "/usr/local/etc/haproxy/dataplaneapi.yml"
networks:
- my-network
pekko-ha-proxy-container-1:
container_name: pekko-ha-proxy-container-1
image: pekko-ha-proxy:0.0.1
ports:
- "8090:8090"
networks:
- my-network
networks:
my-network:
external: true
haproxy.cfg
# _md5hash=d3692304a2b0be4e094ffd4eb15f25b0
# _version=3
# Dataplaneapi managed File
# changing file directly can cause a conflict if dataplaneapi is running
global
master-worker
stats socket /var/run/haproxy.sock mode 660 level admin
insecure-fork-wanted
expose-deprecated-directives
userlist dataplaneapi
user admin insecure-password adminpwd
frontend http
mode http
bind *:8100
timeout client 10s
stats enable
stats uri /stats
use_backend all
backend all
mode http
timeout server 50s
timeout connect 50s
server s1 pekko-ha-proxy-container-1:8090 check inter 5s fall 2 rise 2
program api
command /usr/local/bin/dataplaneapi -f /etc/haproxy/dataplaneapi.yml
no option start-on-reload
when I do $ docker compose up
both containers go live.
I have checked frontend, backend and binding is fine via Data Plane API
$ curl -X GET --user admin:adminpwd "http://localhost:5555/v3/services/haproxy/configuration/frontends"
[{"client_timeout":10000,"mode":"http","name":"http","stats_options":{"stats_enable":true,"stats_show_node_name":null,"stats_uri_prefix":"/stats"}}]
$ curl -X GET --user admin:adminpwd "http://localhost:5555/v3/services/haproxy/configuration/backends"
[{"connect_timeout":50000,"mode":"http","name":"all","server_timeout":50000}]
$ curl -X GET --user admin:adminpwd "http://localhost:5555/v3/services/haproxy/configuration/frontends/http/binds"
[{"name":"*:8100","address":"*","port":8100}]
Now when I hit http://0.0.0.0:8100/hello
via postman it is giving me Error: connect ECONNREFUSED 0.0.0.0:8100
Logs on container side are:
pekko-ha-proxy-container-1 | 2024-11-27 12:13:57.931 593 [main] PekkoHttpServer INFO - Server online at http://0.0.0.0:8090/
dataplaneapi | time="2024-11-27T12:14:25Z" level=warning msg="Error setting up runtime client with socket: /var/run/haproxy.sock : cannot connect to runtime API /var/run/haproxy.sock within 30s: dial unix /var/run/haproxy.sock: connect: no such file or directory"
dataplaneapi | time="2024-11-27T12:14:25Z" level=warning msg="Runtime API not configured, not using it: cannot connect to runtime API /var/run/haproxy.sock within 30s: dial unix /var/run/haproxy.sock: connect: no such file or directory"
dataplaneapi | time="2024-11-27T12:14:26Z" level=info msg="Serving data plane at http://[::]:5555"
How can I resolve this issue and hit my scala service using HA Proxy Data Plane API?