We have a multi-server Craft setup, for redundancy and scaling.

We've been using an shared NFS drive to to host Craft's storage directory, by setting CRAFT_STORAGE_PATH to a mounted /craft-data/ directory on each machine.

in public/index.php:

define('CRAFT_STORAGE_PATH', '/craft-data/');

One reason it was important to do this was to let Craft share sessions across machines, because they were stored on the filesystem.

Recently, we transitioned from saving our sessions in the filesystem to saving them in redis.

If we can, I'd like to abandon the NFS drive altogether and let each machine have its own /craft-data/ directory, since we no longer need to maintain this shared filesystem for session sharing.

Looking at the contents of the craft /runtime/ directory, we see several subdirectories that seem like they could contain important shared state, such as cache and state:

$ pwd && ls -l /craft-data/runtime total 16 drwxrwxr-x 5 craft_user users 45 Jan 19 16:12 assets drwxrwxr-x 2 craft_user users 49 Jan 26 09:34 cache drwxrwxr-x 100 craft_user users 4096 Jan 26 09:37 compiled_templates drwxr-xr-x 2 craft_user users 65 Jan 25 12:12 CSS drwxr-xr-x 2 craft_user users 65 Jan 25 12:00 HTML drwxrwxr-x 2 craft_user users 4096 Jan 19 16:12 logs drwxrwxr-x 2 craft_user users 4096 Jan 26 08:52 sessions drwxrwxr-x 2 craft_user users 22 Nov 16 14:55 state drwxrwxr-x 2 craft_user users 4096 Jan 25 15:17 temp drwxr-xr-x 2 craft_user users 65 Dec 14 11:27 URI

Do any of these directories need to be shared, in a multi-server setup? Is it safe for us to stop using a networked filesystem, for the CRAFT_STORAGE_PATH?


Personally, I'd lean towards keeping the shared NFS volume. It's not just the runtime folder, but things like backups, site logos, user avatars, etc. and anything else plugins might be storing in storage that you'd want to consider as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.