serverless-plugins icon indicating copy to clipboard operation
serverless-plugins copied to clipboard

right way to run sqs offline within docker-compose

Open Ali-Dalal opened this issue 5 years ago • 1 comments

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?

Ali-Dalal avatar Jun 22 '20 05:06 Ali-Dalal

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

manniniandrea avatar Jun 24 '20 07:06 manniniandrea