From 3fd637469982287a70858bb2952edbfc825c2d89 Mon Sep 17 00:00:00 2001 From: Oliver Stark <os@fortrabbit.com> Date: Fri, 19 Feb 2016 11:54:48 +0100 Subject: [PATCH 1/8] fortrabbit deployment guide + index listing --- cookbook/deployment/fortrabbit.rst | 213 +++++++++++++++++++++++++++++ cookbook/deployment/index.rst | 1 + 2 files changed, 214 insertions(+) create mode 100644 cookbook/deployment/fortrabbit.rst diff --git a/cookbook/deployment/fortrabbit.rst b/cookbook/deployment/fortrabbit.rst new file mode 100644 index 00000000000..54515473d66 --- /dev/null +++ b/cookbook/deployment/fortrabbit.rst @@ -0,0 +1,213 @@ +.. index:: + single: Deployment; Deploying to fortrabbit.com + +Deploying to fortrabbit +======================= + +This step-by-step cookbook describes how to deploy a Symfony web application to `fortrabbit`_. You can read more about using Symfony with fortrabbit on the official fortrabbit `Symfony install guide`_. + + + +Setting up fortrabbit +--------------------- + +Before we begin, you should have done a few things on the fortrabbit side: + +- Sign up +- Add an SSH key to your Account (to deploy via Git) +- Create an App + + +Preparing your Application +-------------------------- + +You don't need to change any code to deploy a Symfony application to fortrabbit. But it requires some minor tweaks to its configuration. + + +Configure Logging +~~~~~~~~~~~~~~~~~ + +Per default Symfony logs to a file. Modify the app/config/config_prod.yml file to redirect it to PHP's error_log(): + +.. code-block:: yaml + + monolog: + # .. + handlers: + # .. + nested: + type: error_log + # .. + +Configuring Database Access & Session Handler +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can use the fortrabbit App Secrets to attain your database credentials. Create the file app/config_prod_secrets.php with the following contents:: + + <?php + // Get the path to the secrects.json file + if (!$secrets = getenv("APP_SECRETS")) { + return; + } + + // Read the file and decode json to an array + $secrets = json_decode(file_get_contents($secrets), true); + + // Set database parameters to the container + if (isset($secrets['MYSQL'])) { + + $container->setParameter('database_driver', 'pdo_mysql'); + $container->setParameter('database_host', $secrets['MYSQL']['HOST']); + $container->setParameter('database_name', $secrets['MYSQL']['DATABASE']); + $container->setParameter('database_user', $secrets['MYSQL']['USER']); + $container->setParameter('database_password', $secrets['MYSQL']['PASSWORD']); + } + + // Check if the Memcache component is present + if (isset($secrets['MEMCACHE'])) { + + $memcache = $secrets['MEMCACHE']; + $handlers = []; + + foreach (range(1, $memcache['COUNT']) as $num) { + $handlers [] = $memcache['HOST'. $num]. ':'. $memcache['PORT'. $num]; + } + + // Apply ini settings + ini_set('session.save_handler', 'memcached'); + ini_set('session.save_path', implode(',', $handlers)); + + if ($memcache['COUNT'] == 2) { + ini_set('memcached.sess_number_of_replicas', 1); + ini_set('memcached.sess_consistent_hash', 1); + ini_set('memcached.sess_binary', 1); + } + + } + + +Make sure this file is listed in your *imports*: + +.. code-block:: yaml + + # app/config/config_prod.yml + imports: + - { resource: config.yml } + - { resource: config_prod_secrets.php } + + # .. + framework: + session: + # set handler_id to null to use default session handler from php.ini (memcached) + handler_id: ~ + # .. + + + +Configuring the Environment in the Dashboard +-------------------------------------------- + +PHP Settings +~~~~~~~~~~~~ + +The PHP version and enabled extensions are configuable under the PHP settings of your App within the fortrabbit Dashboard. + + +Environment Variables +~~~~~~~~~~~~~~~~~~~~~ + +Set the `SYMFONY_ENV` environment variable to `prod` to make sure the right config files get loaded. ENV vars are configuable in fortrabbit Dashboard as well. + + +Document Root +~~~~~~~~~~~~~ + +The document root is configuable for every custom domain you setup for your App. The default is /htdocs, but for Symfony +you probalby want to change it to /htdocs/web. You also do so in the fortrabbit Dashboard under `Domain` settings. + + +Deploying to fortrabbit +----------------------- + +It is assumed that your codebase is under version-control with Git and dependencies are managed with Composer (locally). + +Every time you push to fortrabbit composer install runs before your code gets deployed. To finetune the deployment behaviour put a `fortrabbit.yml`_. deployment file (optional) in the project root. + +Add fortrabbit as a (additional) Git remote and add your configuration changes. + +.. code-block:: bash + + $ git remote add fortrabbit git@deploy.eu2.frbit.com:your-app.git + $ git add composer.json composer.lock + $ git add app/config/config_prod_secrets.php + +Commit and push + +.. code-block:: bash + + $ git commit -m 'fortrabbit config' + $ git push fortrabbit master -u + +**Note:** Replace your-app with the name of your fortrabbit App. + + +.. code-block:: bash + + Commit received, starting build of branch master + + ––––––––––––––––––––––– ∙ƒ ––––––––––––––––––––––– + + B U I L D + + Checksum: + def1bb29911a62de26b1ddac6ef97fc76a5c647b + + Deployment file: + fortrabbit.yml + + Pre-script: + not found + 0ms + + Composer: + - - - + Loading composer repositories with package information + Installing dependencies (including require-dev) from lock file + Nothing to install or update + Generating autoload files + + - - - + 172ms + + Post-script: + not found + 0ms + + R E L E A S E + + Packaging: + 930ms + + Revision: + 1455788127289043421.def1bb29911a62de26b1ddac6ef97fc76a5c647b + + Size: + 9.7MB + + Uploading: + 500ms + + Build & release done in 1625ms, now queued for final distribution. + + +.. note:: + + The first `git push` takes much longer as all composer dependencies get downloaded. All subsequent deploys are done within seconds. + + +That's it! Your application is being deployed on fortrabbit. More information about `database migrations and tunneling`_ can be found in the fortrabbit documentation. + +.. _`fortrabbit`: http://www.fortrabbit.com +.. _`symfony install guide`: http://help.fortrabbit.com/install-symfony +.. _`fortrabbit.yml`: http://help.fortrabbit.com/deployment-file-v2 +.. _`database migrations and tunneling`: http://help.fortrabbit.com/install-symfony-2#toc-migrate-amp-other-database-commands diff --git a/cookbook/deployment/index.rst b/cookbook/deployment/index.rst index 2b1a962fb54..f3080a413fa 100644 --- a/cookbook/deployment/index.rst +++ b/cookbook/deployment/index.rst @@ -8,3 +8,4 @@ Deployment azure-website heroku platformsh + fortrabbit \ No newline at end of file From 907365e7564b7506ebc8f31639d4646587ef32c1 Mon Sep 17 00:00:00 2001 From: Oliver Stark <os@fortrabbit.com> Date: Fri, 19 Feb 2016 12:16:58 +0100 Subject: [PATCH 2/8] fortrabbit deployment guide + index listing - 80 chars wrap --- cookbook/deployment/fortrabbit.rst | 38 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/cookbook/deployment/fortrabbit.rst b/cookbook/deployment/fortrabbit.rst index 54515473d66..dfdb18e9d21 100644 --- a/cookbook/deployment/fortrabbit.rst +++ b/cookbook/deployment/fortrabbit.rst @@ -4,7 +4,9 @@ Deploying to fortrabbit ======================= -This step-by-step cookbook describes how to deploy a Symfony web application to `fortrabbit`_. You can read more about using Symfony with fortrabbit on the official fortrabbit `Symfony install guide`_. +This step-by-step cookbook describes how to deploy a Symfony web application to + `fortrabbit`_. You can read more about using Symfony with fortrabbit on the + official fortrabbit `Symfony install guide`_. @@ -21,13 +23,15 @@ Before we begin, you should have done a few things on the fortrabbit side: Preparing your Application -------------------------- -You don't need to change any code to deploy a Symfony application to fortrabbit. But it requires some minor tweaks to its configuration. +You don't need to change any code to deploy a Symfony application to fortrabbit. +But it requires some minor tweaks to its configuration. Configure Logging ~~~~~~~~~~~~~~~~~ -Per default Symfony logs to a file. Modify the app/config/config_prod.yml file to redirect it to PHP's error_log(): +Per default Symfony logs to a file. Modify the app/config/config_prod.yml file +to redirect it to PHP's error_log(): .. code-block:: yaml @@ -42,7 +46,8 @@ Per default Symfony logs to a file. Modify the app/config/config_prod.yml file t Configuring Database Access & Session Handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You can use the fortrabbit App Secrets to attain your database credentials. Create the file app/config_prod_secrets.php with the following contents:: +You can use the fortrabbit App Secrets to attain your database credentials. +Create the file app/config_prod_secrets.php with the following contents:: <?php // Get the path to the secrects.json file @@ -110,28 +115,34 @@ Configuring the Environment in the Dashboard PHP Settings ~~~~~~~~~~~~ -The PHP version and enabled extensions are configuable under the PHP settings of your App within the fortrabbit Dashboard. +The PHP version and enabled extensions are configuable under the PHP settings +of your App within the fortrabbit Dashboard. Environment Variables ~~~~~~~~~~~~~~~~~~~~~ -Set the `SYMFONY_ENV` environment variable to `prod` to make sure the right config files get loaded. ENV vars are configuable in fortrabbit Dashboard as well. +Set the `SYMFONY_ENV` environment variable to `prod` to make sure the right +config files get loaded. ENV vars are configuable in fortrabbit Dashboard as well. Document Root ~~~~~~~~~~~~~ -The document root is configuable for every custom domain you setup for your App. The default is /htdocs, but for Symfony -you probalby want to change it to /htdocs/web. You also do so in the fortrabbit Dashboard under `Domain` settings. +The document root is configuable for every custom domain you setup for your App. +The default is /htdocs, but for Symfony you probalby want to change it to +/htdocs/web. You also do so in the fortrabbit Dashboard under `Domain` settings. Deploying to fortrabbit ----------------------- -It is assumed that your codebase is under version-control with Git and dependencies are managed with Composer (locally). +It is assumed that your codebase is under version-control with Git and dependencies + are managed with Composer (locally). -Every time you push to fortrabbit composer install runs before your code gets deployed. To finetune the deployment behaviour put a `fortrabbit.yml`_. deployment file (optional) in the project root. +Every time you push to fortrabbit composer install runs before your code gets +deployed. To finetune the deployment behaviour put a `fortrabbit.yml`_. deployment +file (optional) in the project root. Add fortrabbit as a (additional) Git remote and add your configuration changes. @@ -202,10 +213,13 @@ Commit and push .. note:: - The first `git push` takes much longer as all composer dependencies get downloaded. All subsequent deploys are done within seconds. + The first `git push` takes much longer as all composer dependencies get + downloaded. All subsequent deploys are done within seconds. -That's it! Your application is being deployed on fortrabbit. More information about `database migrations and tunneling`_ can be found in the fortrabbit documentation. +That's it! Your application is being deployed on fortrabbit. More information +about `database migrations and tunneling`_ can be found in the fortrabbit +documentation. .. _`fortrabbit`: http://www.fortrabbit.com .. _`symfony install guide`: http://help.fortrabbit.com/install-symfony From 0b592224fb719dada80d6e506950c1c276c6135a Mon Sep 17 00:00:00 2001 From: Oliver Stark <os@fortrabbit.com> Date: Mon, 22 Feb 2016 11:11:12 +0100 Subject: [PATCH 3/8] use the right RST syntax + fix typos --- cookbook/deployment/fortrabbit.rst | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cookbook/deployment/fortrabbit.rst b/cookbook/deployment/fortrabbit.rst index dfdb18e9d21..49122e0397e 100644 --- a/cookbook/deployment/fortrabbit.rst +++ b/cookbook/deployment/fortrabbit.rst @@ -122,7 +122,7 @@ of your App within the fortrabbit Dashboard. Environment Variables ~~~~~~~~~~~~~~~~~~~~~ -Set the `SYMFONY_ENV` environment variable to `prod` to make sure the right +Set the ``SYMFONY_ENV`` environment variable to ``prod`` to make sure the right config files get loaded. ENV vars are configuable in fortrabbit Dashboard as well. @@ -130,18 +130,18 @@ Document Root ~~~~~~~~~~~~~ The document root is configuable for every custom domain you setup for your App. -The default is /htdocs, but for Symfony you probalby want to change it to -/htdocs/web. You also do so in the fortrabbit Dashboard under `Domain` settings. +The default is /htdocs, but for Symfony you probably want to change it to +/htdocs/web. You also do so in the fortrabbit Dashboard under ``Domain`` settings. Deploying to fortrabbit ----------------------- It is assumed that your codebase is under version-control with Git and dependencies - are managed with Composer (locally). +are managed with Composer (locally). Every time you push to fortrabbit composer install runs before your code gets -deployed. To finetune the deployment behaviour put a `fortrabbit.yml`_. deployment +deployed. To finetune the deployment behavior put a `fortrabbit.yml`_. deployment file (optional) in the project root. Add fortrabbit as a (additional) Git remote and add your configuration changes. @@ -159,7 +159,10 @@ Commit and push $ git commit -m 'fortrabbit config' $ git push fortrabbit master -u -**Note:** Replace your-app with the name of your fortrabbit App. + +.. note:: + + Replace your-app with the name of your fortrabbit App. .. code-block:: bash @@ -213,7 +216,7 @@ Commit and push .. note:: - The first `git push` takes much longer as all composer dependencies get + The first ``git push` takes much longer as all composer dependencies get downloaded. All subsequent deploys are done within seconds. From 5d436af276d9fa06f775c61c67abb7f490784f8f Mon Sep 17 00:00:00 2001 From: Oliver Stark <os@fortrabbit.com> Date: Mon, 22 Feb 2016 11:14:16 +0100 Subject: [PATCH 4/8] use the right RST syntax + fix typos --- cookbook/deployment/fortrabbit.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/deployment/fortrabbit.rst b/cookbook/deployment/fortrabbit.rst index 49122e0397e..1a0c729b7c1 100644 --- a/cookbook/deployment/fortrabbit.rst +++ b/cookbook/deployment/fortrabbit.rst @@ -216,7 +216,7 @@ Commit and push .. note:: - The first ``git push` takes much longer as all composer dependencies get + The first ``git push`` takes much longer as all composer dependencies get downloaded. All subsequent deploys are done within seconds. From 68efc510aac7a315c595397018670855300bc8c0 Mon Sep 17 00:00:00 2001 From: Oliver Stark <os@fortrabbit.com> Date: Tue, 23 Feb 2016 11:02:13 +0100 Subject: [PATCH 5/8] better config code-blocks and proper .rst styles --- cookbook/deployment/fortrabbit.rst | 171 +++++++++++++++++------------ 1 file changed, 101 insertions(+), 70 deletions(-) diff --git a/cookbook/deployment/fortrabbit.rst b/cookbook/deployment/fortrabbit.rst index 1a0c729b7c1..7207d4aa963 100644 --- a/cookbook/deployment/fortrabbit.rst +++ b/cookbook/deployment/fortrabbit.rst @@ -13,11 +13,11 @@ This step-by-step cookbook describes how to deploy a Symfony web application to Setting up fortrabbit --------------------- -Before we begin, you should have done a few things on the fortrabbit side: +Before getting started, you should have done a few things on the fortrabbit side: -- Sign up -- Add an SSH key to your Account (to deploy via Git) -- Create an App +* Sign up +* Add an SSH key to your Account (to deploy via Git) +* Create an App Preparing your Application @@ -30,83 +30,114 @@ But it requires some minor tweaks to its configuration. Configure Logging ~~~~~~~~~~~~~~~~~ -Per default Symfony logs to a file. Modify the app/config/config_prod.yml file -to redirect it to PHP's error_log(): - -.. code-block:: yaml - - monolog: - # .. - handlers: - # .. - nested: - type: error_log - # .. +Per default Symfony logs to a file. Modify the ``app/config/config_prod.yml`` file +to redirect it to :phpfunction:`error_log`: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config_prod.yml + monolog: + # ... + handlers: + nested: + type: error_log + + .. code-block:: xml + + <!-- app/config/config_prod.xml --> + <?xml version="1.0" encoding="UTF-8" ?> + <container xmlns="http://symfony.com/schema/dic/services" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:monolog="http://symfony.com/schema/dic/monolog" + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/monolog + http://symfony.com/schema/dic/monolog/monolog-1.0.xsd"> + + <monolog:config> + <!-- ... --> + <monolog:handler + name="nested" + type="error_log" + /> + </monolog:config> + </container> + + .. code-block:: php + + // app/config/config_prod.php + $container->loadFromExtension('monolog', array( + // ... + 'handlers' => array( + 'nested' => array( + 'type' => 'error_log', + ), + ), + )); Configuring Database Access & Session Handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can use the fortrabbit App Secrets to attain your database credentials. -Create the file app/config_prod_secrets.php with the following contents:: - - <?php - // Get the path to the secrects.json file - if (!$secrets = getenv("APP_SECRETS")) { - return; - } - - // Read the file and decode json to an array - $secrets = json_decode(file_get_contents($secrets), true); - - // Set database parameters to the container - if (isset($secrets['MYSQL'])) { - - $container->setParameter('database_driver', 'pdo_mysql'); - $container->setParameter('database_host', $secrets['MYSQL']['HOST']); - $container->setParameter('database_name', $secrets['MYSQL']['DATABASE']); - $container->setParameter('database_user', $secrets['MYSQL']['USER']); - $container->setParameter('database_password', $secrets['MYSQL']['PASSWORD']); - } - - // Check if the Memcache component is present - if (isset($secrets['MEMCACHE'])) { - - $memcache = $secrets['MEMCACHE']; - $handlers = []; - - foreach (range(1, $memcache['COUNT']) as $num) { - $handlers [] = $memcache['HOST'. $num]. ':'. $memcache['PORT'. $num]; - } - - // Apply ini settings - ini_set('session.save_handler', 'memcached'); - ini_set('session.save_path', implode(',', $handlers)); - - if ($memcache['COUNT'] == 2) { - ini_set('memcached.sess_number_of_replicas', 1); - ini_set('memcached.sess_consistent_hash', 1); - ini_set('memcached.sess_binary', 1); - } - - } +Create the file ``app/config_prod_secrets.php`` with the following contents:: + + <?php + // Get the path to the secrects.json file + if (!$secrets = getenv("APP_SECRETS")) { + return; + } + + // Read the file and decode json to an array + $secrets = json_decode(file_get_contents($secrets), true); + + // Set database parameters to the container + if (isset($secrets['MYSQL'])) { + + $container->setParameter('database_driver', 'pdo_mysql'); + $container->setParameter('database_host', $secrets['MYSQL']['HOST']); + $container->setParameter('database_name', $secrets['MYSQL']['DATABASE']); + $container->setParameter('database_user', $secrets['MYSQL']['USER']); + $container->setParameter('database_password', $secrets['MYSQL']['PASSWORD']); + } + // Check if the Memcache component is present + if (isset($secrets['MEMCACHE'])) { + + $memcache = $secrets['MEMCACHE']; + $handlers = []; + + foreach (range(1, $memcache['COUNT']) as $num) { + $handlers [] = $memcache['HOST' . $num] . ':' . $memcache['PORT' . $num]; + } + + // Apply ini settings + ini_set('session.save_handler', 'memcached'); + ini_set('session.save_path', implode(',', $handlers)); + + if ($memcache['COUNT'] == 2) { + ini_set('memcached.sess_number_of_replicas', 1); + ini_set('memcached.sess_consistent_hash', 1); + ini_set('memcached.sess_binary', 1); + } + } Make sure this file is listed in your *imports*: .. code-block:: yaml - # app/config/config_prod.yml - imports: - - { resource: config.yml } - - { resource: config_prod_secrets.php } - - # .. - framework: - session: - # set handler_id to null to use default session handler from php.ini (memcached) - handler_id: ~ - # .. - + # app/config/config_prod.yml + imports: + - { resource: config.yml } + - { resource: config_prod_secrets.php } + + # .. + framework: + session: + # set handler_id to null to use default session handler from php.ini (memcached) + handler_id: ~ + # .. Configuring the Environment in the Dashboard From 31752353ed076229133886cf7cc6761df75e4cc2 Mon Sep 17 00:00:00 2001 From: Oliver Stark <os@fortrabbit.com> Date: Fri, 26 Feb 2016 11:37:46 +0100 Subject: [PATCH 6/8] removed double line breaks --- cookbook/deployment/fortrabbit.rst | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cookbook/deployment/fortrabbit.rst b/cookbook/deployment/fortrabbit.rst index 7207d4aa963..0aa44982f25 100644 --- a/cookbook/deployment/fortrabbit.rst +++ b/cookbook/deployment/fortrabbit.rst @@ -8,8 +8,6 @@ This step-by-step cookbook describes how to deploy a Symfony web application to `fortrabbit`_. You can read more about using Symfony with fortrabbit on the official fortrabbit `Symfony install guide`_. - - Setting up fortrabbit --------------------- @@ -19,14 +17,12 @@ Before getting started, you should have done a few things on the fortrabbit side * Add an SSH key to your Account (to deploy via Git) * Create an App - Preparing your Application -------------------------- You don't need to change any code to deploy a Symfony application to fortrabbit. But it requires some minor tweaks to its configuration. - Configure Logging ~~~~~~~~~~~~~~~~~ @@ -149,14 +145,12 @@ PHP Settings The PHP version and enabled extensions are configuable under the PHP settings of your App within the fortrabbit Dashboard. - Environment Variables ~~~~~~~~~~~~~~~~~~~~~ Set the ``SYMFONY_ENV`` environment variable to ``prod`` to make sure the right config files get loaded. ENV vars are configuable in fortrabbit Dashboard as well. - Document Root ~~~~~~~~~~~~~ @@ -164,7 +158,6 @@ The document root is configuable for every custom domain you setup for your App. The default is /htdocs, but for Symfony you probably want to change it to /htdocs/web. You also do so in the fortrabbit Dashboard under ``Domain`` settings. - Deploying to fortrabbit ----------------------- @@ -190,12 +183,10 @@ Commit and push $ git commit -m 'fortrabbit config' $ git push fortrabbit master -u - .. note:: Replace your-app with the name of your fortrabbit App. - .. code-block:: bash Commit received, starting build of branch master @@ -250,7 +241,6 @@ Commit and push The first ``git push`` takes much longer as all composer dependencies get downloaded. All subsequent deploys are done within seconds. - That's it! Your application is being deployed on fortrabbit. More information about `database migrations and tunneling`_ can be found in the fortrabbit documentation. From 918653221134abf568539de586e1bcbb298ed845 Mon Sep 17 00:00:00 2001 From: Oliver Stark <os@fortrabbit.com> Date: Fri, 26 Feb 2016 12:05:56 +0100 Subject: [PATCH 7/8] added/fixed links --- cookbook/deployment/fortrabbit.rst | 11 ++++++----- cookbook/map.rst.inc | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cookbook/deployment/fortrabbit.rst b/cookbook/deployment/fortrabbit.rst index 0aa44982f25..756bbd2a55a 100644 --- a/cookbook/deployment/fortrabbit.rst +++ b/cookbook/deployment/fortrabbit.rst @@ -13,7 +13,7 @@ Setting up fortrabbit Before getting started, you should have done a few things on the fortrabbit side: -* Sign up +* `Sign up`_. * Add an SSH key to your Account (to deploy via Git) * Create an App @@ -245,7 +245,8 @@ That's it! Your application is being deployed on fortrabbit. More information about `database migrations and tunneling`_ can be found in the fortrabbit documentation. -.. _`fortrabbit`: http://www.fortrabbit.com -.. _`symfony install guide`: http://help.fortrabbit.com/install-symfony -.. _`fortrabbit.yml`: http://help.fortrabbit.com/deployment-file-v2 -.. _`database migrations and tunneling`: http://help.fortrabbit.com/install-symfony-2#toc-migrate-amp-other-database-commands +.. _`fortrabbit`: https://www.fortrabbit.com +.. _`Symfony install guide`: https://help.fortrabbit.com/install-symfony +.. _`fortrabbit.yml`: https://help.fortrabbit.com/deployment-file-v2 +.. _`database migrations and tunneling`: https://help.fortrabbit.com/install-symfony-2#toc-migrate-amp-other-database-commands +.. _`Sign up`: https://dashboard.fortrabbit.com \ No newline at end of file diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 805eee4a262..82ef8e8bd78 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -64,6 +64,7 @@ * :doc:`/cookbook/deployment/azure-website` * :doc:`/cookbook/deployment/heroku` * :doc:`/cookbook/deployment/platformsh` + * :doc:`/cookbook/deployment/fortrabbit` * :doc:`/cookbook/doctrine/index` From d52daa0eb655064f632880fc56c31036e4599937 Mon Sep 17 00:00:00 2001 From: Oliver Stark <os@fortrabbit.com> Date: Fri, 26 Feb 2016 13:41:59 +0100 Subject: [PATCH 8/8] some text formats and added missing configuration-block(s) --- cookbook/deployment/fortrabbit.rst | 65 +++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/cookbook/deployment/fortrabbit.rst b/cookbook/deployment/fortrabbit.rst index 756bbd2a55a..780bd829e50 100644 --- a/cookbook/deployment/fortrabbit.rst +++ b/cookbook/deployment/fortrabbit.rst @@ -112,7 +112,7 @@ Create the file ``app/config_prod_secrets.php`` with the following contents:: ini_set('session.save_handler', 'memcached'); ini_set('session.save_path', implode(',', $handlers)); - if ($memcache['COUNT'] == 2) { + if ("2" === $memcache['COUNT']) { ini_set('memcached.sess_number_of_replicas', 1); ini_set('memcached.sess_consistent_hash', 1); ini_set('memcached.sess_binary', 1); @@ -121,20 +121,57 @@ Create the file ``app/config_prod_secrets.php`` with the following contents:: Make sure this file is listed in your *imports*: -.. code-block:: yaml +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config_prod.yml + imports: + - { resource: config.yml } + - { resource: config_prod_secrets.php } + + # .. + framework: + session: + # set handler_id to null to use default session handler from php.ini (memcached) + handler_id: ~ + # .. + + .. code-block:: xml + + <!-- app/config/config_prod.xml --> + <?xml version="1.0" encoding="UTF-8"?> + <container xmlns="http://symfony.com/schema/dic/services" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:framework="http://symfony.com/schema/dic/symfony" + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> + + <imports> + <import resource="config.xml" /> + <import resource="config_prod_secrets.php" /> + </imports> + + <!-- .. --> + <framework:config> + <!-- .. --> + <framework:session save_path="null" /> + </framework:config> + </container> - # app/config/config_prod.yml - imports: - - { resource: config.yml } - - { resource: config_prod_secrets.php } + .. code-block:: php - # .. - framework: - session: - # set handler_id to null to use default session handler from php.ini (memcached) - handler_id: ~ - # .. + // app/config/config_prod.php + $loader->import('config/config.php'); + $loader->import('config_prod_secrets.php'); + + $container->loadFromExtension('framework', array( + 'session' => array( + 'handler_id' => null, + ), + )); + // ... Configuring the Environment in the Dashboard -------------------------------------------- @@ -155,8 +192,8 @@ Document Root ~~~~~~~~~~~~~ The document root is configuable for every custom domain you setup for your App. -The default is /htdocs, but for Symfony you probably want to change it to -/htdocs/web. You also do so in the fortrabbit Dashboard under ``Domain`` settings. +The default is ``/htdocs``, but for Symfony you probably want to change it to +``/htdocs/web``. You also do so in the fortrabbit Dashboard under ``Domain`` settings. Deploying to fortrabbit -----------------------