I have a worker process in my app running a script every hour. This script writes data to the file system which the web app uses to update its contents. I've noticed that although the worker runs the process successfully, the data is not being updated. Is this at all related to the fact that heroku's file system is read only? If so, how can I write this file without having to get into databases?
Assuming your web and worker processes are instantiated in separate rows in your procfile, they are running on separate Heroku dynos, each with its own file system.
So, your web process does not have access to your worker process's file system, or vice versa.
Furthermore, even if you ran both processes on the same dyno (which is possible, but NOT recommended), you still could not use the local dyno file system to reliably transfer information from one process to another, since Heroku dynos can and will recycle without prior warning at least once every 24 hours or so, and when they do so any files you wrote to the local file system before the recycle disappear.
Bottom line: You should not and cannot use the local Heroku file system for what you are trying to do. Instead, you need to use some kind of stateful backing service (such as e.g Heroku Redis).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With