Rather than trying to operate on the nginx.conf file in place (see below on why this fails), this PR changes the docker entrypoint to create a temporary file and then replace nginx.conf with that one.
There are no breaking changes in this PR.
Resolves / is related to
Currently, the mico-admin docker entrypoint reads and writes the nginx.conf in the same shell command. This is a race condition that often leads to erasing the contents of the nginx.conf, because
the file is opened for reading (fine)
the file is opened for writing and truncated so it's empty
then envsubst tries to do its job, but ends up doing nothing because the file it's trying to read is empty
Description
Rather than trying to operate on the nginx.conf file in place (see below on why this fails), this PR changes the docker entrypoint to create a temporary file and then replace nginx.conf with that one.
There are no breaking changes in this PR.
Resolves / is related to
Currently, the mico-admin docker entrypoint reads and writes the nginx.conf in the same shell command. This is a race condition that often leads to erasing the contents of the nginx.conf, because
The shellcheck wiki has an article about this class of problems: https://github.com/koalaman/shellcheck/wiki/SC2094
What is affected by this PR
insertTestValues.sh
and Postman Collections are updatednpm run build -- --prod
)Checklist
Ensure that new source files include the license headerEnsure JavaDoc is up to date