Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker compose support #217

Merged
merged 9 commits into from
Apr 19, 2023

Conversation

timcallaghan
Copy link
Contributor

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.

Signed-off-by: Tim Callaghan <timothy.callaghan@loanmarketgroup.com>
Update dev docs with information on defining a new platform

Signed-off-by: Tim Callaghan <timothy.callaghan@loanmarketgroup.com>
Signed-off-by: Tim Callaghan <timothy.callaghan@loanmarketgroup.com>
…support

# Conflicts:
#	cmd/webserver.go
#	pkg/instances/instances.go
@timcallaghan
Copy link
Contributor Author

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
Copy link

Zizico2 commented Oct 26, 2022

status?

@0GiS0
Copy link

0GiS0 commented Dec 11, 2022

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

1 similar comment
@zhupeng0929
Copy link

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

Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
cmd/dashboard.go Show resolved Hide resolved
pkg/components/components.go Outdated Show resolved Hide resolved
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
@codecov
Copy link

codecov bot commented Apr 19, 2023

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%) ⬇️

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

@timcallaghan
Copy link
Contributor Author

timcallaghan commented Apr 19, 2023

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
Copy link
Member

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
Copy link

Mamotchenko commented Apr 26, 2023

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
Copy link
Contributor Author

timcallaghan commented Apr 26, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants