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

Running with Docker-compose #38

Closed
cecilphillip opened this issue Jul 3, 2020 · 14 comments
Closed

Running with Docker-compose #38

cecilphillip opened this issue Jul 3, 2020 · 14 comments
Assignees
Labels
question Further information is requested

Comments

@cecilphillip
Copy link

I've built an image (dapr_dashboard_cp) using the instructions in the Readme and run a container image for the dashboard, but I am unable to see any components showing up with my docker-compose configuration. Is there something else that needs to be set?

I can see calls being made to http://localhost:8080/api/instances and http://localhost:8080/api/controlplanestatus but the payload only contains an empty JSON array.

  #####  API & DAPR Sidecar #####
  productsapi:
    build:
      context: ./src/ContosoCrafts.ProductsApi
      dockerfile: Dockerfile
    volumes:
      - ~/.aspnet/https:/https:ro
    ports:
      - "90:80"
      - "91:443"
    depends_on:
      - mongodb

  productsapi_dapr:
    image: "daprio/daprd:0.8.0"
    command:
      [
        "./daprd",
        "-app-id",
        "productsapi",
        "-app-port",
        "80",
        "-placement-address",
        "placement:6000",
        "-components-path",
        "/components",
      ]
    volumes:
      - "./components/:/components"
    depends_on:
      - website
    network_mode: "service:productsapi"

dashboard:
    image: dapr_dashboard_cp:latest
    container_name: dashboard
    ports:
      - "8080:8080"

 placement:
    image: "daprio/placement:0.8.0"
    container_name: "placement"
    command: ["./placement", "-port", "6000"]
    ports:
      - "6000:6000"

redis:
    image: "redis:6.0.5-alpine"
    ports:
      - "6379:6379"

networks:
  default:
    name: dapr_network
    driver: bridge
@yaron2
Copy link
Member

yaron2 commented Jul 3, 2020

If you want to use the dashboard on k8s, it has to run inside the cluster, and locally you cannot run it with Docker since the container doesn't have access to your host machine.

@cecilphillip
Copy link
Author

@yaron2 If everything else is running with docker-compose, how would I point the dashboard at my environment?

also I'm wondering why does it need access to my host machine?

@yaron2
Copy link
Member

yaron2 commented Jul 3, 2020

@yaron2 If everything else is running with docker-compose, how would I point the dashboard at my environment?

also I'm wondering why does it need access to my host machine?

If you are running Dapr instances locally without Docker, then a dashboard running in a container would need access to localhost to talk to the Dapr instances.

The dashboard doesn't work in a Docker compose setting where containers are isolated (bridge network mode, without a Docker network). This is not related to the dashboard but more to the Docker network setup. It may be possible to set up with the correct Docker network setting, but this needs to be tried out.

/cc @willdavsmith @shalabhms

@cecilphillip
Copy link
Author

cecilphillip commented Jul 23, 2020

@willdavsmith @shalabhms can I show you what I'm doing and maybe we can figure out this scenario. If we can get it working, I think it would beneficial customers, especially if we can add some docs around it.

@cecilphillip
Copy link
Author

@shalabhms @yaron2 any thoughts on this? It would be nice to show this off to folks when I do multi-container demos that aren't in kubernetes

@orizohar
Copy link

orizohar commented Oct 2, 2020

@artursouza - can you look at this?

@artursouza artursouza added the question Further information is requested label Oct 15, 2020
@artursouza
Copy link
Member

@cecilphillip I've made some changes to the dashboard code to allow to work with K8s from outside the cluster, as long as the K8s API is accessible. If the host can access the k8s cluster via kubectl, then it will also work with dashboard. You need to set the DAPR_DASHBOARD_KUBECONFIG environment variable pointing to your kubeconfig file.

@artursouza artursouza self-assigned this Jan 11, 2021
@artursouza
Copy link
Member

@cecilphillip Please, reopen if issue persists.

@ChristianWeyer
Copy link

@cecilphillip did you ever successfully get the Dapr dashboard working with docker compose?
Thanks!

@spottedmahn
Copy link

I've made some changes to the dashboard code to allow to work with K8s from outside the cluster

I'm confused. The ask is about using docker-compose so how does that relate to K8? 🤔

And more importantly, like ChristianWeyer said, how can we get the dashboard running via docker compose?

@cecilphillip
Copy link
Author

@ChristianWeyer nah, I gave up on showing the Dashboard in docker-compose.

@timcallaghan
Copy link
Contributor

I would also like this ability i.e. run the dashboard inside a docker compose network and have it report on dapr services also running inside the same docker network.

I believe the reason it doesn't work is because the dashboard currently only supports two ways of enumerating the dapr services:

  • When running locally (i.e. platform == standalone) it discovers dapr services by way of inspecting the processes running on the host (see https://github.com/dapr/cli/blob/master/pkg/standalone/list.go#L65 ) - because the "host" is just the dashboard container when running inside docker compose it is unable to see other dapr processes running on the same docker compose network
  • When running inside k8s (i.e. platform == kubernetes) it discovers dapr services by way of inspecting k8s deployments and config through the central k8s registry

What I believe is needed here is a 3rd platform option for "docker-compose" that is able to enumerate dapr services on the same docker compose network. Alternatively it could accept additional configuration that declares where the dapr services reside on the compose network so it doesn't actually need to enumerate and instead is told where they are.

@timcallaghan
Copy link
Contributor

Hi @artursouza - I've had a go at implementing this. Verified working locally with docker compose.
Commit is here timcallaghan@7ad34c2
I'd be happy to submit a PR if that's acceptable?

@timcallaghan
Copy link
Contributor

This is being tracked in #172

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

No branches or pull requests

7 participants