Cloud Gotchas

Quite a few things are different when designing things for the cloud. So here is a list of common Gotchas you will come across.

Whats written to disc is not written in stone

In a classic hosting environment you have a persistent disk and if you write something to storage you can be sure to read it back a few lines of code later. When you have a Kubernetes orchestrated environment where containers by design go up, down and get moved about you cannot.

Writing things to disc is slow and generally a bad idea. But if you cannot write it to Redis or even the database as a fallback solution then there is one option left.

In your Magento folder you will find a the dir [MAGENTO_ROOT]/var/persistent

This folder is mounted from a clustered filesystem and will be available in all cron and webserver replicas. You can access this folder from a FTP deployed from your Magento2 Admin and from your code in the mount above.