From f769b914ce0dc659f95bef412ce5fe6a6dd79c8c Mon Sep 17 00:00:00 2001 From: Dmitry Semenov Date: Sat, 29 Nov 2014 14:50:28 +0100 Subject: [PATCH 1/3] [Hackday] Update Heroku doc with SYMFONY_ENV --- cookbook/deployment/heroku.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cookbook/deployment/heroku.rst b/cookbook/deployment/heroku.rst index 87baeb6c8d6..a1d55f1689c 100644 --- a/cookbook/deployment/heroku.rst +++ b/cookbook/deployment/heroku.rst @@ -110,6 +110,18 @@ 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 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you don’t explicitly configure the environment (``dev``, ``prod`` etc) to use, Symfony will, by default, use the ``dev`` environment in console commands and at runtime. That would break our build, because in dev environments, Symfony uses the ``SensioGeneratorBundle`` to perform certain tasks, but that bundle 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 +205,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 using the ``heroku config`` feature`: https://devcenter.heroku.com/articles/config-vars \ No newline at end of file From f29279d4e4892eb4df2a5a63ccd56a23ecce5db0 Mon Sep 17 00:00:00 2001 From: Dmitry Semenov Date: Sat, 29 Nov 2014 14:52:25 +0100 Subject: [PATCH 2/3] [Hackday] Update Heroku doc with SYMFONY_ENV --- cookbook/deployment/heroku.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/deployment/heroku.rst b/cookbook/deployment/heroku.rst index a1d55f1689c..72a07d12c15 100644 --- a/cookbook/deployment/heroku.rst +++ b/cookbook/deployment/heroku.rst @@ -114,7 +114,7 @@ Configuring Symfony to run in the prod environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you don’t explicitly configure the environment (``dev``, ``prod`` etc) to use, Symfony will, by default, use the ``dev`` environment in console commands and at runtime. That would break our build, because in dev environments, Symfony uses the ``SensioGeneratorBundle`` to perform certain tasks, but that bundle 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: +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 @@ -206,4 +206,4 @@ You should be seeing your Symfony application in your browser. .. _`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 using the ``heroku config`` feature`: https://devcenter.heroku.com/articles/config-vars \ No newline at end of file +.. _`set environment variables`: https://devcenter.heroku.com/articles/config-vars \ No newline at end of file From 65af59204b3fcb5f9e6f35a85d0378c26c68c888 Mon Sep 17 00:00:00 2001 From: Dmitry Semenov Date: Sat, 29 Nov 2014 15:50:56 +0100 Subject: [PATCH 3/3] Update docs with typical Heroku build issue --- cookbook/deployment/heroku.rst | 38 ++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/cookbook/deployment/heroku.rst b/cookbook/deployment/heroku.rst index 72a07d12c15..75b04117894 100644 --- a/cookbook/deployment/heroku.rst +++ b/cookbook/deployment/heroku.rst @@ -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", + "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 ------------------------------------ @@ -113,8 +140,15 @@ create the ``Procfile`` file and to add it to the repository: Configuring Symfony to run in the prod environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If you don’t explicitly configure the environment (``dev``, ``prod`` etc) to use, Symfony will, by default, use the ``dev`` environment in console commands and at runtime. That would break our build, because in dev environments, Symfony uses the ``SensioGeneratorBundle`` to perform certain tasks, but that bundle 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: +If you don’t explicitly configure the environment (``dev``, ``prod`` etc) +to use, Symfony will, by default, use the ``dev`` environment in console +commands and at runtime. That would break our build, because in dev environments, +Symfony uses the ``SensioGeneratorBundle``to perform certain tasks, but that bundle +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