dapr / dashboard

General purpose dashboard for Dapr
Apache License 2.0
181 stars 47 forks source link

Add docker compose support #217

Closed timcallaghan closed 1 year ago

timcallaghan commented 2 years ago

Addresses #172

Adds support for running Dapr Dashboard inside a docker compose network.

Configuration and Component files are bind mounted to the dashboard container and parsed using similar techniques to the Standalone platform type.

Enumeration of daprd services is done by parsing the docker-compose.yml file and looking for daprd image references.

Metadata fetching is done via first resolving the daprd service location on the docker compose network (using mDNS Dapr component), and then fetching. Consideration has also been given to the case when the daprd service is protected via an API token.

Readme has been updated with instructions on how to target this new platform type.

timcallaghan commented 2 years ago

Hi @berndverst and @artursouza - I'd love to work through the process of getting this approved and merged. Do either of you have any capacity to review? This is my first time using Golang so I'd really appreciate a review and guidance on anything that can be made better πŸ˜„

Zizico2 commented 1 year ago

status?

0GiS0 commented 1 year ago

Any news on this? I think is really helpful to see the dashboard in this environment

zhupeng0929 commented 1 year ago

Any news on this? I think is really helpful to see the dashboard in this environment

codecov[bot] commented 1 year ago

Codecov Report

Merging #217 (773de50) into master (bd475ec) will decrease coverage by 3.57%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #217      +/-   ##
==========================================
- Coverage   14.02%   10.45%   -3.57%     
==========================================
  Files           7        7              
  Lines         492      660     +168     
==========================================
  Hits           69       69              
- Misses        417      585     +168     
  Partials        6        6              
Impacted Files Coverage Ξ”
pkg/components/components.go 0.00% <0.00%> (ΓΈ)
pkg/configurations/configurations.go 0.00% <0.00%> (ΓΈ)
pkg/instances/instances.go 10.23% <0.00%> (-3.55%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

timcallaghan commented 1 year ago

Woo thanks for taking a look at this πŸ™‡ @artursouza would you like me to add tests to fix the coverage issues or are you taking it from here?

artursouza commented 1 year ago

Woo thanks for taking a look at this πŸ™‡ @artursouza would you like me to add tests to fix the coverage issues or are you taking it from here?

Please, submit a new PR. We will merge this one.

Mamotchenko commented 1 year ago

I have a question about it because I cannot setup it properly or it does not work properly (according to readme.md file)

What I did:

1. I user EShopOnDapr repository https://github.com/dotnet-architecture/eShopOnDapr 2. Added code from readme.md to run DAPR Dashboard.

Code what I added to docker-compose.yml file (copy of dapr-dashboard from readme.md file + few small changes related to files paths):

dapr-dashboard:
    image: "daprio/dashboard:edge" **<-- edge instead of latest because latest was updated 2 months ago and does not have this PR code.**
    command: [ "--docker-compose=true", 
      "--components-path=/home/nonroot/components", 
      "--config-path=/home/nonroot/configuration", 
      "--docker-compose-path=/home/nonroot/docker-compose.yml" ]
    ports:
      - "8080:8080"
    volumes:
      - "./dapr/components/:/home/nonroot/components"
      - "./dapr/configuration/:/home/nonroot/configuration"
      - ./docker-compose.yml:/home/nonroot/docker-compose.yml

image

3. Ran the solution.

All DAPR configuration files and docker-compose.yml file were copied to container, so all looks good at this point.

image

HealthCheck looks good and DAPR is healthy for all services:

image

image

DAPR Dashboard components looks good:

image

But there are no applications:

image

This is what api/version API returns: image

image

{"error":"fork/exec /home/nonroot/.dapr/bin/daprd: no such file or directory"}

And what I have in DAPR Dashboard container logs: image

I tested DAPR Dashboard with daprio/dapr v1.8.0 v1.9.4 v1.10.4 and results were the same - no applications at all.

Have I done something wrong?

timcallaghan commented 1 year ago

Hi @Mamotchenko - thanks for the very detailed report!

Have I done something wrong?

Nope, not at all - turns out when I originally created the PR the lib that we're using to load and parse the docker compose file wasn't particularly strict about certain aspects of the compose file. It appears that the lib has been updated and now enforces some stricter constraints - especially one relating to being able to determine the "name" of the compose file, and that in turn requires that the Environment configuration param be set to non-nil.

I recently discovered exactly this bug during the process of writing test coverage, which I've fixed - see https://github.com/dapr/dashboard/pull/252/files#diff-c42e35179b901209bf32a2f7bb15b863e042304762b027b8ea7e81ec8d236bd2

Once the test coverage PR (and bug fix) is approved and merged I think this will solve your issue 🀞

FYI @artursouza - the code coverage PR needs to be merged to make this actually work with the latest libs we're using.