Fork me on GitHub
#jvm
<
2020-07-14
>
nick14:07:44

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?

lukasz15:07:58

@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

👍 3
nick15:07:54

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

lukasz15:07:46

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

☝️ 3
nick15:07:15

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