inveniosoftware / helm-invenio

Helm charts for deploying an Invenio instance
https://helm-invenio.readthedocs.io
7 stars 19 forks source link

web/nginx: shared volume (pvc - persistent volume claim) #8

Closed ppanero closed 4 years ago

ppanero commented 4 years ago

Now Nginx and Web nodes share a volume (Persistent) for statics. However, it needs the image to have the statics (Addresse here https://github.com/inveniosoftware/cookiecutter-invenio-rdm/pull/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 https://github.com/inveniosoftware/helm-invenio/issues/7 and https://github.com/inveniosoftware/helm-invenio/issues/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 an emptyDir instead of a volume. Will be treated in https://github.com/inveniosoftware/helm-invenio/issues/9

Requires: https://github.com/inveniosoftware/cookiecutter-invenio-rdm/pull/56