I have a Ruby on Rails 5.1 application where I am generating PDF files that represent records in a database.
I need to archive these PDF files so they can be stored outside the application.
This is mostly a one-time event, so I don't need continual syncing.
I have working code that converts each record to a PDF file, adds that file to a ZIP file built in memory, and then returns that ZIP to the user as a download.
This works, but if you have lots of records records, the web server will timeout, so I need to figure out a better approach that doesn't hog all the server memory.
The ZIP file could potentially be 200MB in size, with 10,000+ PDF files inside.
I host the applications on their own containers, so I can access the server file directory if necessary, but each re-deploy or container shutdown would wipe it.
The approach I'm thinking about implementing is:
This is the first time I've done something large-scale like this; is this approach reasonable? What would be a better way to accomplish the goal of archiving PDF files off the server?
Your approach is reasonable. Some remarks: