mirror of
https://github.com/playit-cloud/playit-agent.git
synced 2026-07-02 23:02:27 +00:00
This should be done to allow the container to properly react to unix signals (e.g., `SIGTERM`). Currently, PID 1 is `sh` which is executing the script until the `playit` binary stops. When the pod is stopped, e.g., using `docker stop` or in Kubernetes, when the pod is being deleted, the container runtime sends a `SIGTERM` to PID 1 to allow for graceful termination. `sh` however, does not handle signals, which results in the container running indefinitely until the container runtime sends a `SIGKILL`.
14 lines
310 B
Bash
14 lines
310 B
Bash
#!/usr/bin/env sh
|
|
|
|
if [ -z "${SECRET_KEY}" ]; then
|
|
echo "SECRET_KEY environment variable missing, using CLI argument";
|
|
SECRET_KEY="$1"
|
|
|
|
if [ -z "${SECRET_KEY}" ]; then
|
|
echo "secret key (first argument) is missing";
|
|
exit 1;
|
|
fi
|
|
fi
|
|
|
|
exec playit -s --secret "${SECRET_KEY}" --platform_docker start
|