Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.7] Allow ENV to control paths of cache files for services, packages and routes #27389

Conversation

divand
Copy link
Contributor

@divand divand commented Feb 2, 2019

In order to override paths of all files in bootstrap/cache, add env vars below:

APP_SERVICES_CACHE
APP_PACKAGES_CACHE
APP_ROUTES_CACHE

env var "APP_CONFIG_CACHE" already defined in commit 578bc83#diff-7b18a52eceff5eb716c1de268e98d55d

@divand divand changed the title Allow ENV to control paths of cache files for services, packages and routes [5.7] Allow ENV to control paths of cache files for services, packages and routes Feb 2, 2019
@taylorotwell
Copy link
Member

taylorotwell commented Feb 2, 2019

Do you have an actual use case for this in your application? If so, can you please describe it.

@divand
Copy link
Contributor Author

divand commented Feb 2, 2019

@taylorotwell, sure!
My app has no rights to write to "bootstrap/cache/" and "storage/".
So for "storage/" I'm using this workaround:
in .env:

VIEW_COMPILED_PATH="/tmp"
SESSION_DRIVER="cookie"
LOG_CHANNEL="stderr"

But I cannot override path for "bootstrap/cache/" natively. That's why I suggest to extend the ability to override all of paths which are using to write to fs.

@deleugpn
Copy link
Contributor

deleugpn commented Feb 3, 2019

I don't know if this is the best implementation, but in terms of feature I think this is gonna become a must-have sooner or later with the rise of AWS Lambda and the fact that only /tmp is writable.
At the moment, anybody running Laravel on Lambda is doing the changes to the index.php or boostrap/app.php. An environment variable is a much cleaner solution.

@taylorotwell taylorotwell merged commit b402b56 into laravel:5.7 Feb 4, 2019
@taylorotwell
Copy link
Member

@deleugpn this change isn't required to run Laravel (5.8 at least) on Lambda. Trust me... I would know 😉

@deleugpn
Copy link
Contributor

deleugpn commented Feb 4, 2019

@taylorotwell I remember going through all your commits on master branch to see if I could find anything related to Lambda when you teased about Vapor. Did I miss it somehow?

@martinbean
Copy link
Contributor

I remember going through all your commits on master branch to see if I could find anything related to Lambda when you teased about Vapor. Did I miss it somehow?

@taylorotwell Not missed it. Just think it’s a, “Wait until Laracon” deal.

@deleugpn
Copy link
Contributor

@martinbean I've been battling a lot with getting everything to work on Lambda and I feel like all my efforts are going to be thrown out the window after Vapor release.

@tomswinkels
Copy link
Contributor

@divand @taylorotwell Why this folders not always / default write to the storage folder?

@mikeschinkel
Copy link

Google sent me to this page when I was looking for this exact functionality. I am trying to configure Statamic without making changes to the code to avoid future upgrade hassles and so assumed this would be possible given how it is a best practice for 12 Factor apps.

Since the question was "What's the use-case?" here is mine:

My Statamic container is running in a VMware VM on my local network, and that container mounts the source directory from my laptop so I can work with the code there.  I am writing a custom autoloader tool that needs access to source code so I am not actually modifying any of the Statamic or Laravel code, but I need to test my code actually running and being served by the VM.

As my configuration is admittedly already really slow, having the cache served from my laptop there makes it even slower, which is why I want to move the cache to an SSD mounted locally on the VMware server. #justfyi #fwiw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants