lucaschen / microservices-demo

426 stars 144 forks source link

Connection refused error, after making the final changes on docker-compose #5

Closed gigin-flexott closed 4 years ago

gigin-flexott commented 4 years ago

Hi Unable to communicate between services even if we have correct ports and build.

"message": "Invalid URL: \"http://users-service:3001\"/users",

My Docker-compose file

version: "3"
services: 
    api-gateway:
        build:
            context: "."
            dockerfile: "./api-gateway/Dockerfile"
        volumes:
            - ./api-gateway:/opt/app
        depends_on: 
            - users-service
            - ads-service
        environment: 
            - ADS_SERVICE_URI="http://ads-service:3002"
            - USERS_SERVICE_URI="http://users-service:3001"
        ports: 
            - 3000:3000
    users-service:
        build:
            context: "."
            dockerfile: "./users-service/Dockerfile"
        volumes:
            - ./users-service:/opt/app
        environment: 
            - DB_URI=postgres://iqtinaadmin:Coolers_1987@iqtina-db-instance.carmskvcytda.us-east-1.rds.amazonaws.com/iqtinadb
        ports: 
            - 3001:3001
    ads-service:
        build:
            context: "."
            dockerfile: "./ads-service/Dockerfile"
        volumes:
            - ./ads-service:/opt/app
        environment: 
            - DB_URI=postgres://iqtinaadmin:Coolers_1987@iqtina-db-instance.carmskvcytda.us-east-1.rds.amazonaws.com/iqtinadb
        ports: 
            - 3002:3002
mondash commented 4 years ago

Have you tried removing the double quotes when you define the environment variables in the compose file?

gigin-flexott commented 4 years ago

Have you tried removing the double quotes when you define the environment variables in the compose file?

It worked ..thank you