apollographql / rover

The CLI for Apollo GraphOS
https://rover.apollo.dev
Other
408 stars 85 forks source link

`rover dev` inside docker error: the router was unable to start up - Connection refused #1865

Open marianoqueirel opened 8 months ago

marianoqueirel commented 8 months ago

Description

When run rover dev --supergraph-config supergraph.yaml --router-config router.yaml --log=trace inside a docker container created with docker compose the router fails with this error:

TRACE hyper::client::connect::http: connect error for 0.0.0.0:4000: ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })

When I run the same command from outside the docker container, i.e. from my localhost it works perfectly well.

Context

router.yaml

sandbox:
  enabled: false
supergraph:
  listen: 0.0.0.0:4000
homepage:
  enabled: true

supergraph.yaml

federation_version: =2.7.1
subgraphs:
  ol:
    routing_url: http:///host.docker.internal:3001/graphql
    schema:
      subgraph_url: http:///host.docker.internal:3001/graphql

dev-runtime.Dockerfile

FROM xxxxprivate-registry:node-18:latest

ENV HUSKY=0
ENV APOLLO_ELV2_LICENSE=accept

WORKDIR app 
RUN curl -sSL https://rover.apollo.dev/nix/v0.22.0| sh

ENV PATH=$PATH:/root/.rover/bin
ENV APOLLO_ROVER_DEV_COMPOSITION_VERSION=2.7.1
ENV APOLLO_ROVER_DEV_ROUTER_VERSION=1.40.1
ENV APOLLO_TELEMETRY_DISABLED=1
ENV APOLLO_UPLINK_POLL_INTERVAL="1000s"

ENTRYPOINT rover dev --supergraph-config supergraph.yaml --router-config router.yaml --log=trace

Expected result

The router should start exposing the provided supergraph

Full result

INFO rover::command::dev::compose: composition succeeded, updating the supergraph schema...
     at src/command/dev/compose.rs:119

    INFO rover::command::dev::compose: wrote updated supergraph schema to /tmp/supergraph.TLmhGWfRfaN2/supergraph.graphql
     at src/command/dev/compose.rs:136

   TRACE reqwest::blocking::wait: (ThreadId(8)) park without timeout
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.22/src/blocking/wait.rs:49

   TRACE mio::poll: registering event source with poller: token=Token(1), interests=READABLE
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.9/src/poll.rs:543

   TRACE reqwest::blocking::client: (ThreadId(13)) start runtime::block_on
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.22/src/blocking/client.rs:1066

    INFO rover::command::dev::router::command: starting `/root/.rover/bin/router-v1.40.1 --supergraph /tmp/supergraph.TLmhGWfRfaN2/supergraph.graphql --hot-reload --config /tmp/supergra
     at src/command/dev/router/command.rs:41

    INFO rover::command::dev::router::runner: spawning router with `/root/.rover/bin/router-v1.40.1 --supergraph /tmp/supergraph.TLmhGWfRfaN2/supergraph.graphql --hot-reload --config /t
     at src/command/dev/router/runner.rs:178

   TRACE reqwest::blocking::wait: wait at most 30s
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.22/src/blocking/wait.rs:16

   TRACE reqwest::blocking::wait: (ThreadId(8)) park timeout 29.999987s
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.22/src/blocking/wait.rs:42

   TRACE hyper::client::pool: checkout waiting for idle connection: ("http", 0.0.0.0:4000)
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/client/pool.rs:638

   DEBUG reqwest::connect: starting new connection: http://0.0.0.0:4000/
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.22/src/connect.rs:446

   TRACE hyper::client::connect::http: Http::connect; scheme=Some("http"), host=Some("0.0.0.0"), port=Some(Port(4000))
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/client/connect/http.rs:278

   DEBUG hyper::client::connect::http: connecting to 0.0.0.0:4000
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/client/connect/http.rs:537

   TRACE mio::poll: registering event source with poller: token=Token(140645013239296), interests=READABLE | WRITABLE
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.9/src/poll.rs:543

   TRACE mio::poll: deregistering event source from poller
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.9/src/poll.rs:674

   TRACE hyper::client::connect::http: connect error for 0.0.0.0:4000: ConnectError("tcp connect error", Os { code: 111, kind: ConnectionRefused, message: "Connection refused" })
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/client/connect/http.rs:544

   TRACE hyper::client::pool: checkout dropped for ("http", 0.0.0.0:4000)
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/client/pool.rs:680

   TRACE reqwest::blocking::wait: wait at most 30s
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.22/src/blocking/wait.rs:16

   TRACE reqwest::blocking::wait: (ThreadId(8)) park timeout 29.999987s
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.22/src/blocking/wait.rs:42

   TRACE hyper::client::pool: checkout waiting for idle connection: ("http", 0.0.0.0:4000)
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/client/pool.rs:638

   DEBUG reqwest::connect: starting new connection: http://0.0.0.0:4000/
     at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.22/src/connect.rs:446

   ..... more logs .... 

  INFO rover::command::dev::router::command: killing child with pid 23
     at src/command/dev/router/command.rs:116

   TRACE rover::command::dev::protocol::leader: main session sending leader message
     at src/command/dev/protocol/leader.rs:151

   TRACE rover::command::dev::protocol::leader: main session sent leader message
     at src/command/dev/protocol/leader.rs:157

   TRACE rover::command::dev::protocol::leader: main session waiting for follower message
     at src/command/dev/protocol/leader.rs:143

   TRACE rover::command::dev::protocol::follower::messenger: main session received leader message from channel
     at src/command/dev/protocol/follower/messenger.rs:148

 error: the router was unable to start up

Environment

Run rover info and paste the results here

graph-router-docker-compose  | Rover Info:
graph-router-docker-compose  | Version: 0.22.0
graph-router-docker-compose  | Install Location: /root/.rover/bin/rover
graph-router-docker-compose  | OS: Debian 10.0.0 [64-bit]
graph-router-docker-compose  | Shell: Unknown
dylan-apollo commented 7 months ago

Do you have an example of a public base image that causes this same issue? I'm unable to replicate on Debian 11 or 12 (10 does not work with the install script by default).