I've started work on a little Discord bot hosted OpenShift Online, and I've gotten to the point where I'm trying to persist data across deployments. As far as I can tell, I should be able to create persistent volume, claim it and mount it in my deployment config, and then be able to read from and write to it.
I cannot for the life of me get past an issue with permissions though. The closest answer I've found is setting the OPENSHIFT_DATA_DIR environment variable to the mounted volume's directory, as discussed tangentially here, but I still get access denied when trying to write to that directory.
Repository: https://github.com/Solesaver/Alfred-Discord-Bot
Text Dump of Deployment Config: https://dumptext.com/RBDbnfcP
I've made a persistent volume and claim with Access Modes Read-Write-Once, the deployment configuration has it mounted at /data in read-write mode. I've added to the deployment's environment a variable with name OPENSHIFT_DATA_DIR and value /data.
No matter what combination I've tried so far, I always end up with access denied when I hit line 123 of bot.js:
fs.writeFileSync(howmanyPath, JSON.stringify(howmanyObj, null, 4), 'utf8');
At the end of the day all I really need to figure out is how to specify a directory that the arbitrary user OpenShift launches my app as has read/write permissions to. I'm pretty sure once I figure that out I can mount the persistent volume to whatever that ends up being.