Closed joshdura closed 11 months ago
Hi @joshdura,
could you ellaborate what you mean by "Docker compose"? From your description it seems like you are running the serverless deploy --stage local
in a separate docker container, and LocalStack will run in yet another docker container?
If yes, you will need to remove the autostart: true
flag from the plugin configuration.
This flag will start localstack automatically. With the setup you are describing, you should start LocalStack manually instead.
The error Error: Command failed: docker ps
indicates that you are running the serverless deploy
somewhere, where the docker
cli is not installed.
@steffyP Sorry, I should have included all my files file to explain my setup. Below is an example of my docker-compose.yml file:
Then below is my serverless.yml file:
So yes, Docker Compose is running and then spinning up the serverless stack. When started it runs a yarn start
command (which runs serverless deploy --stage local
). If I run this without autostart: true
, I get the following:
It never seems to get past this, it just gets stuck here. Any thoughts there?
Hi @joshdura,
when you start form-services
and localstack
as services with one docker-yaml, then the container running form-services
would need to use the http://localstack:4566
to be able to reach the LocalStack instance.
Please refer to the docker documentation as well.
Could you adapt the host
in your serverless.yml
accordingly and give it another try?
@steffyP Thanks for the continued help! When running with the following:
localstack:
debug: true
stages:
- local
host: http://localstack
edgePort: 4566
lambda:
mountCode: true
I still have the same issue. I have tried using localhost
as well and no dice. See the log below (note this has now been running for 25+ minutes and no new log messages):
Is there any way to get more detailed logs in regards to the host name not being found? I feel like that should be something logged and I am just not seeing it for some reason.
Hi @joshdura,
from the tests I just run, I would assume this has something to do with very specifics in your project setup, probably related to typescript.
Let's just verify that your setup works in general, by running a sample.
Then in a subfolder test
add this Dockerfile
:
Then just run docker-compose up
, which should start LocalStack first, and after it's ready it will run the sls deploy --stage local
from the forms-services
container. It will only create a queue. You should see logs in the LocalStack container.
I would suggest you try to make this sample work first, and then try to figure out what configuration causes the issue you are seeing.
@steffyP Thanks for this update. I can confirm it looks like this is definitely an issue with serverless-typescript
and serverless-domain-manager
. I was able to workaround the domain manager issue by disabling it when deploying locally, but haven't found a 100% solution for the Typescript issues yet. However, it was able to spin up correctly one or two times and looks like I am running into the same issue as #157. I am going to continue to debug this, but I think we can go ahead and close this issue for now until I find a good workaround. Thank you again for your continued support!
Thanks for the feedback @joshdura.
Sorry I didn't pointed you earlier to this: but using the mountCode
flag when you run both containers will lead to issues anyhow. It's not indented to work within docker as well.
From our README:
Note that the localstack.lambda.mountCode flag above will mount the local directory into the Docker container that runs the Lambda code in LocalStack. You can either specify the boolean value true (to mount the project root folder), or a relative path to the root Lambda mount path within your project (e.g., ./functions).
I am trying to run a pretty simple serverless stack (Docker compose, running a Node 16 serverless project) on localstack with this plugin, and any time I try to spin it up I get the following error:
Serverless version: 3.24.1 Docker version: 23.0.5 Node version: 16.19.0
serverless-localstack custom config:
I feel like I am missing some sort of simple setup option somewhere. Anyone have any ideas?