Skip to content Skip to sidebar Skip to footer

Save File Change On Heroku

I hava a node.js app on heroku thath checks for emails and then if the email match certian cliteria it would reply. Because heroku restarts the dyno every so often I made a file t

Solution 1:

Heroku enforces this behavior (the local file deletion stuff) because it is a best practice. Writing files locally doesn't scale well, and can lead to some odd edge-case behaviors when you have multiple processes on the same VM all performing file I/O operations.

What you should use instead is either a database, a cache (like Redis), or even just write your file directly to a file storage service like Amazon S3.

I realize it sounds annoying that you have to do these extra things even for a simple use case like what you're doing here -- but Heroku's platform is geared around enforcing best practices to help people build scalable, reliable software.

If you're looking for a way to do stuff like this without the extra hassle, you might want to consider just purchasing a small VPS server from another company where you can have direct control over processes, disk, etc.

Post a Comment for "Save File Change On Heroku"