-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Instructions for setting SYMFONY_ENV on Heroku #4591
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,8 +71,9 @@ Deploying your Application on Heroku | |
|
||
To deploy your application to Heroku, you must first create a ``Procfile``, | ||
which tells Heroku what command to use to launch the web server with the | ||
correct settings. After you've done that, you can simply ``git push`` and | ||
you're done! | ||
correct document root. After that, you will ensure that your Symfony application | ||
runs the ``prod`` environment, and then you'll be ready to ``git push`` to | ||
Heroku for your first deploy! | ||
|
||
Creating a Procfile | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
@@ -110,6 +111,27 @@ create the ``Procfile`` file and to add it to the repository: | |
[master 35075db] Procfile for Apache and PHP | ||
1 file changed, 1 insertion(+) | ||
|
||
Setting the ``prod`` Environment | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
During a deploy, Heroku runs ``composer install --no-dev`` to install all of the | ||
dependencies your application requires. However, typical `post-install-commands`_ | ||
in ``composer.json``, e.g. to install assets or clear (or pre-warm) caches, run | ||
using Symfony's ``dev`` environment by default. | ||
|
||
This is clearly not what you want - the app runs in "production" (even if you | ||
use it just for an experiment, or as a staging environment), and so any build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. serial comma again There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this a subordinate clause, not an enumeration? |
||
steps should use the same ``prod`` environment as well. | ||
|
||
Thankfully, the solution to this problem is very simple: Symfony will pick up an | ||
environment variable named ``SYMFONY_ENV`` and use that environment if nothing | ||
else is explicitly set. As Heroku exposes all `config vars`_ as environment | ||
variables, you can issue a single command to prepare your app for a deployment: | ||
|
||
.. code-block:: bash | ||
|
||
$ heroku config:set SYMFONY_ENV=prod | ||
|
||
Pushing to Heroku | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
|
@@ -193,3 +215,5 @@ You should be seeing your Symfony application in your browser. | |
.. _`ephemeral file system`: https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem | ||
.. _`Logplex`: https://devcenter.heroku.com/articles/logplex | ||
.. _`verified that the RSA key fingerprint is correct`: https://devcenter.heroku.com/articles/git-repository-ssh-fingerprints | ||
.. _`post-install-commands`: https://getcomposer.org/doc/articles/scripts.md | ||
.. _`config vars`: https://devcenter.heroku.com/articles/config-vars |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our standard is to not use Oxford commas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is a subordinate clause, not a list of items, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not completely sure. Maybe our native speaker @weaverryan can make it clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dzuelke what do you mean by:
I mean, does the user need to do something here? Or do we just mean, double-check that things are ok when you go to
app.php
locally, just to be sure first? I'm just not sure myself, so I want it to be clear for others :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bah, nevermind - now I see the next section... - let me read the rest