artemiscloud / activemq-artemis-broker-image

ActiveMQ Artemis Broker Image Reposifory
Apache License 2.0
10 stars 14 forks source link

After running the container, it can *only* be accessed with a particular IP address #14

Closed pmorch closed 1 year ago

pmorch commented 3 years ago

I've described this issue on stackoverflow. An answer says this is by design, so I'm posting here.

Short version

When I run ActiveMQ Artemis in docker I see this basically empty screen:

empty screen

That doesn't look right... I was expecting this, like I get when using the zip file:

normal-looking activemq screen

Regardless of whether I use docker or the zip file, it doesn't matter what username or password I enter, I just get logged in regardless, which is a little concerning...

Quickly deploy a basic Container image that runs the broker suggests I should now be able to access the console as: http://localhost:8161/console/ , but an answer on stackoverflow suggest that I must use the URL printed in the log: http://172.17.0.3:8161/console .

If that is true, that is a problem because that URL is not accessible using Docker for Windows. Only http://localhost:8161/console and using the IP of the windows host.

I'm guessing this restriction is because launch.sh line 16 has ... --http-host $BROKER_IP ... and a previous line has: export BROKER_IP=\hostname -I | cut -f 1 -d ' '`` :-(

It is also possible, that the empty screen has a completely different cause. But I think the empty screen is a problem whatever the cause.

Longer Version

I'm attempting a "Hello World" style installation of ActiveMQ. It sounds like ActiveMQ Artemis is what I should be using. We'll be using this on Kubernetes, so I found and have followed https://artemiscloud.io/. There is a Quickly deploy a basic Container image that runs the broker right there on the front page. It suggests:

docker run -e AMQ_USER=admin -e AMQ_PASSWORD=admin -p80:8161 --name artemis quay.io/artemiscloud/activemq-artemis-broker:dev.latest

I changed the port to -p8161:8161 and run it using Docker for Windows. Visiting http://localhost:8161/console/ shows me the first screenshot above.

If I instead download from https://activemq.apache.org/components/artemis/download/ and follow https://activemq.apache.org/components/artemis/documentation/latest/using-server.html I get the second screenshot.

Regardless of whether I use docker or the zip file, it doesn't matter what username or password I enter, I just get logged in regardless.

Full docker console log

» docker run -e AMQ_USER=admin -e AMQ_PASSWORD=admin -p8161:8161 --name artemis quay.io/artemiscloud/activemq-artemis-broker:latest
Creating Broker with args --user XXXXX --password XXXXX --role admin --name broker --allow-anonymous --http-host 172.17.0.3 --host 172.17.0.3   --force
Creating ActiveMQ Artemis instance at: /home/jboss/broker

Auto tuning journal ...
done! Your system can make 1.44 writes per millisecond, your journal-buffer-timeout will be 696000

You can now start the broker by executing:  

   "/home/jboss/broker/bin/artemis" run

Or you can run the broker in the background using:

   "/home/jboss/broker/bin/artemis-service" start

Running Broker
     _        _               _
    / \  ____| |_  ___ __  __(_) _____
   / _ \|  _ \ __|/ _ \  \/  | |/  __/
  / ___ \ | \/ |_/  __/ |\/| | |\___ \
 /_/   \_\|   \__\____|_|  |_|_|/___ /
 Apache ActiveMQ Artemis 2.17.0

