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

Cannot use container name for redis cache #5060

Open
Mehdi-Mani opened this issue Jan 23, 2023 · 10 comments
Open

Cannot use container name for redis cache #5060

Mehdi-Mani opened this issue Jan 23, 2023 · 10 comments

Comments

@Mehdi-Mani
Copy link

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.

@ardatan
Copy link
Owner

ardatan commented Jan 23, 2023

Could you please create a reproduction? Thanks!

@Mehdi-Mani
Copy link
Author

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

@ardatan
Copy link
Owner

ardatan commented Jan 23, 2023

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

@Mehdi-Mani
Copy link
Author

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

@ardatan
Copy link
Owner

ardatan commented Apr 3, 2023

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

@Mehdi-Mani
Copy link
Author

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

@Mehdi-Mani
Copy link
Author

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

@mnlbox
Copy link

mnlbox commented Jun 1, 2023

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

@Mehdi-Mani
Copy link
Author

@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.

@mnlbox
Copy link

mnlbox commented Jun 5, 2023

@ardatan @Mehdi-Mani As Mesh also using ioredis maybe related: 🤔
redis/ioredis#763

This was referenced Apr 30, 2024
This was referenced May 7, 2024
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

No branches or pull requests

3 participants