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

Don't require Knora and Sipi to share a directory for image upload #535

Closed
subotic opened this issue Jun 12, 2017 · 11 comments · Fixed by #1233 or #1722
Closed

Don't require Knora and Sipi to share a directory for image upload #535

subotic opened this issue Jun 12, 2017 · 11 comments · Fixed by #1233 or #1722
Assignees
Labels
enhancement improve existing code or new feature

Comments

@subotic
Copy link
Collaborator

subotic commented Jun 12, 2017

At the moment, the file upload through the webapi requires that there is a shared directory with sipi. This limits the way how the webapi and sipi can be deployed. Either they need to be running on the same server or both have access to the same network share.

@subotic subotic added the enhancement improve existing code or new feature label Jun 12, 2017
@subotic subotic added this to the Backlog milestone Jun 12, 2017
@subotic subotic changed the title The integration between webapi and sipi shouldn't require a shared directory The integration between webapi and sipi shouldn't require a shared directory Jun 12, 2017
@subotic subotic changed the title The integration between webapi and sipi shouldn't require a shared directory The integration between *webapi* and sipi shouldn't require a shared directory Jun 12, 2017
@subotic subotic changed the title The integration between *webapi* and sipi shouldn't require a shared directory The integration between 'webapi' and 'sipi' shouldn't require a shared directory Jun 12, 2017
@tobiasschweizer
Copy link
Contributor

Yes, that is correct.

I did it this way because I did want not send the file to Sipi again after is has been already submitted to Knora (non GUI case). Do you think a network share would be feasible? I think it would make sense to run Sipi and Knora on different machines (performance).

@subotic
Copy link
Collaborator Author

subotic commented Jun 12, 2017

Network shares require to either share directories between two machines or to have a third machine providing the share. I don't think that they are a good way to go. It would only make the installation more complicated and fragile. Just think of the network shares that we use for our backups. We would need to make sure that the network share is accessible from webapi and sipi.

The cleanest solution would be to send the file to sipi instead of storing it locally. This way, only sipi is responsible for files and doesn't require any additional setup.

@loicjaouen
Copy link
Contributor

@subotic

The cleanest solution would be to send the file to sipi instead of storing it locally. This way, only sipi is responsible for files and doesn't require any additional setup.

that's the way Salsah 1.5 works, and I kept import scripts to behave alike because none of our installs (at Lausanne) do share a file system.

@benjamingeer
Copy link

The cleanest solution would be to send the file to sipi instead of storing it locally. This way, only sipi is responsible for files and doesn't require any additional setup.

I suggested doing this for the bulk import, but @tobiasschweizer pointed out that there's a problem: The Knora API server is supposed to store the original MIME type of the file. If the user tells webapi what the original MIME type is, webapi should check that this information is correct. Currently the way it works is that webapi gives Sipi the path to the original file, asking Sipi to import the file and return its original MIME type.

If the user submitted the file to Sipi first, and then just submitted the metadata (not the file) to webapi, this wouldn't be possible, because Sipi doesn't store the original MIME type. The user could say that the original file was a TIFF, when actually it was a JPEG, and webapi would have no way of knowing.

Therefore @lrosenth said that the bulk import XML should contain the filesystem path to each file to be imported, and that both webapi and sipi would need access to that path. So that's what I implemented in #491.

@tobiasschweizer
Copy link
Contributor

Please note that are actually two ways of uploading images (GUI case and non GUI case), please see http://www.knora.org/documentation/manual/rst/sipi/sipi-and-knora.html

@subotic
Copy link
Collaborator Author

subotic commented Dec 6, 2018

I think that this is not the case anymore.

@subotic subotic closed this as completed Dec 6, 2018
@loicjaouen
Copy link
Contributor

I am running late, sorry about that, so it means that the shared directory is not required anymore?

Even for the bulk import?

@benjamingeer
Copy link

benjamingeer commented Dec 14, 2018

If I'm not mistaken, the shared directory is still required, both for bulk import and for the 'non-GUI case' of a file upload to Knora. SipiResponderConversionPathRequestV1 contains an absolute file path:

https://github.com/dhlab-basel/Knora/blob/develop/webapi/src/main/scala/org/knora/webapi/messages/v1/responder/sipimessages/SipiMessagesV1.scala#L65

This is sent to Sipi's /convert_from_binaries route, which reads the file from disk:

https://github.com/dhlab-basel/Knora/blob/develop/sipi/scripts/convert_from_binaries.lua#L114

@benjamingeer benjamingeer reopened this Dec 14, 2018
@benjamingeer benjamingeer self-assigned this Dec 14, 2018
@benjamingeer benjamingeer changed the title The integration between 'webapi' and 'sipi' shouldn't require a shared directory Have API v1 use API v2's image upload functionality Feb 11, 2019
@benjamingeer benjamingeer changed the title Have API v1 use API v2's image upload functionality Don't require Knora and Sipi to share a directory for image upload Feb 11, 2019
@benjamingeer
Copy link

What's left to be done here:

@subotic
Copy link
Collaborator Author

subotic commented Feb 11, 2019

@tobiasschweizer is using the non-gui case. He would need some help in changing his import script.

@benjamingeer
Copy link

Yes, it shouldn't be too hard to change it to use API v2. Anyway, we don't need to do this until after we redo the bulk import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment