https://dagster.io/ logo
#ask-community
Title
# ask-community
s

Salina Wu

03/22/2022, 2:16 AM
Hi all! I'm trying to connect my local dagit to a docker container that's running my local user code. I'm not sure how to configure my workspace.yaml with the correct
grpc_server
arguments - I'm confused by what
location_name
should be. could someone please advise?
d

daniel

03/22/2022, 2:32 PM
Hi Salina - location_name can be any name you want, it's just for identifying your repository location in dagit: https://docs.dagster.io/concepts/repositories-workspaces/workspaces#identifying-repository-locations For a local gRPC server I think your workspace.yaml would look something like:
Copy code
load_from:
  - grpc_server:
      host: localhost
      port: 3456
      location_name: your_location_name_here
(assuming that your docker container is exposing that port so that it's reachable on the local machine). You can verify that a gRPC server is running on the host/port that you expect by running
Copy code
dagster api grpc-health-check -p 3456 -h localhost
(replacing the port and host value with yours)
s

Salina Wu

03/22/2022, 3:20 PM
Thanks for getting back to me! Seems like my server isn't running as expected. When I try to run the health check, I get this error:
Copy code
<_InactiveRpcError of RPC that terminated with:
	status = StatusCode.UNAVAILABLE
	details = "failed to connect to all addresses"
	debug_error_string = "{"created":"@1647962388.210395000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3129,"referenced_errors":[{"created":"@1647962388.210394000","description":"failed to connect to all addresses","file":"src/core/lib/transport/error_utils.cc","file_line":163,"grpc_status":14}]}"
>
the command I run is this:
Copy code
dagster api grpc-health-check -p 4000 -h 0.0.0.0
and my dockerfile, which I built and ran (I see it running in docker and I see this in the terminal window `2022-03-22 151931 +0000 - dagster.code_server - INFO - Started Dagster code server for file ops.py on port 4000 in process 1`:
Copy code
FROM python:3.9

ENV DAGSTER_HOME=/opt/dagster/dagster_home

RUN mkdir -p $DAGSTER_HOME

COPY dagster.yaml $DAGSTER_HOME

# Add repository code

WORKDIR /opt/dagster/app

COPY ./* /opt/dagster/app

# ==> Add Dagster layer
RUN \
# Cron
       apt-get update -yqq \
    && apt-get install -yqq cron \
# install requirements
    && pip install -r /opt/dagster/app/requirements.txt

# Run dagster gRPC server on port 4000

EXPOSE 4000

# Using CMD rather than ENTRYPOINT allows the command to be overridden in
# run launchers or executors to run other commands using this image
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4000", "-f", "ops.py"]
any ideas what might be the issue?
d

daniel

03/22/2022, 3:22 PM
No problem - so the problem that we need to solve is figuring out why the server isn't exposed on that port as expected
s

Salina Wu

03/22/2022, 3:23 PM
yup! just added more context, hopefully it is helpful
d

daniel

03/22/2022, 3:25 PM
What if you try localhost rather than 0.0.0.0 in the healthcheck command?
s

Salina Wu

03/22/2022, 3:27 PM
no dice 😕
I tried not including the
-h 0.0.0.0
flag in the dockerfile cmd as well, with both localhost and 0.0.0.0 in the healthcheck, still nothing
d

daniel

03/22/2022, 3:29 PM
Have you run other services on an exposed port in your docker environment before? Trying to determine if this is something about dagster's setup or a change that needs to make in your docker setup
There are some general tips here (not specific to dagster) about using docker ps to verify that the port is exposed correctly https://stackoverflow.com/questions/54940990/docker-cant-connect-to-container-exposed-port
(127.0.0.1 seems to work better than 0.0.0.0 in some situations)
s

Salina Wu

03/22/2022, 3:38 PM
I don't think I have run other services in this docker env before - let me look at that post and do some more digging into the docker side, and I'll also try 127.0.0.1 and get back to you. thank you so much for helping 🙌🏼
I just tried running the grpc server from my command line (
dagster api grpc -h 0.0.0.0 -p 4000 -f ops.py
) and then ran the healthcheck, and nothing came back - is that expected? looks like it's probably something to do with my docker run after all
d

daniel

03/22/2022, 3:48 PM
the health check command finishing with no error means it's working
So yeah, likely an issue with the port not actually reachable from docker
s

Salina Wu

03/22/2022, 4:33 PM
found out the issue - I needed to map the docker port to my local
Copy code
docker run -p 4000:4000 dagster_user_code:v3
d

daniel

03/22/2022, 4:34 PM
Ah, got it. That makes sense now that you mention it, I'm used to running it in docker-compose where it's configured in the docker-compose file rather than on the command line
1
2 Views