TreeGateway / tree-gateway

This is a full featured and free API Gateway
http://treegateway.com
MIT License
189 stars 42 forks source link

Docker image problem - [ioredis] Unhandled error event #172

Closed mdzidic closed 5 years ago

mdzidic commented 5 years ago

Hello,

After running simple Docker setup of TreeGateway treegateway/tree-gateway:latest + redis:4.0.14-alpine I encounter this error:

[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)

I've fixed this issue updating host and port variables inside tree-gateway.json

This should be handled via Docker Environment variables.

thiagobustamante commented 5 years ago

This should be handled via Docker Environment variables.

Yes. It can be handled as environment variables. Inside gateway configuration file, it is possible to refer to any environment variable, so, you can configure your gateway with something like:

rootPath: '.'
database:
    redis:
        standalone:
            host: '{REDIS_PORT_6379_TCP_ADDR}'
            port: '{REDIS_PORT_6379_TCP_PORT}'

or any other environment variable.

mdzidic commented 5 years ago

Thanks, It works as supposed to.

  treegateway:
    image: treegateway/tree-gateway:latest 
    ports:
    - "8000:8000"
    - "8001:8001"
    networks:
    - treegateway
    environment:
    - REDIS_PORT_6379_TCP_ADDR=redis
    - REDIS_PORT_6379_TCP_PORT=6379
    depends_on:
    - redis

This should be added on wiki page as available Docker environment variables.