web/nginx: shared volume (pvc - persistent volume claim) #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now Nginx and Web nodes share a volume (Persistent) for statics. However, it needs the image to have the statics (Addresse here inveniosoftware/cookiecutter-invenio-rdm#56).
Since volumes override the folder where they are being mounted (empty them). The web pod folder is "wiped out" of statics. To solve the issue an
initContainer
is launched, this will mount the volume in a temporary location and copy the statics to it. Therefore, it will be initialized with the correct statics. The copy of those is made to overwrite old ones, so there is no problem with future deployments.The serving of statics has been off-loaded to nginx. Deeper consolidations are out of the scope of this PR, but will be addressed as part of #7 and #6.
In addition, at the moment the
initContainer
is launched once per pod. Which means that if there are 6 web pods the assets will be copied 6 times. This is not an issue since OpenShift provides a distributed locking system and all pod's assets are the same. This will be improved by adding nginx as a sidecar container and using anemptyDir
instead of a volume. Will be treated in #9Requires: inveniosoftware/cookiecutter-invenio-rdm#56