graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

Cannot use container name for redis cache

Open Mehdi-Mani opened this issue 1 year ago • 10 comments

As the moment passing the container name for redis cache like this:

cache:
  redis:
    port: "6379"
    host: "redismesh"
    password: "redis"

it will not resolve to the IP of the container.

Mehdi-Mani avatar Jan 23 '23 15:01 Mehdi-Mani

Could you please create a reproduction? Thanks!

ardatan avatar Jan 23 '23 16:01 ardatan

here is part of the docker compose file:

  graphqlmesh:
    depends_on:
      - redismesh
    container_name: graphqlmesh
    build:
      context: ./mesh
      dockerfile: Dockerfile
    ports:
      - 3002:3002
    volumes:
      - ./mesh:/usr/app
  redismesh:
    container_name: redismesh
    image: "bitnami/redis:latest"
    ports:
      - "3003:6379"
    environment:
      - REDIS_PASSWORD=redis
    volumes:
      - ./redis/data:/bitnami/redis/data
      - ./redis/conf/overrides.conf:/opt/bitnami/redis/mounted-etc/overrides.conf

here is my .meshrc.yaml :

sources:
  - name: expresstest
    handler:
      jsonSchema:
        endpoint: http://express:3001
        operations:
          - type: Query
            field: user
            path: /user
            method: GET
            responseSample: ./json-samples/user.json
            responseTypeName: User
transforms:
  - filterSchema:
      mode: wrap
      filters:
        - User.!name
plugins:
  - responseCache: {}
  - prometheus:
      requestCount: true
      requestSummary: true
      parse: true
      validate: true
      contextBuilding: true
      execute: true
      errors: true
      resolvers: true
      deprecatedFields: true
    # endpoint: /metrics
serve:
  port: 3002
  hostname: 0.0.0.0
cache:
  redis:
    port: "6379"
    host: "redismesh"
    password: "redis"

on graphql mesh start, no configuration error is printed, but on launch of Yoga graphiQL and attempts at fetching the schema i get timed out error. image

Mehdi-Mani avatar Jan 23 '23 16:01 Mehdi-Mani

Could you provide a minimal isolated reproduction on GitHub at least as we asked in our bug report template? https://github.com/Urigo/graphql-mesh/issues/new?assignees=&labels=&template=bug_report.md

ardatan avatar Jan 23 '23 16:01 ardatan

Here is a reproduction in codsandbox link here First issue i ever opened, please inform me if there is anything else i should add.

Mehdi-Mani avatar Jan 23 '23 17:01 Mehdi-Mani

Sorry for late response but I cannot access the link you shared. Maybe you can create a reproduction on GitHub.

ardatan avatar Apr 03 '23 10:04 ardatan

yes, link is dead. i'll try to make permanant repo for it

Mehdi-Mani avatar Apr 05 '23 11:04 Mehdi-Mani

I've managed to setup a repo with a minimal exemple. As previously mentioned when i refer to redis container with the container name, GraphQL mesh won't resolve it to proper adress and logs an error in terminal. Replacing it with actual IP (found through docker inspect), does not produce an error on request and i assume is working properly. https://github.com/Mehdi-Mani/MeshTest2023

Mehdi-Mani avatar Apr 11 '23 12:04 Mehdi-Mani

@Mehdi-Mani Did you manage to fix the issue? I also have the same problem with my setup to use redis with GraphQL-Mesh

mnlbox avatar Jun 01 '23 13:06 mnlbox

@mnlbox Unfortunaly no. I was currently using Mesh for an end of studies project and i could afford bypassing the issue all together for my presentation demo. Hopefuly since it is currently roadmap, a fix will eventualy be released.

Mehdi-Mani avatar Jun 01 '23 13:06 Mehdi-Mani

@ardatan @Mehdi-Mani As Mesh also using ioredis maybe related: 🤔 https://github.com/luin/ioredis/issues/763

mnlbox avatar Jun 05 '23 08:06 mnlbox