You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/10/18 16:03:25 UTC

[GitHub] [pulsar] cdbartholomew opened a new issue #5415: Dashboard doesn't work in pulsar-standalone docker image

cdbartholomew opened a new issue #5415: Dashboard doesn't work in pulsar-standalone docker image
URL: https://github.com/apache/pulsar/issues/5415
 
 
   **Describe the bug**
   If you run the pulsar-standalone docker image, which bundles the dashboard with pulsar, the dashboard collecter fails to run, with this error:
   
   ```
   Traceback (most recent call last):
     File "./collector.py", line 58, in fetch_broker_stats
       _fetch_broker_stats(cluster, broker_url, timestamp)
     File "./collector.py", line 76, in _fetch_broker_stats
       topics_stats = get(broker_url, '/admin/v2/broker-stats/destinations')
     File "./collector.py", line 41, in get
       proxies=http_proxyes,
     File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 897, in json
       return complexjson.loads(self.text, **kwargs)
     File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
       return _default_decoder.decode(s)
     File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
       obj, end = self.raw_decode(s, idx=_w(s, 0).end())
     File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
       raise ValueError("No JSON object could be decoded")
   ValueError: No JSON object could be decoded
   ```
   
   The issue is that the endpoint `/admin/v2/broker-stats/destinations` doesn't exist. In the V2 API, the endpoint was renamed to `/admin/v2/broker-stats/topics`. The fix is a simple replacement of "destinations" with "topics" in `collector.py`.
   
   While investigating this, I noticed this change was made in PR #3657, which made its way into the Docker image in 2.4.0:
   ```
   workspace ~/pulsar/docker $ docker run -it apachepulsar/pulsar-standalone:2.3.1 grep destinations /pulsar/django/collector.py
       topics_stats = get(broker_url, '/admin/broker-stats/destinations')
   workspace ~/pulsar/docker $ docker run -it apachepulsar/pulsar-standalone:2.4.0 grep destinations /pulsar/django/collector.py
       topics_stats = get(broker_url, '/admin/v2/broker-stats/destinations')
   ```
   I was wondering why the Pulsar dashboard works for anyone after this change was made. I was baffled for a while, until I realized the repo has 2 copies of `collector.py`, which, believe me, is confusing. 
   
   The main dashboard image is built from the files in `dashboard/django`. The `collector.py` in that directory was not modified by PR #3657. So, the main dashboard Docker image is fine.
   
   However, for building the pulsar-standalone Docker image, the `docker/pulsar-standalone/django` directory is used. That file was modified (incorrectly) in #3657. There really should be a single source for the these Django files.
   
   I think it would be possible to modify the pulsar-standalone Dockerfile to use the main `dashboard/django` files when building the pulsar-standalone Docker image. Then the changes made in the two copies of `collector.py` can be merged into a single file.
   
   I will put together a PR with changes to this effect.
   
   **To Reproduce**
   
   You just need to run the pulsar-standalone Docker image. This is how I do it:
   
   ```
   docker run \
   	-p 6650:6650 -p 8081:8080 -p 80:80\
   	-d --rm \
   	--name pulsar-standalone  \
   	--mount source=pulsardata,target=/pulsar/data \
           --mount source=pulsarconf,target=/pulsar/conf \
   	apachepulsar/pulsar-standalone:2.4.1 
   ```
   
   **Expected behavior**
   The dashboard should work in this Docker image, since that seems to be the point of it. It is essentially pulsar-all image plus the dashboard.
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services