Closed mattiagiupponi closed 4 months ago
@mattiagiupponi I would consider configuring the Nginx X-Accel-Redirect
. This will offload the download to Nginx. You can find many guides online, also for Django.
Anyway I guess we still need to zip the asset first before download it, no? Unless ngimx is able to point to a folder instead of a single file.
yes, sure. Let's split the concerns and focus only on the zipping part for the moment. I would go for the first solution. The worst case is doubling the disk space, but disk space is cheaper than CPU and we can still set up a retention mechanism (as you say) which could also leave outside GeoNode.
How/where would you store and manage the new zip file? Would the new file be considered as a whole new Asset?
IMHO we will need to define a folder for the cached zip files, which is not publicly reachable.
I think a solutions like zipstream-ng is required to avoid filling up memory, and its ZipStream in paritcular This comment from StackOverflow confirms my concern about the way you generate the zip
Is your feature request related to a problem? Please describe. In some cases, the asset download will download only the main file, but not all the file which the asset is composed of.
Describe the solution you'd like The download link should provide the whole structure
Describe alternatives you've considered Two possibilities comes to my mind:
Additional context I suggest that in both cases we can use the StreamingHttpResponse and FileWrapper. Here is a good example on how to implement it https://stackoverflow.com/a/8601118/7597536
cc @etj @giohappy