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

Consul configration with docker-compose #152

Open
murtaza-khan opened this issue Oct 20, 2020 · 5 comments
Open

Consul configration with docker-compose #152

murtaza-khan opened this issue Oct 20, 2020 · 5 comments

Comments

@murtaza-khan
Copy link

@juicycleff hi,

I have just cloned this Repo and creating a build with docker-compose for accounts service with the consul and trying to run.
But I am facing an issue with the accounts service for the consul setting kv.get.
image

I have tried both methods.
1- Setting up the consul manually before running the command docker-compose for a build.
2- And configuration consul in the docker-compose-dev.yaml file.

Butt I am facing the same issue key-value Error: consul: kv.get: connect ECONNREFUSED 127.0.0.1:8500
I am pasting my docker-compose.dev.ymal configuration.

version: "3.2"

services:
  service-account:
    build:
      context: .
      dockerfile: apps/service-account/Dockerfile
      args:
        NODE_ENV: development
    image: "service-account:latest"
    restart: always
    depends_on:
      - consul
      - redis
    environment:
      - CONSUL_HOST=consul
      - NATS_HOST=nats
      - DISCOVERY_HOST=localhost
    ports:
      - 50054:50054
    labels:
      kompose.service.type: clusterip
      kompose.image-pull-secret: "gitlabregcrednew"
      kompose.image-pull-policy: "Always"
   consul:
    container_name: consul
    ports:
      - "8400:8400"
      - "8500:8500"
      - "8600:53/udp"
    image: consul
    command: ["agent", "-server", "-bootstrap", "-ui", "-client", "0.0.0.0"]
    labels:
      kompose.service.type: nodeport
      kompose.service.expose: "true"
      kompose.image-pull-policy: "Always"

  eventstore:
    container_name: eventstore
    ports:
      - "2113:2113"
      - "1113:1113"
    image: eventstore/eventstore:release-5.0.8
    labels:
      kompose.service.type: nodeport
      kompose.service.expose: "true"
      kompose.image-pull-policy: "Always"

  nats:
    container_name: nats
    ports:
      - "4222:4222"
      - "6222:6222"
      - "8222:8222"
    image: nats
    labels:
      kompose.service.type: nodeport
      kompose.service.expose: "true"
      kompose.image-pull-policy: "Always"

  mongo:
    container_name: mongo
    image: mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: changeit
    restart: always
    expose:
      - 27017

  redis:
    container_name: redis
    image: redis
    restart: always
    expose:
      - 6379

My config.example

app:
  port: 9900
  auth:
    jwtSettings:
      secret: "eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hYXNfcHJvZF8yMDIwMDMyNiIsInR5cCI6IkpXVCJ9"
  database:
    name: "srv-account"

database:
  mongodb:
    uri: mongodb://localhost:27017/
    name: srv-account
    options: ""

  eventstore:
    poolMax:
    poolMin:
    streamProtocol: "http"
    hostname: "localhost"
    httpPort: 2113
    httpPotocol: "http"
    tcpPassword: "changeit"
    tcpUsername: "admin"
    tcpPort: 1113
    tcpProtocol: tcp

  redis:
    host: "localhost"
    port: "6379"
    password: ""

@n10000k
Copy link

n10000k commented Jun 23, 2021

@juicycleff any idea on this?

@juicycleff
Copy link
Owner

@uncodable I think you should try setting your consul address to 0.0.0.0.

@sixtay
Copy link

sixtay commented Jul 15, 2021

@murtaza-khan where you able to figure this out. I have a similar problem and running Consul local doesn't fix it.

@sixtay
Copy link

sixtay commented Jul 16, 2021

Fixed the issue by modifying each services bootstrap-development.yml
from
consul:
host: localhost

to
consul:
host: ${{CONSUL_HOST}}

@mohamedazizmasmoudi
Copy link

mohamedazizmasmoudi commented Oct 22, 2022

please any solution ?
I still have the same error @juicycleff @murtaza-khan @sixtay

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

5 participants