Home > Mobile >  Heroku download Data Files
Heroku download Data Files

Time:12-31

i have a little question in terms of heroku. I have a Discord Bot, which i deploy via GitHub to heroku.

The Bot has some data files. So if I deploy new from GitHub, this data files will get resetet.

My question is, how can i manage, to download the current data files from heroku, so i can replace them with the old ones, for the new deploy?

I already tried to download the files via, Heroku CLI, but this only gives me the files of the last deploy.

I hope someone can help me, ~KittyCatCrafter

CodePudding user response:

When you deploy an application to Heroku, Heroku will receive a copy of your repository and deploy it exactly as it is. As your application is running, it is able to modify files on the "disk", but those changes are never permanent. In short: there is no way to "download" files you've temporarily changed in your Heroku app because they don't exist outside of a very short timeframe on a single dyno.

Heroku does this for many reasons, the main one is so that your application will be architected to scale past a single dyno. If you get used to relying on files existing permanently when you create them, this cripples your ability to scale your web application to multiple dynos in the future.

This Heroku article explains their ephemeral filesystem and explains ways to work around it. The gist of it is this: when you need to store files permanently as your application is running, considering either putting this data in a database (like Postgres), or an object store like Amazon S3.

  • Related