-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Hackday] Update Heroku doc with SYMFONY_ENV param #4545
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,33 @@ change the value of ``path`` from | |
Once the application is deployed, run ``heroku logs --tail`` to keep the | ||
stream of logs from Heroku open in your terminal. | ||
|
||
|
||
Build priority in Composer | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Check that you call ``clearCache`` in the end of your app build, otherwise there can be situations | ||
when during the build you will generate hardcored links to heroku ``/tmp`` path. Typical Symfony2 | ||
build steps in ``composer.json`` should look like this: | ||
|
||
.. code-block:: yaml | ||
|
||
"post-install-cmd": [ | ||
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", | ||
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. is it really a good idea to show the complete content of the composer.json here? make sure you removed: .... 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. I would indeed prefer to use 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. This is no longer necessary, the underlying issue is now fixed in Symfony. 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. this section should then be removed from this PR to avoid confusion |
||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache" | ||
], | ||
"post-update-cmd": [ | ||
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", | ||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache" | ||
] | ||
|
||
Creating a new Application on Heroku | ||
------------------------------------ | ||
|
||
|
@@ -110,6 +137,25 @@ create the ``Procfile`` file and to add it to the repository: | |
[master 35075db] Procfile for Apache and PHP | ||
1 file changed, 1 insertion(+) | ||
|
||
Configuring Symfony to run in the prod environment | ||
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. "Configuring Symfony to Run in the Production Environment" |
||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
If you don’t explicitly configure the environment (``dev``, ``prod`` etc) | ||
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. use straight quotes here: 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. " |
||
to use, Symfony will, by default, use the ``dev`` environment in console | ||
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. from my point of view now it becomes weird because this isn't really heroku related. 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. @timglabisch its relates only to Heroku, without this environment variable your app will fall with a error on pushing to heroku master step. Many developers have faced this problem and if this would have been indicated in official documentation it would help to save a lot of time. 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. That is true, @mxnr, but as @timglabisch pointed out, it really should be done this way on all deploys, not just on deploys to Heroku. Otherwise, all the |
||
commands and at runtime. That would break our build, because in dev environments, | ||
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. You should always avoid first person usage: "That would break the build, because [...]" |
||
Symfony uses the ``SensioGeneratorBundle``to perform certain tasks, but that bundle | ||
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. missing space before "to perform" |
||
is not installed upon a push - `Composer does not install dev packages when pushing to Heroku`_. | ||
For Symfony to know it needs to use the ``prod`` environment at all times, it reads | ||
from the ``SYMFONY_ENV`` environment variable. You can simply `set environment variables`_ using | ||
the ``heroku config`` feature, so run this one command as the last step before deploying | ||
your app for the first time: | ||
|
||
.. code-block:: bash | ||
|
||
$heroku config:set SYMFONY_ENV=prod | ||
Setting config vars and restarting mighty-hamlet-1981... done, v3 | ||
SYMFONY_ENV: prod | ||
|
||
Pushing to Heroku | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
|
@@ -193,3 +239,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 | ||
.. _`Composer does not install dev packages when pushing to Heroku`: https://devcenter.heroku.com/articles/php-support#build-behavior | ||
.. _`set environment variables`: https://devcenter.heroku.com/articles/config-vars |
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.
this should be: Build Priority in Composer (all words should be capitialized in headings, except from closed class words)