jvm

nick 2020-07-14T14:46:44.005Z

I have a running Clojure ring/jetty app that generates new files and I want them to be downloadable by users. It works fine in development - I just save them to /resources/public folder and Ring(middleware?) serves it just fine. But in production it doesn't work like that running app only "sees" the resources that are part of uberjar. Is there any way to add new files to that uberjar while it is running?

lukasz 2020-07-14T15:11:58.006900Z

@nfedyashev IMHO it would be better to store the files in something more durable like S3 or just outside of the uberjar itself - basically anywhere else in the filesystem. Consider deploying a new version of your uberjar: all previously uploaded files will disappear if you stick with the approach of re-using 'resources' dir

👍 1
nick 2020-07-14T15:12:54.007400Z

I'm ok with ephemeral/temporary storage of those files, just wondering if that's possible at all

lukasz 2020-07-14T15:13:46.008300Z

Good question, I always assumed resources in uberjar are immutable so never bothered to research it to be honest 😉 I'd just write to /tmp and serve the files from there

☝️ 1
nick 2020-07-14T15:56:15.010100Z

Following @lukaszkorecki tip I ended up using S3 instead. I always hated configuring/testing S3(in other languages) but turns out in Clojure it is pure joy. amazonica is really nice