Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Deployment] Update deployment docs with new .env files logic #13084

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
Oct 21, 2020

Conversation

cristi-contiu
Copy link
Contributor

@cristi-contiu cristi-contiu commented Feb 8, 2020

The changes from last year regarding how the .env files are loaded can affect production deployments. Vendors like Heroku give recommendations based on documentation that no longer applies: "It is recommended that you do not use the symfony/dotenv package in production".

The symfony/dotenv has been moved from require-dev to require, so the note I removed in this PR no longer applies: symfony/skeleton#122 , symfony/website-skeleton#132 and symfony/demo@7ead1e4 . Loading .env files in production will work without any changes in composer.json.

Putting symfony/dotenv in require-dev (or not moving it to require during an upgrade from older versions of Symfony & recipes) can potentially break your app: if the DotEnv class is missing, the config/bootstrap.php file inside the FrameworkBundle's recipe will throw a RuntimeException . Also see symfony/recipes#501

The note now contains the right way to handle these files in production, by using $ composer dump-env prod in case you do not want the .env files to be processed on every request, also suggesting the --empty flag if you want to rely exclusively on "real" environment variables .

@HeahDude HeahDude added this to the 4.4 milestone Feb 9, 2020
@cristi-contiu
Copy link
Contributor Author

With the latest changes to the FrameworkBundle recipe symfony/recipes#734 , the DotEnv component can no longer be moved to required-dev (without changing the bootstrap.php file), so the note currently displayed in the deployment docs should be fixed - this PR fixes it.

@cristi-contiu cristi-contiu changed the title Update deployment docs with new .env files logic [Deployment] Update deployment docs with new .env files logic May 1, 2020
@beephotography
Copy link

beephotography commented Jul 14, 2020

Thanks @cristi-contiu !
If I could, I would approve these changes because they are very important in my opinion.

Maybe one should also consider changing the docs here:
https://symfony.com/doc/current/setup/flex.html
(as it's suggested to install dotenv via --dev)

Could you also change these docs, please?
And could somebody approve this pull request?

@wouterj wouterj changed the base branch from 4.1 to 4.4 October 21, 2020 12:24
@wouterj wouterj force-pushed the deployment_env_vars branch from 61d6eb0 to b905b57 Compare October 21, 2020 12:24
@wouterj
Copy link
Member

wouterj commented Oct 21, 2020

Hi Cristi! I'm sorry for the long wait, I'm not so sure why this hasn't been merged before. I've rebased this PR on 4.4 and made ome very minor changes. Thanks for submitting the PR!

@wouterj wouterj merged commit 024fa58 into symfony:4.4 Oct 21, 2020
@wouterj wouterj mentioned this pull request Oct 22, 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.

5 participants