lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment
MIT License
5.83k stars 431 forks source link

Make the `init` binary understand signals #229

Closed sthulb closed 4 years ago

sthulb commented 4 years ago

It would be cool if the init go binary understood signals, a user could run docker kill --signal HUP <container> to refresh the handler code.

This pattern is used by nginx too

mhart commented 4 years ago

Yeah, I was thinking of adding a watch mode for the init go binary that just handles this automatically

In any case, it would only work for newer rapid-based runtimes where init is the one loading the user's code – older runtimes (in docker-lambda at least) use a slightly inverted method, and each has custom handler loading code which I think would be safest reloaded just by restarting the docker container (as currently suggested in the README)

mhart commented 4 years ago

I've added this, as well as a watch mode which you can activate by passing in DOCKER_LAMBDA_WATCH=1

Thanks for the nudge 👍

mhart commented 4 years ago

Watch mode documented here: https://github.com/lambci/docker-lambda#developing-in-stay-open-mode