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

Use `docker-compose.yml` for `autostart: true`

Open azizur opened this issue 5 years ago • 3 comments

The current implementation depends on user having to install localstack binary on their machine since it uses the following command (https://github.com/localstack/serverless-localstack/blob/master/src/index.js#L332) to start docker container.

localstack infra start --docker

This repo comes with a docker-compose.yml but it's not used at all.

IMHO, when auto-starting it should use the docker-compose.yml as the default way to start docker container. The reason being, I want to use locastack but I don't want to install the binary locally on my machine. That's the essence of using docker containers.

┆Issue is synchronized with this Jira Task by Unito

azizur avatar Feb 20 '20 20:02 azizur

I also face this problem. I am wondering if you solve this.

wirelessr avatar May 29 '20 09:05 wirelessr

I also face this problem. I am wondering if you solve this.

I have actually decided for my use case, I could live without localstack. I guess I did not have time to explore this more since maintainers on the project did not comment.

azizur avatar May 29 '20 09:05 azizur

Thanks for reporting @azizur @wirelessr , and apologies for the delay. Please note that pull requests are highly welcomed and encouraged, if you'd like to see a certain functionality being added!

To explore your proposal a bit more - I guess we could add a configuration switch that allows users to define whether they want to use the localstack command line versus the docker-compose command. (Please note that not all users may have docker-compose installed, either).

@wirelessr Do you think you could try to create a pull request to add this functionality? We'd be happy to provide help and guidance, as needed. Thanks for your help!

whummer avatar Jul 29 '20 17:07 whummer

Hi @azizur, hi @wirelessr,

we just released version 1.2.0, where you can now configure a docker-file path to start LocalStack using docker-compose. Please check the README for details, but it a nutshell you can set:

service: myService

plugins:
  - serverless-localstack

custom:
  localstack:
    autostart: true
    docker:
      compose_file: /home/localstack_compose.yml # path to the docker-compose file
    ...

Please let us know if you still encounter any issues!

steffyP avatar Jan 29 '24 09:01 steffyP