Open chsukivra opened 3 months ago
Neat edge case. My only concern is whats the availability of mktemp
?
I've also been thinking about introducing an environment variable like RELX_EXPAND_SRC=false
that completely disable this generator unless explicitly asked for. If not set or set to true it will keep current behavior.
#!/bin/sh
/opt/myapp/bin/myapp expand_src
exec /opt/myapp/bin/myapp foreground
Its just that it doesnt do the right thing out of the box and that could be annoying.
Also, maybe i can make a bigger change that chose to only generate these files for the commands that will actually start the service? I dont see why status
should lead to it being expanded.
The replace_os_vars function is called every time for any command, not only those that boot the release. If you call
<release> status
in a readiness check, that will re-write the file.This might lead to race conditions, where the release starts up, the script creates the replace_os_vars function, is slowed down, but the health check is invoked and it will re-render the sys.config and write it halfway while the starting release gets around to read that very file.
We do see intermittent examples of this, where one container out of a bunch on a slow machine start up, and a container that has no changes from previous successful runs will fail with and error like this, with same sys.config.src files, same env.
However this container has a healthcheck implemented with the status command running in it.
There are many ways to attack this issue. Just opening with a suggestion.