I'm using Python/Django on Heroku (Cedar Stack) and I've got a management command that I need to write that will pull a file out of an S3 bucket and process it. I'm not sure I understand how to use the ephemeral filesystem. Are there only certain directories that are writeable? I found an other article that implied that there were only certain folders that were writable (but, it doesn't seem to apply to the Cedar stack). I found this dev article but it doesn't go into much detail (note: I do understand that it's just temporary. I only need to unzip the file and process the file). Can I just create a folder anywhere under the application's root? And how would I get that? It seems like I could probably just use $HOME. I did a bit of testing by connecting to via
$ heroku run bash
and running:
$ echo #HOME
returns:
/app
and running:
$ mkdir $HOME/tmp
creates a folder in the app's root and gives with the same user and group as the other files and folders.
So... anything I'm missing here? A better way to do it? Is there an OS environment variable for this? I've run "env" and I don't see a better one.
heroku run
, this spins up a new one-off dyno on Heroku that will be charged. You can check the status of your dynos afterwards viaheroku ps
to see if they're still running. When usingheroku run bash
, the dyno is tied to your terminal, i.e. it should stop when you close your terminal session (e.g. with Ctrl+C). Furthermore, the one-off dyno doesn't have access to files from your other dynos written at run-time, sols
etc. won't work to see what's on your other dynos (except for your app files).heroku run
spins up a new dyno. Took me a while to understand why I can't access via HTTP the files created viaheroku run "echo test > /app/web/test.html"
... It turns out they're created at one-off dyno and never were facing web...