Context
Currently, the Docker Compose configuration contains a hack to avoid Docker creating directories as root on the host when mounting archive and staged-archive directories.
The issue arises because only one of CLP_ARCHIVE_OUTPUT_DIR_HOST and CLP_STAGED_ARCHIVE_OUTPUT_DIR_HOST is set at a time, but since ./var/data on the host is mounted into the container and both variables default to directories under ./var/data, Docker would create the unset directory on the host as root if we naively mount with a default path under /var/data.
Current Hack
When one of the variables is unset, we set the target for the corresponding mount to a path that's not under /var/data in the container to prevent Docker from creating it on the host.
See: https://github.com/y-scope/clp/blob/docker-compose/tools/deployment/package/docker-compose.base.yaml#L267-L283
Proposed Solution
Accept a var/tmp directory config from the user and generate all temporary runtime data in that directory instead of the current var/data directory. This would eliminate the need for the /var/data bind mount and remove the hack.
References
Context
Currently, the Docker Compose configuration contains a hack to avoid Docker creating directories as root on the host when mounting archive and staged-archive directories.
The issue arises because only one of
CLP_ARCHIVE_OUTPUT_DIR_HOSTandCLP_STAGED_ARCHIVE_OUTPUT_DIR_HOSTis set at a time, but since./var/dataon the host is mounted into the container and both variables default to directories under./var/data, Docker would create the unset directory on the host as root if we naively mount with a default path under/var/data.Current Hack
When one of the variables is unset, we set the target for the corresponding mount to a path that's not under
/var/datain the container to prevent Docker from creating it on the host.See: https://github.com/y-scope/clp/blob/docker-compose/tools/deployment/package/docker-compose.base.yaml#L267-L283
Proposed Solution
Accept a
var/tmpdirectory config from the user and generate all temporary runtime data in that directory instead of the currentvar/datadirectory. This would eliminate the need for the/var/databind mount and remove the hack.References