So, I've been wrestling with this issue for days...I need to get a file from S3 and write it to a directory in my Rails app on Heroku. I must have a misunderstanding of the ephemeral file system on Heroku because I can't figure out why it's not working.
I am running s3.bucket('bucket').object('file.csv').get(response_target: 'file.csv')
to get a file from S3 and write it to my app. Initially I just wrote a .rb
to do this and ran it using the Heroku Scheduler
, but to no avail. I then turned the script into a rake task and ran that on the scheduler
, again, to no avail. I am able to run both the .rb
script and the rake task flawlessly in my dev environment.
After reading this and this on how the ephemeral file system works, I am thinking that the task actually is working, but the file gets destroyed (or is actually there but I can't see it?) when I use ls
in heroku run bash
.
Can someone please explain what is going on to me? If my efforts to get a file from S3 written to my app on Heroku are futile? And if there are any alternatives?
If I can't figure it out after this then I am going to set up my own env in EC2.