So I set up my express app and deployed it successfully. I also set up persistent storage and mounted my app to it. However, there is the issue of data not being stored on the disk when the machine is offline. In my Dockerfile, I set up the WORKDIR as /app:
If I change the mount to /app, I always get errors when running the app, specifically:
pm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/app/package.json'
ERROR error umounting /app: EBUSY: Device or resource busy, retrying in a bit
And only when I change it back to /app-root does the app work as expected. I am not sure what I should do at this point.
You are absolutely right, the mistake I made was not creating the new dir within app-root where the files were stored. Now by creating this and pointing the files to the absolute path where they would be stored for future purposes, they became accessible and I could read and write from the persistent volume.