Fix permission problems in docker#11299
Conversation
|
@FrankChen021 thank you for making this PR. I tested your change on my machine, but, unfortunately, ingestion still fails with the same error. I'm using linux mint 20.1, which is based on Ubuntu Focal. Should we update the |
|
@jihoonson I don't know why host directory is used in the original docker-compose.yml, and I'm waiting for an answer from @clintropolis . If there's no special reason, I think it's acceptable to use a named volume in the example compose file. Before that, we have to execute a command to set the permission for linux systems. |
|
@jihoonson will the ingestion success after executing the following command ? |
Sorry for the delay, as long as the same volume for storage is shared and available to the historical, middle manager, and overlord containers then everything should be ok. The important part is that it is shared between containers, because the storage directory is used as deep storage for the example docker cluster, so the segments and task logs that the peons running in the middle manager publish can be then read by the overlord and historical. I don't think it matters too much however this happens. |
|
@clintropolis A named volume in docker-compose also shares contents among overlords, middle managers and historicals. At first I thought the reason why the host directory 'storge' is used has something to do with the disk size at first. Because by default, docker creates directory for a named volume under Since there's no special reasons to use a directory on the host OS to mount as a volume in docker, I think it's acceptable for us to use a named volume in the example docker-compose.yml for data storage, so that there won't be permission problems on Linux platforms. Another reason is that the docker-compose.yml is only an example, it's not recommended in production, the disk size problem of a named volume should not be a concern for us if we state it in the doc. What do you think ? @clintropolis @jihoonson @xvrl |
|
I think anything that makes the quick start work across platforms is agreeable; it is not very large data so disk size shouldn't matter afaik. |
| @@ -58,7 +58,10 @@ COPY --chown=druid:druid --from=builder /opt /opt | |||
| COPY distribution/docker/druid.sh /druid.sh | |||
| RUN mkdir /opt/druid/var \ | |||
There was a problem hiding this comment.
| RUN mkdir /opt/druid/var \ | |
| RUN mkdir /opt/druid/var /opt/data \ |
| RUN mkdir /opt/druid/var \ | ||
| && chown druid:druid /opt/druid/var \ | ||
| && chmod 775 /opt/druid/var | ||
| && chmod 775 /opt/druid/var \ |
There was a problem hiding this comment.
| && chmod 775 /opt/druid/var \ | |
| && chmod 775 /opt/druid/var /opt/data \ |
| @@ -58,7 +58,10 @@ COPY --chown=druid:druid --from=builder /opt /opt | |||
| COPY distribution/docker/druid.sh /druid.sh | |||
| RUN mkdir /opt/druid/var \ | |||
| && chown druid:druid /opt/druid/var \ | |||
There was a problem hiding this comment.
| && chown druid:druid /opt/druid/var \ | |
| && chown druid:druid /opt/druid/var /opt/data \ |
| && chown druid:druid /opt/druid/var \ | ||
| && chmod 775 /opt/druid/var | ||
| && chmod 775 /opt/druid/var \ | ||
| && mkdir /opt/data \ |
There was a problem hiding this comment.
can we add a comment to explain the difference between /opt/data and /opt/druid/var ?
| The example `docker-compose.yml` will create a container for each Druid service, as well as Zookeeper and a PostgreSQL container as the metadata store. Deep storage will be a local directory, by default configured as `./storage` relative to your `docker-compose.yml` file, and will be mounted as `/opt/data` and shared between Druid containers which require access to deep storage. The Druid containers are configured via an [environment file](https://github.com/apache/druid/blob/{{DRUIDVERSION}}/distribution/docker/environment). | ||
| The example `docker-compose.yml` will create a container for each Druid service, as well as Zookeeper and a PostgreSQL container as the metadata store. | ||
|
|
||
| It will also create a named volumes `druid-data`, which is mounted as `opt/data` in container, as deep storage to keep and share segments and task logs among Druid services. |
There was a problem hiding this comment.
I feel druid-data and /opt/data is a little generic and doesn't really convey the idea that this is meant for shared storage. /opt/druid/var is also used for local "data" so the distinction is not very clear.
Maybe we should give it a more descriptive name such as /opt/shared, or something else if you have better suggestions, wdyt?
|
Thanks @xvrl , I have submitted a new commit to resolve all your comments. Test result will be updated in this weekend. |
clintropolis
left a comment
There was a problem hiding this comment.
latest changes lgtm, will try to test soon
jihoonson
left a comment
There was a problem hiding this comment.
@FrankChen021 thanks. +1 after CI. The quick start ingestion works as it is after applying this change.
As I mentioned in the dev thread, it seems to me that the real problem is this docker image is not being tested properly. I'm not sure why the tests we have today don't catch this error. Do you have any plan for follow-ups to investigate this issue and add more tests if necessary?
I have the same question as you. I will check it when I'm free. |
|
I tested these changes on 3 different host OS, all worked. See the description of this PR. |
* Create /opt/data to fix permission problem * eliminate symlink to avoid compatibility problem on AWS Fargate * Add a workaround section * Update instruction for named volume * Use named volume in docker-compose * Revert some doc change * Resolve review comments
* Create /opt/data to fix permission problem * eliminate symlink to avoid compatibility problem on AWS Fargate * Add a workaround section * Update instruction for named volume * Use named volume in docker-compose * Revert some doc change * Resolve review comments Co-authored-by: frank chen <frank.chen021@outlook.com>
Fixes #11278 , #11298
Description
To fix 11278,
mvinstruction is used to replace originallninstruction to eliminate symlink so that the docker image works with AWS Fargate. This change has been verified with the help of @mattmassicotte , reporter of that issue.To fix 11298,
/opt/sharedis created in the Dockerfile so that a named volume could be used in the docker-compose. And a named volumedruid_sharedis used to share segments and task log files among Druid servicesBecause the problems we have encountered are platform independent, I test these changes on 3 different platform following the steps below
Test Steps
docker volume pruneto clean up previous volumesTest Result
This PR has: