gristlabs_grist-core/sandbox/run.sh
Florent 36ade2bfd0
Fix docker graceful shutdown (#830)
* run.sh: Replace pid with nodejs's one using exec

This notably ensures that "docker stop" sends a TERM signal to the node
process which can handle it gracefully and avoid document corruption.

* Use exec form for CMD in Dockerfile

---------

Co-authored-by: Florent FAYOLLE <florent.fayolle@beta.gouv.fr>
2024-01-30 10:00:59 -05:00

20 lines
618 B
Bash
Executable File

#!/usr/bin/env bash
set -e
if [[ "$GRIST_SANDBOX_FLAVOR" = "gvisor" ]]; then
source ./sandbox/gvisor/get_checkpoint_path.sh
# Check GVISOR_FLAGS we ended up with. Don't ignore the output, it may be helpful in troubleshooting.
if runsc --network none $GVISOR_FLAGS "do" true; then
echo "gvisor check ok (flags: ${GVISOR_FLAGS})"
else
echo "gvisor check failed (flags: ${GVISOR_FLAGS}); consider different GVISOR_FLAGS or GRIST_SANDBOX_FLAVOR"
exit 1
fi
./sandbox/gvisor/update_engine_checkpoint.sh
fi
exec env NODE_PATH=_build:_build/stubs:_build/ext node _build/stubs/app/server/server.js