CoorpAcademy / serverless-plugins

Collection of serverless plugins :zap:
228 stars 132 forks source link

right way to run sqs offline within docker-compose #130

Open Ali-Dalal opened 4 years ago

Ali-Dalal commented 4 years ago

I have an issue connecting to elasticMQ from docker-compose

docker-compose.yml

version: "3.5"
services:
  myService:
    build: .
    command: npm run offline
    container_name: myService
    image: myService-image
    ports:
      - "8001:8001"
      - "3006:3006"
    depends_on:
      - "elasticmq"
  elasticmq:
    image: "softwaremill/elasticmq"
    container_name: elasticmq
    ports:
      - "9324:9324"

serverless.yml:

  serverless-offline-sqs:
    autoCreate: true                 # create queue if not exists
    apiVersion: '2012-11-05'
    endpoint: http://elasticmq:9324
    region: eu-west-1
    accessKeyId: root
    secretAccessKey: root
    skipCacheInvalidation: false

so the issue is when I try accessing elasticmq via http://elasticmq:9324, it says the host is not accessible. however, if I write the endpoint as endpoint: elasticmq:9324 (https by default) elasticMQ container will complain about accessing it as http where it should be https. Perhaps this was an HTTPS request sent to an HTTP endpoint? error fron elasticMQ console

can you help pls?

manniniandrea commented 4 years ago

Your configuration should work, you could try by adding an alias with the link property https://docs.docker.com/compose/networking/#links