-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Use gosu and execs for execution #101
Conversation
Want to do some more testing later (fresh data folder, user connect test, etc) before merging. |
Thanks for taking the time to open this PR! Let me know when you feel it's ready to be merged and has been tested sufficiently, and I'll test it my end too :) |
Good call on the exec usage. Will test this locally. |
Testing has shown that eg, running results in a running container |
Going to take one more crack at this tonight after doing some research on sudo, signals, process groups and setsid. If that doesn't work, may have to just accept the partial solution in changeset 5cb8740 |
I played with this for another couple hours, and was unfortunately unable to get signal passing to work with the sudo call. Merging this partial fix does allow admins to bypass the sudo call after init.sh has been run at least once to set permissions on the volume mount. |
More testing welcome, but it does appear to start the server correctly, and the environment appears intact:
|
Thanks for your continued efforts! Couple of questions. Firstly, why did you duplicate the Secondly, with the inclusion of Edit: Reading over |
This leaves open the possibility of changing the entrypoint when running a container, and still being able to run
I tested by starting a container in the foreground, and issuing a stop from another terminal. The server received the signal and performed an orderly shutdown. I also tested on a detached container, and it was able to receive the signal as well.
|
It doesn't have a negative effect as such, it's just annoying to have a duplicate command as both instances must then be maintained. If we're using |
Fair enough. I'll remove it from the changeset. ie |
Appreciate it! No, you're probably right. Please remove it. |
Ensure that if run.sh is called directly with an existing mounted /config, we can correctly execute the server. This allows us to manually set the uid/gid of steam and switch the entrypoint, causing the server binary to be UID 1. This allows graceful stopping of the server when `docker stop` is issued. Testing has unfortunately shown multiple issues with propagating signals through the sudo call present in init.sh
gosu (/~https://github.com/tianon/gosu) is optimized for container environments to correct use exec and setsid to allow for signal handling to occur correctly. Pass any arguments to docker run command to the server binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested this and works as intended for my setup, much appreciated!
Co-authored-by: Marc Sladek <marc.sladek@synventis.com>
Thanks for your hard work @bewing! |
Use exec at the end of scripts in order to simplify the process chain
and signal handling. With this change, a SIGTERM sent by docker to
PID 1 will be propagated to the server binary for a clean shutdown.
Resolves #99