Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Run sls dynamodb start in detached mode #106

Open
maikokuppe opened this issue Jul 5, 2017 · 6 comments
Open

Feature: Run sls dynamodb start in detached mode #106

maikokuppe opened this issue Jul 5, 2017 · 6 comments

Comments

@maikokuppe
Copy link

For CI testing, one would need to run sls dynamodb start asynchronously, because the command blocks the current shell.

Workaround 1: sls dynamodb start &
This runs it in the background, but does not wait until the db is set up properly.

Workaround 2: sls dynamodb start & sleep 5
This works, but might introduce race conditions.

Suggestion:
How about: sls dynamodb start --detached which runs synchronously until all work is done, exits the process (the shell command is finished), but continues serving the database in the background.

@ericr3r
Copy link

ericr3r commented Sep 7, 2017

Using the serverless-offline plugin, I was able to have use serverless offline start --exec "npm run test" in order to start dynamodb before running tests. It appears that dynamodb is not shut down at the end of the run.

@mathieudevos
Copy link

This is heavily blocking proper CI/CD & DevOps usage of the whole tool tbh.

Nobody in their right mind can go into a pipeline and say: "run all this, then do your test, oh and then press ctrl+c when you're done".
It is an underlying issue with dynamodb-localhost and dynamodb-local which this plugin straight up uses, copies, and adds bit of functionality to.

Ideally I wish to be able to dive into my npm script, start the database detached, run my tests, kill the database.

@mathieudevos
Copy link

@erauer - could you specify what you used in the "test" section of your package.json (basically the command which is being run with npm run test

@mathieudevos
Copy link

rynop/dynamodb-local#19
I managed to find the very base NPM package of this build, and got it to run in detached mode (albeit with async wrapping).

As such, this should be possible for the serverless plugin to work in this way.

Ideally I want to run in my DevOps pipeline:
sls dynamodb start --seed=test --detached

which would just start the whole database (potentially writing the child object, or child pid) to a temp file.
And kill the whole thing with sls dynamodb stop. Even if this requires under the hood asyncing.

@vitor-tadashi
Copy link

I have this problem too, I have to run this command, but the dynamodb start blocks the second command.
sls dynamodb start && jest --coverage --runInBand --forceExit --detectOpenHandles

If I run the command like this the first time will work
sls dynamodb start & sleep 3 && jest --coverage --runInBand --forceExit --detectOpenHandles

But the second time I run this command this problem will occur on serverless-dynamodb-local
Could not start server on port 8000: Address already in use

@boraoren
Copy link

boraoren commented Jun 6, 2020

I use pgrep -f "DynamoDBLocal.jar" | xargs kill command to kill serverless dynamodb local application after test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants