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

standalone mode in docker can't be killed by SIGTERM #474

Open
1 task done
zfben opened this issue Dec 6, 2024 · 2 comments
Open
1 task done

standalone mode in docker can't be killed by SIGTERM #474

zfben opened this issue Dec 6, 2024 · 2 comments

Comments

@zfben
Copy link

zfben commented Dec 6, 2024

Astro Info

the docker image based on node:lts-alpine

Describe the Bug

  1. build a docker image
  2. start it
  3. stop it by docker kill --signal=SIGTERM

the server doesn't stop.

What's the expected result?

stop the server and container.

Link to Minimal Reproducible Example

https://idx.google.com/just-the-basics-5506607

Participation

  • I am willing to submit a pull request for this issue.
@kaytwo
Copy link

kaytwo commented Dec 29, 2024

Your idx gave me an auth error, but I ran into the same problem, here's what I learned:

  • I had this issue with the dev server as well, however switching to this command in my compose file fixed it: command: sh -c "npm install && exec npm run dev" - this causes sh to not eat the SIGINT and shut down cleanly.
  • I was able to reproduce this and tried both the "exec style" and "shell style" invocations in my Dockerfile, however both seemed to ignore SIGTERM.
  • They don't, however, ignore SIGINT, so setting STOPSIGNAL SIGINT in the Dockerfile "fixed" the problem for me.

I don't know whether there is anything in the innards of the node server that will break because we're sending SIGINT instead of SIGTERM, but I doubt it.

@zfben
Copy link
Author

zfben commented Dec 29, 2024

@kaytwo I switch to middleware mode and handle signal manully now. maybe you can do it too.

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

2 participants