Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

david-c's avatar

Storage Directory independent of Deployment Cycle?

I am looking for a sounding a board to make sure I am not "too far off base" on this issue.

Moving to Laravel soon and have taken on the daunting task of "wrapping" our Legacy Code in Laravel. I am currently converting our "storage" calls over to the Laravel storage pattern (storage/app, storage/framework, storage/logs, etc, etc).

The issue is actually two fold. The first issue is that everything in storage is git ignored, as it should be ... but the reality is that a lot of our files are assets that have intrinsic value. So they really should not be stored inside the "vhost" that contains the framework imo.

The second issue is that deployment is not done through changing conf files, or doing fresh repo pulls, but rather though symlinking the document root. ie:

document_root = /var/www/vhosts/site1/production/public

Where the "production" directory is symlinked to a repo directory:

/var/www/vhosts/site1/release-2.30

/var/www/vhosts/site1/release-2.29

/var/www/vhosts/site1/hotfix-1.45

Release process is: Create a directory (release-2.31), checkout the branch, run composer (in the future), point a stage conf file to the newly created directory and test. After testing, simply re-link the "production" directory to the newly created (and tested) repo branch ... in this case: release-2.31.

Still with me?

So the problem is that "storage" really can't / should not be in the actual branch. Yes, we could symlink the storage directory inside the repo directory to a storage directory outside of the repo branch, but that makes creating the branch directories require yet one more step, and then that grows to two more steps, and then 4 more steps ... not good.

My knee jerk reaction is to have permanent storage directories that relate to production vs stage. Then simply "register" the directories inside the .env files.

Directory would be something like:

/var/www/vhosts/storage/production/site1

/var/www/vhosts/storage/stage/site1

Where the env files have:

prod.env contains: putenv("PATH_STORAGE='/var/www/vhosts/storage/production/site1'");

I am not entirely happy with this solutions. I think the storage might be a bit too removed from the vhost it's associated with.

I am wondering if other people have had this dilemma and how they have solved it.

Thanks in advance.

0 likes
3 replies
nate.a.johnson's avatar

Sounds like you are describing a process similar to how Laravel Envoyer works. It will create a site for you, and inside of the site two directory and a symlink: releases and storage are the directories and current is the link that points to the releases/xxx directory that is the current version of your deployed app. This way your app always points at site/current and the storage directory never changes because on a deploy, the the storage inside the current released directory gets symlinked back to the one storage directory as well.

All that said, take a look at envoyer and see if that might solve your problem. At $10 a month, you can hardly beat the price for the service.

david-c's avatar

@nate.a.johnson

Thanks for the advise and I will look at Envoyer for the pattern it uses, but everything will need self hosted.

Right now the issue is choosing the pattern of where storage will be kept across a multi domain server and validating I am going the right direction.

Please or to participate in this conversation.