bbonnin / pulsar-express

Simple Web Interface for Apache Pulsar
Apache License 2.0
110 stars 20 forks source link

Confusion about `PE_BASE_URL` env variable - UI requests localhost:3000 #20

Closed olivermack closed 4 years ago

olivermack commented 4 years ago

Hi there...

I've just came across an issue that seems very odd to me in the first place. I have a pulsar standalone container running in AWS ECS and it seems to work fine. Alongside I deployed a container of pulsar-express:latest - which itself is also serving the basic UI properly.

What I struggle with is the following: the UI issues requests for the connections to http://pulsar-express.example.com/api/connections and the pulsar-express container is responding successfully. For those parts which need to consume data from pulsar's REST API it issues requests to http://localhost:3000/api/admin/v2/clusters?u=http://pulsar.example.com:8080 which is obviously wrong.

I've seen the hint in the readme (https://github.com/bbonnin/pulsar-express#how-to) about changing the base url but I cannot figure out why this needs to be done at all. With this workaround I'd need to build + host my custom images of this tool - and actually the resolution of the base url seems to be working fine with those other local calls like the mentioned /api/connections request.

I didn't see where the localhost:3000 is taken from yet - but according to the Dockerfile it should default to /... or is it possible that the environment that currently builds the images that are uploaded to the docker hub provides localhost as build arg and thus overrides this default?

I'd appreciate any hints on this.

Best

bbonnin commented 4 years ago

Hi,

PE_BASE_URL is a env variable used to change the base URL of pulsar-express, not the whole URL. For example, by default, to access pulsar-express, you are using http://my-server:3000. If you set PE_BASE_URL with the value /pulsar-express, you will use http://my-server:3000/pulsar-express. As you can see in the following image, with a Docker image, I have no reference to localhost. I have just updated the image stored in Docker hub. You should try the new version.

HTH

Capture d’écran 2020-02-15 à 13 43 29
olivermack commented 4 years ago

Thanks, seems to work now!