[ 
https://issues.apache.org/jira/browse/ARTEMIS-3915?focusedWorklogId=801799&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-801799
 ]

ASF GitHub Bot logged work on ARTEMIS-3915:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Aug/22 19:27
            Start Date: 18/Aug/22 19:27
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on PR #4179:
URL: 
https://github.com/apache/activemq-artemis/pull/4179#issuecomment-1219867590

   Couple of things:
   
    - Ideally the broker would automatically detect the use of the proxy 
protocol by a client. We already do lots of automatic protocol detection so 
that a single `acceptor` can support multiple messaging protocols plus 
WebSockets and HTTP. See 
`org.apache.activemq.artemis.core.protocol.ProtocolHandler` for implementation 
details. Having a static configuration means that the `acceptor` could only be 
used by clients communicating via the proxy protocol (or not). This would 
increase configuration complexity and potentially lead to confusion for clients.
    - I don't see any code that actually makes use of the proxy protocol's 
additional information. Is Netty supposed to handle this transparently so that 
`io.netty.channel.Channel#remoteAddress` returns the client's actual address 
rather than the address of the proxy?
   
   > Is there any way to run the broker locally, so I can test the workflow 
with an HAProxy local instance (i.e. docker)?
   
   I'm not quite sure what you're asking here. The broker can be run locally 
standalone using the normal distribution available from the website. The broker 
can be embedded and run just as you're doing in the test code you pasted. The 
broker can also be run via Docker as described 
[here](https://github.com/apache/activemq-artemis/tree/main/artemis-docker).
   
   > Which kind of tests should I develop for this change?
   
   A basic sanity check for each messaging protocol would be a good place to 
start. Something that just sends and consumes a message. 
   
   Of course, you'd start first with manual testing. I'd recommend using your 
own instance of HAProxy with the `artemis consumer` and `artemis producer` 
commands.
   
   Ultimately, though, we need tests in the test-suite to validate the 
functionality for each release and to mitigate against regressions. However, 
this may be difficult as I don't see any kind of Java implementation for 
HAProxy which you could embed and use for testing. You may need to implement 
something of your own here to act like HAProxy using Netty and 
`io.netty.handler.codec.haproxy.HAProxyMessageEncoder`. 
   
   Hope that helps!




Issue Time Tracking
-------------------

    Worklog Id:     (was: 801799)
    Time Spent: 20m  (was: 10m)

> Support Proxy protocol (HAProxy) on Artemis acceptors
> -----------------------------------------------------
>
>                 Key: ARTEMIS-3915
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3915
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>            Reporter: João Santos
>            Priority: Minor
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> [HAProxy|http://www.haproxy.org/] is a widely known and used TCP Load 
> Balancer and especially useful for an ActiveMQ Artemis clustered environment.
> Although possible to functionally implement with both products current 
> features, Artemis does not support the PROXY protocol, which prevents it's 
> broker nodes from inferring the real remote client IP address when behind an 
> HAProxy instance.
> Since Netty sockets implementation already seems to support this protocol 
> (discussed w/ [~jbertram] on DEV mailing list), it shouldn't be a big leap to 
> adding support for the protocol on Artemis acceptors, thus improving the 
> deployment of the use case at hand.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to