Closed rishighan closed 2 months ago
Hello,
I have the following docker-compose setup:
docker-compose
x-userdata-volume: &userdata-volume type: bind source: ${USERDATA_DIRECTORY} target: /userdata x-comics-volume: &comics-volume type: bind source: ${COMICS_DIRECTORY} target: /comics services: core-services: build: # context: https://github.com/rishighan/threetwo-core-service.git context: ./ dockerfile: Dockerfile image: frishi/threetwo-core-service container_name: core-services ports: - "3000:3000" - "3001:3001" depends_on: - db - redis - elasticsearch - kafka - zookeeper environment: name: core-services SERVICES: api,library,jobqueue,settings,search,socket,imagetransformation,torrentjobs,opds env_file: docker-compose.env volumes: - *comics-volume - *userdata-volume networks: - proxy zookeeper: image: zookeeper:latest container_name: zookeeper ports: - "2181:2181" networks: - proxy kafka: image: apache/kafka:latest container_name: kafka ports: - "9092:9092" environment: KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka:9093,OUTSIDE://localhost:9092 KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT KAFKA_LISTENERS: INSIDE://0.0.0.0:9093,OUTSIDE://0.0.0.0:9092 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 volumes: - /var/run/docker.sock:/var/run/docker.sock depends_on: - zookeeper networks: - proxy db: image: "bitnami/mongodb:latest" container_name: database networks: - proxy ports: - "27017:27017" volumes: - "mongodb_data:/bitnami/mongodb" redis: image: "bitnami/redis:latest" container_name: redis environment: ALLOW_EMPTY_PASSWORD: "yes" networks: - proxy ports: - "6379:6379" elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2 container_name: elasticsearch environment: - "discovery.type=single-node" - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - "xpack.security.enabled=true" - "xpack.security.authc.api_key.enabled=true" - "ELASTIC_PASSWORD=password" ulimits: memlock: soft: -1 hard: -1 ports: - 9200:9200 networks: - proxy networks: proxy: external: true volumes: mongodb_data: driver: local elasticsearch: driver: local
I want core-services to use the redis service as the transporter and to that end, the docker-compose.env is set up like so:
core-services
redis
docker-compose.env
NAMESPACE= LOGGER=true LOGLEVEL=info SERVICEDIR=dist/services COMICS_DIRECTORY=/Users/rishi/work/threetwo-core-service/comics USERDATA_DIRECTORY=/Users/rishi/work/threetwo-core-service/userdata REDIS_URI=redis://redis:6379 ELASTICSEARCH_URI=http://elasticsearch:9200 MONGO_URI=mongodb://mongo:27017/threetwo UNRAR_BIN_PATH=/opt/homebrew/bin/unrar SEVENZ_BINARY_PATH=/opt/homebrew/bin/7za CACHER=Memory
However, when I try to pull the stack up, env $(cat docker-compose.env | xargs) docker-compose up I get this error:
env $(cat docker-compose.env | xargs) docker-compose up
core-services | Error: connect ECONNREFUSED 127.0.0.1:6379 core-services | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16) { core-services | errno: -111, core-services | code: 'ECONNREFUSED', core-services | syscall: 'connect', core-services | address: '127.0.0.1', core-services | port: 6379 core-services | }
Now, REDIS_URI has been explicitly set to the URL facilitated by Docker DNS, which is redis://redis:6379. So I am at a loss trying to figure out why moleculer transporter defaults to 127.0.0.1
REDIS_URI
redis://redis:6379
moleculer
127.0.0.1
What gives here?
REDIS_URI is not the correct env value, you should set TRANSPORTER=redis://.... like here:
TRANSPORTER=redis://....
https://github.com/moleculerjs/moleculer-template-project/blob/fa9ba08d05469510a1ce26f1901eed9a1247dbfd/template/docker-compose.env#L10
Hello,
I have the following
docker-compose
setup:I want
core-services
to use theredis
service as the transporter and to that end, thedocker-compose.env
is set up like so:However, when I try to pull the stack up,
env $(cat docker-compose.env | xargs) docker-compose up
I get this error:Now,
REDIS_URI
has been explicitly set to the URL facilitated by Docker DNS, which isredis://redis:6379
. So I am at a loss trying to figure out whymoleculer
transporter defaults to127.0.0.1
What gives here?