2021-05-27 21:23:44,556 INFO  [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
2021-05-27 21:23:44,605 INFO  [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
2021-05-27 21:23:44,650 INFO  [org.apache.activemq.artemis.core.server] AMQ221012: Using AIO Journal
2021-05-27 21:23:44,694 INFO  [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 1,073,741,824
2021-05-27 21:23:44,712 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2021-05-27 21:23:44,712 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
2021-05-27 21:23:44,713 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
2021-05-27 21:23:44,713 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
2021-05-27 21:23:44,713 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
2021-05-27 21:23:44,714 INFO  [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
2021-05-27 21:23:44,759 INFO  [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock
2021-05-27 21:23:44,760 INFO  [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock
2021-05-27 21:23:44,832 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address DLQ supporting [ANYCAST]
2021-05-27 21:23:44,839 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue DLQ on address DLQ
2021-05-27 21:23:44,880 INFO  [org.apache.activemq.artemis.core.server] AMQ221080: Deploying address ExpiryQueue supporting [ANYCAST]
2021-05-27 21:23:44,882 INFO  [org.apache.activemq.artemis.core.server] AMQ221003: Deploying ANYCAST queue ExpiryQueue on address ExpiryQueue
2021-05-27 21:23:45,148 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 172.17.0.3:61616 for protocols [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
2021-05-27 21:23:45,152 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 172.17.0.3:5445 for protocols [HORNETQ,STOMP]
2021-05-27 21:23:45,155 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 172.17.0.3:5672 for protocols [AMQP]
2021-05-27 21:23:45,158 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 172.17.0.3:1883 for protocols [MQTT]
2021-05-27 21:23:45,162 INFO  [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 172.17.0.3:61613 for protocols [STOMP]
2021-05-27 21:23:45,167 INFO  [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2021-05-27 21:23:45,168 INFO  [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.17.0 [broker, nodeID=d1043ae4-bf31-11eb-8c49-0242ac110003] 
2021-05-27 21:23:45,379 INFO  [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
2021-05-27 21:23:45,413 INFO  [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2021-05-27 21:23:45,625 INFO  [io.hawt.HawtioContextListener] Initialising hawtio services
2021-05-27 21:23:45,636 INFO  [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2021-05-27 21:23:45,638 INFO  [io.hawt.jmx.JmxTreeWatcher] Welcome to Hawtio 2.11.0
2021-05-27 21:23:45,643 INFO  [io.hawt.web.auth.AuthenticationConfiguration] Starting hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "admin" role principal classes: "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2021-05-27 21:23:45,656 INFO  [io.hawt.web.proxy.ProxyServlet] Proxy servlet is disabled
2021-05-27 21:23:45,660 INFO  [io.hawt.web.servlets.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation, value=file:/home/jboss/broker/etc/jolokia-access.xml]
2021-05-27 21:23:45,727 INFO  [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://172.17.0.3:8161
2021-05-27 21:23:45,727 INFO  [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://172.17.0.3:8161/console/jolokia
2021-05-27 21:23:45,728 INFO  [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://172.17.0.3:8161/console
2021-05-27 21:23:54,289 INFO  [io.hawt.web.auth.LoginServlet] Hawtio login is using 1800 sec. HttpSession timeout
2021-05-27 21:23:54,968 INFO  [io.hawt.web.auth.keycloak.KeycloakServlet] Keycloak integration is disabled
2021-05-27 21:24:00,270 INFO  [io.hawt.web.auth.LoginServlet] Logging in user: admin
pmorch commented 3 years ago

Hmmm. I don't remember assigning @RoddieKieley . Sorry if I did.

ErikJJonsson commented 3 years ago

Hi! Any progress on this issue?

/Erik

sweeguan-ng commented 3 years ago

@pmorch For the anonymous login, if you are using the docker, just add additional environment variable as below: AMQ_EXTRA_ARGS=--require-login, for the issue where any character you input, login is possible. There is similar configuration when you create your broker using zip file(windows) as well

For the blank screen issue, just found out that by utilizing on AMQ_EXTRA_ARGS too, on AMQ_EXTRA_ARGS=--host 0.0.0.0 , it should be able to render correctly after that, works for me in kubernetes.

ismaelgonval commented 2 years ago

I am preparing a Docker Compose for local development and I found the same issue of @pmorch.

I have disabled the Jolokia restrictions with docker run -e AMQ_EXTRA_ARGS='--relax-jolokia' .... Obviously, this is not a solution for production environments but works for dev environments.

@sweeguan-ng solution setting AMQ_EXTRA_ARGS=--host 0.0.0.0 did not work for me.

sweeguan-ng commented 2 years ago

I am preparing a Docker Compose for local development and I found the same issue of @pmorch.

I have disabled the Jolokia restrictions with docker run -e AMQ_EXTRA_ARGS='--relax-jolokia' .... Obviously, this is not a solution for production environments but works for dev environments.

@sweeguan-ng solution setting AMQ_EXTRA_ARGS=--host 0.0.0.0 did not work for me.

Hey, i typed it wrongly, it should be --http-host 0.0.0.0 instead of --host 0.0.0.0

ismaelgonval commented 2 years ago

Hey, i typed it wrongly, it should be --http-host 0.0.0.0 instead of --host 0.0.0.0

Tried both (combined and separated) without luck using WSL2 (Docker Desktop) since the redirection to 0.0.0.0 from Windows does not work. @pmorch commented this in Stackoverflow too.

I suppose that works when you are not using Docker Desktop. In the end, I just use --relax-jolokia for local development, that seems to fix the issue in my environment.

pmorch commented 2 years ago

I'm unsubscribing from this issue, as I'm no longer considering use of activemq - primarily for this reason - but am using rabbitmq instead.

At least when I wrote the issue, it was valid, but if you want to close this issue because it no longer is an issue for me, for my sake feel free to do so.

simasch commented 1 year ago

Any news on that issue. The problem is still relevant when using Docker on Windows.

hguerrero commented 1 year ago

Hey, y'all!

This is my working command on Windows WSL2 (Docker Desktop)

docker run --rm -e AMQ_USER=admin -e AMQ_PASSWORD=admin123 -e AMQ_EXTRA_ARGS='--relax-jolokia --http-host 0.0.0.0' -p8161:8161 --name artemis quay.io/artemiscloud/activemq-artemis-broker:latest

As you can see, I'm using --http-host and --relax-jolokia to have a working environment.

image

simasch commented 1 year ago

@hguerrero Works! Thank you very much.

brusdev commented 1 year ago

@hguerrero thanks for your solution