Skip to content

Provides a way to override cache and log folders from the ENV #37114

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

Merged
merged 1 commit into from
Jun 9, 2020
Merged

Provides a way to override cache and log folders from the ENV #37114

merged 1 commit into from
Jun 9, 2020

Conversation

Plopix
Copy link
Contributor

@Plopix Plopix commented Jun 5, 2020

Q A
Branch? master
Bug fix? no
New feature? no
Deprecations? no
License MIT

When using Docker and especially on Mac OS X, performances are terrible when using a "mount" on the host inside the container. (which happens by default)

To optimize the performances, one of the tricks is to change where the application is going to write the cache and the logs.

This PR provides a new env variables APP_CACHE_DIR and APP_LOG_DIR which can be set to change where will be saved the caches and the logs.

I know we can do it per project BUT:

Let me know

@Plopix Plopix changed the title Provides a way to override cache and log folders form the ENV Provides a way to override cache and log folders from the ENV Jun 5, 2020
@nicolas-grekas nicolas-grekas added this to the next milestone Jun 5, 2020
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this. Thank you.

@GromNaN
Copy link
Member

GromNaN commented Jun 6, 2020

Why limiting this feature to the MicroKernelTrait and not having it in the base Kernel class? It might be confusing.

@Plopix
Copy link
Contributor Author

Plopix commented Jun 8, 2020

very good question @GromNaN I think the Kernel is to be really generic where the Trait is more related to Flex and Symfony a Framework (vs as a Component)
I think that is a tricky question on which there is no valid/straightforward answer.

So I will let you guys decide, but I vote for the Trait ;-)

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the trait is the correct location to provide some opinionated defaults (even the name of the env vars is opinionated)

@fabpot
Copy link
Member

fabpot commented Jun 9, 2020

Thank you @Plopix.

@GromNaN
Copy link
Member

GromNaN commented Jun 9, 2020

Not an issue, but I thought the default value was already very opinionated. $this->getProjectDir().'/var/cache/'.$this->environment;.

javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jun 13, 2020
…e ENV (Plopix)

This PR was merged into the master branch.

Discussion
----------

Provides a way to override cache and log folders from the ENV

Related to this new feature symfony/symfony#37114.

But I wonder if we have not oversimplified this PR: symfony/symfony#37114

Actually doing the documentation #13787 I figured that with #37114 we removed the important split per `env`.

In development mode (docker or not) we could definitely have the same project working in N Symfony different environments and this new `APP_CACHE_DIR` will only set the same path for all environments.

That would be manageable in the Virtualhost but in CLI that would be a pain to manage.
Also, we could rely on the DotEnv mechanism, but that could be really easy to forget.

I wonder if we should not change the code to: symfony/symfony#37232

Depending on the decisions I will update the doc here.

Commits
-------

88b081c Provides a way to override cache and log folders from the ENV
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
@fabpot fabpot mentioned this pull request Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants