Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker volume persistent for directory of custom org images #95

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

garrit-schroeder
Copy link

I have adjusted the pull request and created a new one.

Copy link

@8ear 8ear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
Why you copy the orgs.dist images in the dockerfile build process and in the entrypoint is that not the double work?
If the orgs images are only coming from misp and should not be user changeable than it makes it no sense to add a local file path to it.
If it is user customized than it makes no sense to delete all the user changes in your rsync command or?

what should it be?

Kind regards

@coolacid
Copy link
Owner

The docker file will copy the files to a orgs.dist directory to keep a distribution level copy of the images. The entrypoint (should) then syncs this distribution copy to make sure it's in sync with the real directory. This is because users of MISP has the ability to upload Org images when creating Orgs in MISP.

@@ -104,6 +104,7 @@ sync_files(){
for DIR in $(ls /var/www/MISP/app/files.dist); do
rsync -azh --delete "/var/www/MISP/app/files.dist/$DIR" "/var/www/MISP/app/files/"
done
rsync -azh --delete "/var/www/MISP/app/webroot/img/orgs.dist/" "/var/www/MISP/app/webroot/img/orgs"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the --delete here will delete any org images uploaded by the user - can you verify that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified and of course the --delte flag was wrong. Fixed it.

@garrit-schroeder
Copy link
Author

I verified and of course the --delte flag was wrong. Fixed it.

@8ear
Copy link

8ear commented Feb 27, 2021

The docker file will copy the files to a orgs.dist directory to keep a distribution level copy of the images. The entrypoint (should) then syncs this distribution copy to make sure it's in sync with the real directory. This is because users of MISP has the ability to upload Org images when creating Orgs in MISP.

But for that I understand is the second “custom” path there?

@garrit-schroeder
Copy link
Author

garrit-schroeder commented Feb 27, 2021

We are talking about the manage file tab in Server settings.
Screenshot_20210227-090336

The Top upload directory contains default images of misp but the user has also the possibility to upload images there. That's why we need this workaround of syncing the default files. A docker volume will otherwise overwrite this directory.

The second location of custom images is empty by default so we can just use a normal docker volume. No workaround required.

@8ear
Copy link

8ear commented Feb 27, 2021

@garrit-schroeder ,
Thanks for clarification. That was not clear enough for me.

@chrisinmtown
Copy link

So if I read this correctly, during image build you stash a copy of the distributed images; and at container start you ensure that all the distributed images are present in the mounted volume. If that's right, then +1 from me 👍

My only substantive comment: please add instructions to the README about making a volume with local org images, and mention the distributed images are put there automagically.

I see this has PR been open a few months, is something blocking merge here?

@garrit-schroeder
Copy link
Author

You are a 100% correct.

There is nothing blocking this PR as far as I can tell. Just some additional notes in the README file maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants