From 0ada668c09f3818d2d6c56cb53d540b9c3917de0 Mon Sep 17 00:00:00 2001 From: GuGuss Date: Thu, 27 Nov 2014 17:52:14 +0100 Subject: [PATCH 01/11] Deploy Symfony application on Platform.sh. --- cookbook/deployment/index.rst | 1 + cookbook/deployment/platformsh.rst | 195 +++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 cookbook/deployment/platformsh.rst diff --git a/cookbook/deployment/index.rst b/cookbook/deployment/index.rst index ef5699e8cea..7c6d2c674be 100644 --- a/cookbook/deployment/index.rst +++ b/cookbook/deployment/index.rst @@ -5,5 +5,6 @@ Deployment :maxdepth: 2 tools + platformsh azure-website heroku diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst new file mode 100644 index 00000000000..2137cff4249 --- /dev/null +++ b/cookbook/deployment/platformsh.rst @@ -0,0 +1,195 @@ +.. index:: + single: Deployment; Deploying to Platform.sh + +Deploying to Platform.sh +======================== + +This step by step cookbook describes how to deploy a Symfony web application to +`Platform.sh`_ . You can read more about using Symfony with Platform.sh on the +official `Platform.sh documentation`_. + +Deploy an existing site +----------------------- + +In this guide, we assume your codebase is already versioned with Git. + +Get a project on Platform.sh +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You need to subscribe to a `Platform.sh project`_. Choose the development plan +and go through the checkout process. + +Once your project is ready, give it a name and choose: **Import an existing +site**. + +Prepare your Application +~~~~~~~~~~~~~~~~~~~~~~~~ + +To deploy your Symfony application on Platform.sh, you simply need to add a +``.platform.app.yaml`` at the root of your Git repository which will tell +Platform.sh how to deploy your application (read more about `Platform.sh +configuration files`_). + +.. code-block:: yaml + + # This file describes an application. You can have multiple applications + # in the same project. + + # The name of this app. Must be unique within a project. + name: php + + # The toolstack used to build the application. + toolstack: "php:symfony" + + # The relationships of the application with services or other applications. + # The left-hand side is the name of the relationship as it will be exposed + # to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand + # side is in the form `:`. + relationships: + database: "mysql:mysql" + + # The configuration of app when it is exposed to the web. + web: + # The public directory of the app, relative to its root. + document_root: "/web" + # The front-controller script to send non-static requests to. + passthru: "/app.php" + + # The size of the persistent disk of the application (in MB). + disk: 2048 + + # The mounts that will be performed when the package is deployed. + mounts: + "/app/cache": "shared:files/cache" + "/app/logs": "shared:files/logs" + + # The hooks that will be performed when the package is deployed. + hooks: + build: | + rm web/app_dev.php + app/console --env=prod assetic:dump --no-debug + deploy: | + app/console --env=prod cache:clear + + # The configuration of scheduled execution. + # see http://symfony.com/doc/current/components/console/introduction.html + #crons: + # symfony: + # spec: "*/20 * * * *" + # cmd: "php cron.php example:test" + +For best practices, you should also add a ``.platform`` folder at the root of +your Git repository which contains the following files: + +.. code-block:: yaml + + # .platform/routes.yaml + "http://{default}/": + type: upstream + upstream: "php:php" + +.. code-block:: yaml + + # .platform/services.yaml + mysql: + type: mysql + disk: 2048 + +Configure database access +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Platform.sh overrides your database specific configuration via importing the +following file: + +.. code-block:: yaml + + # app/config/parameters_platform.php + setParameter('database_driver', 'pdo_' . $endpoint['scheme']); + $container->setParameter('database_host', $endpoint['host']); + $container->setParameter('database_port', $endpoint['port']); + $container->setParameter('database_name', $endpoint['path']); + $container->setParameter('database_user', $endpoint['username']); + $container->setParameter('database_password', $endpoint['password']); + $container->setParameter('database_path', ''); + } + + # Hack. + ini_set('session.save_path', '/tmp/sessions'); + +Make sure this file is listed in your *imports*: + +.. code-block:: yaml + + # app/config/config.yml + imports: + - { resource: parameters_platform.php } + +Deploy your Application +~~~~~~~~~~~~~~~~~~~~~~~ + +Now you need to add a remote to Platform.sh in your Git repository (copy the +command that you see on the Platform.sh web UI): + +.. code-block:: bash + + $ git remote add platform kjh43kbobssae@git.eu.platform.sh:kjh43kbobssae.git + +Commit the Platform.sh specific files created in the previous section: + +.. code-block:: bash + + $ git add .platform.app.yaml .platform/* + $ git add app/config/config.yml app/config/parameters_platform.php + $ git commit -m "Adding Platform.sh configuration files." + +Push your code base to the newly added remote: + +.. code-block:: bash + + $ git push -u platform master + + Counting objects: 27, done. + Delta compression using up to 4 threads. + Compressing objects: 100% (11/11), done. + Writing objects: 100% (16/16), 2.47 KiB | 0 bytes/s, done. + Total 16 (delta 7), reused 12 (delta 5) + + Processing activity environment.push + Found 213 new commits. + + Building application 'php' with toolstack 'php:symfony' (tree: 2248cf8) + Found a `composer.json`, installing dependencies. + ... + +That's it! Your application is being deployed on Platform.sh and you'll soon be +able to access it in your browser. + +Deploy a new site +----------------- + +You can start a new `Platform.sh project`_. Choose the development plan and go +through the checkout process. + +Once your project is ready, give it a name and choose: **Create a new site**. +Choose the *Symfony* stack and a starting point such as *Standard*. + +That's it! Your Symfony application will be bootstaped and deployed. You'll soon +be able to see it in your browser. + +.. _`Platform.sh`: https://platform.sh +.. _`Platform.sh documentation`: https://docs.platform.sh/toolstacks/symfony/symfony-getting-started/ +.. _`Platform.sh project`: https://marketplace.commerceguys.com/platform/buy-now +.. _`Platform.sh configuration files`: https://docs.platform.sh/reference/configuration-files/ \ No newline at end of file From feb2d3bc1efab74609ee4d2b74ecd492fade5795 Mon Sep 17 00:00:00 2001 From: Augustin Delaporte Date: Fri, 28 Nov 2014 12:27:31 +0100 Subject: [PATCH 02/11] Fix typo and add Github link. --- cookbook/deployment/platformsh.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst index 2137cff4249..be267f980e9 100644 --- a/cookbook/deployment/platformsh.rst +++ b/cookbook/deployment/platformsh.rst @@ -4,8 +4,8 @@ Deploying to Platform.sh ======================== -This step by step cookbook describes how to deploy a Symfony web application to -`Platform.sh`_ . You can read more about using Symfony with Platform.sh on the +This step-by-step cookbook describes how to deploy a Symfony web application to +`Platform.sh`_. You can read more about using Symfony with Platform.sh on the official `Platform.sh documentation`_. Deploy an existing site @@ -95,6 +95,8 @@ your Git repository which contains the following files: type: mysql disk: 2048 +An example of these configurations can be found on `Github`_. + Configure database access ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -186,10 +188,11 @@ through the checkout process. Once your project is ready, give it a name and choose: **Create a new site**. Choose the *Symfony* stack and a starting point such as *Standard*. -That's it! Your Symfony application will be bootstaped and deployed. You'll soon +That's it! Your Symfony application will be bootstrapped and deployed. You'll soon be able to see it in your browser. .. _`Platform.sh`: https://platform.sh -.. _`Platform.sh documentation`: https://docs.platform.sh/toolstacks/symfony/symfony-getting-started/ +.. _`Platform.sh documentation`: https://docs.platform.sh/toolstacks/symfony/symfony-getting-started .. _`Platform.sh project`: https://marketplace.commerceguys.com/platform/buy-now -.. _`Platform.sh configuration files`: https://docs.platform.sh/reference/configuration-files/ \ No newline at end of file +.. _`Platform.sh configuration files`: https://docs.platform.sh/reference/configuration-files +.. _`Github`: https://github.com/platformsh/platformsh-examples From e74458aac9d90e7f330a14eb36fdcc2f11829b1d Mon Sep 17 00:00:00 2001 From: Augustin Delaporte Date: Fri, 28 Nov 2014 14:00:41 +0100 Subject: [PATCH 03/11] Github => GitHub --- cookbook/deployment/platformsh.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst index be267f980e9..bed3272644c 100644 --- a/cookbook/deployment/platformsh.rst +++ b/cookbook/deployment/platformsh.rst @@ -95,7 +95,7 @@ your Git repository which contains the following files: type: mysql disk: 2048 -An example of these configurations can be found on `Github`_. +An example of these configurations can be found on `GitHub`_. Configure database access ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -195,4 +195,4 @@ be able to see it in your browser. .. _`Platform.sh documentation`: https://docs.platform.sh/toolstacks/symfony/symfony-getting-started .. _`Platform.sh project`: https://marketplace.commerceguys.com/platform/buy-now .. _`Platform.sh configuration files`: https://docs.platform.sh/reference/configuration-files -.. _`Github`: https://github.com/platformsh/platformsh-examples +.. _`GitHub`: https://github.com/platformsh/platformsh-examples From 5fd22545908a96c4c4283ceb82e721a62bfb32ff Mon Sep 17 00:00:00 2001 From: Augustin Delaporte Date: Sat, 29 Nov 2014 13:22:51 +0100 Subject: [PATCH 04/11] Better match Symfony documentation standard. Based on feedbacks from @xabbuh and @timglabisch. --- cookbook/deployment/platformsh.rst | 36 +++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst index bed3272644c..ceafae5cd26 100644 --- a/cookbook/deployment/platformsh.rst +++ b/cookbook/deployment/platformsh.rst @@ -8,21 +8,19 @@ This step-by-step cookbook describes how to deploy a Symfony web application to `Platform.sh`_. You can read more about using Symfony with Platform.sh on the official `Platform.sh documentation`_. -Deploy an existing site +Deploy an Existing Site ----------------------- -In this guide, we assume your codebase is already versioned with Git. +In this guide, it is assumed your codebase is already versioned with Git. -Get a project on Platform.sh +Get a Project on Platform.sh ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You need to subscribe to a `Platform.sh project`_. Choose the development plan -and go through the checkout process. +and go through the checkout process. Once your project is ready, give it a name +and choose: **Import an existing site**. -Once your project is ready, give it a name and choose: **Import an existing -site**. - -Prepare your Application +Prepare Your Application ~~~~~~~~~~~~~~~~~~~~~~~~ To deploy your Symfony application on Platform.sh, you simply need to add a @@ -32,6 +30,7 @@ configuration files`_). .. code-block:: yaml + # .platform.app.yaml # This file describes an application. You can have multiple applications # in the same project. @@ -71,13 +70,6 @@ configuration files`_). deploy: | app/console --env=prod cache:clear - # The configuration of scheduled execution. - # see http://symfony.com/doc/current/components/console/introduction.html - #crons: - # symfony: - # spec: "*/20 * * * *" - # cmd: "php cron.php example:test" - For best practices, you should also add a ``.platform`` folder at the root of your Git repository which contains the following files: @@ -97,13 +89,13 @@ your Git repository which contains the following files: An example of these configurations can be found on `GitHub`_. -Configure database access +Configure Database Access ~~~~~~~~~~~~~~~~~~~~~~~~~ Platform.sh overrides your database specific configuration via importing the following file: -.. code-block:: yaml +.. code-block:: php # app/config/parameters_platform.php setParameter('database_path', ''); } - # Hack. + # Store session into /tmp. ini_set('session.save_path', '/tmp/sessions'); Make sure this file is listed in your *imports*: @@ -147,7 +139,11 @@ command that you see on the Platform.sh web UI): .. code-block:: bash - $ git remote add platform kjh43kbobssae@git.eu.platform.sh:kjh43kbobssae.git + $ git remote add platform [PROJECT-ID]@git.[CLUSTER].platform.sh:[PROJECT].git + + +* PROJECT-ID: Unique identifier of your project. Something like: *kjh43kbobssae*. +* CLUSTER: Server location where your project is deployed. It can be *eu* or *us*. Commit the Platform.sh specific files created in the previous section: @@ -179,7 +175,7 @@ Push your code base to the newly added remote: That's it! Your application is being deployed on Platform.sh and you'll soon be able to access it in your browser. -Deploy a new site +Deploy a new Site ----------------- You can start a new `Platform.sh project`_. Choose the development plan and go From a3716d900be957d7975077c67f551a96728131e1 Mon Sep 17 00:00:00 2001 From: Augustin Delaporte Date: Sat, 29 Nov 2014 14:01:43 +0100 Subject: [PATCH 05/11] Reference available services --- cookbook/deployment/platformsh.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst index ceafae5cd26..b9439dc89fa 100644 --- a/cookbook/deployment/platformsh.rst +++ b/cookbook/deployment/platformsh.rst @@ -87,7 +87,8 @@ your Git repository which contains the following files: type: mysql disk: 2048 -An example of these configurations can be found on `GitHub`_. +An example of these configurations can be found on `GitHub`_. The list of +available services can be found `here`_. Configure Database Access ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -192,3 +193,4 @@ be able to see it in your browser. .. _`Platform.sh project`: https://marketplace.commerceguys.com/platform/buy-now .. _`Platform.sh configuration files`: https://docs.platform.sh/reference/configuration-files .. _`GitHub`: https://github.com/platformsh/platformsh-examples +.. _`here`: https://docs.platform.sh/reference/configuration-files/#configure-services From 5e20a5ea7756220fcf888c7a4d5fb82d4308cf2b Mon Sep 17 00:00:00 2001 From: GuGuss Date: Sat, 29 Nov 2014 14:27:06 +0100 Subject: [PATCH 06/11] Add some references. --- cookbook/deployment/platformsh.rst | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst index b9439dc89fa..a9d87758370 100644 --- a/cookbook/deployment/platformsh.rst +++ b/cookbook/deployment/platformsh.rst @@ -88,7 +88,7 @@ your Git repository which contains the following files: disk: 2048 An example of these configurations can be found on `GitHub`_. The list of -available services can be found `here`_. +available services can be found on the `Platform.sh documentation `_. Configure Database Access ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -176,6 +176,12 @@ Push your code base to the newly added remote: That's it! Your application is being deployed on Platform.sh and you'll soon be able to access it in your browser. +Every code change that you do from now on will be pushed to Git in order to +redeploy your environment on Platform.sh. + +More information about migrating your database and files can be found on the +`Platform.sh documentation `_ + Deploy a new Site ----------------- @@ -185,12 +191,13 @@ through the checkout process. Once your project is ready, give it a name and choose: **Create a new site**. Choose the *Symfony* stack and a starting point such as *Standard*. -That's it! Your Symfony application will be bootstrapped and deployed. You'll soon -be able to see it in your browser. +That's it! Your Symfony application will be bootstrapped and deployed. You'll +soon be able to see it in your browser. .. _`Platform.sh`: https://platform.sh .. _`Platform.sh documentation`: https://docs.platform.sh/toolstacks/symfony/symfony-getting-started .. _`Platform.sh project`: https://marketplace.commerceguys.com/platform/buy-now .. _`Platform.sh configuration files`: https://docs.platform.sh/reference/configuration-files .. _`GitHub`: https://github.com/platformsh/platformsh-examples -.. _`here`: https://docs.platform.sh/reference/configuration-files/#configure-services +.. _`configure-services`: https://docs.platform.sh/reference/configuration-files/#configure-services +.. _`migrate-existing-site`: https://docs.platform.sh/toolstacks/symfony/migrate-existing-site/ From 498517d85f3cee3ea7300b3e24ad6ac4adfd33d6 Mon Sep 17 00:00:00 2001 From: Augustin Delaporte Date: Wed, 3 Dec 2014 12:08:22 +0100 Subject: [PATCH 07/11] Fix duplicated references. This should make the Travis build pass. --- cookbook/deployment/platformsh.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst index a9d87758370..505b3669126 100644 --- a/cookbook/deployment/platformsh.rst +++ b/cookbook/deployment/platformsh.rst @@ -88,7 +88,7 @@ your Git repository which contains the following files: disk: 2048 An example of these configurations can be found on `GitHub`_. The list of -available services can be found on the `Platform.sh documentation `_. +`available services `_ can be found on the Platform.sh documentation. Configure Database Access ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -179,8 +179,8 @@ able to access it in your browser. Every code change that you do from now on will be pushed to Git in order to redeploy your environment on Platform.sh. -More information about migrating your database and files can be found on the -`Platform.sh documentation `_ +More information about `migrating your database and files `_ can be found on the +Platform.sh documentation. Deploy a new Site ----------------- From 1e715d9f072d06157a5688669680805792ab8db8 Mon Sep 17 00:00:00 2001 From: Augustin Delaporte Date: Mon, 8 Dec 2014 15:29:33 +0100 Subject: [PATCH 08/11] Use alphabetical order. --- cookbook/deployment/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/deployment/index.rst b/cookbook/deployment/index.rst index 7c6d2c674be..2b1a962fb54 100644 --- a/cookbook/deployment/index.rst +++ b/cookbook/deployment/index.rst @@ -5,6 +5,6 @@ Deployment :maxdepth: 2 tools - platformsh azure-website heroku + platformsh From 6693e78595687181956e1fbaa01aade75658694d Mon Sep 17 00:00:00 2001 From: Augustin Delaporte Date: Mon, 8 Dec 2014 15:43:13 +0100 Subject: [PATCH 09/11] Fix coding standards #2 Thanks @WouterJ and @stof --- cookbook/deployment/platformsh.rst | 61 ++++++++++++------------------ 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst index 505b3669126..836a4ed38d3 100644 --- a/cookbook/deployment/platformsh.rst +++ b/cookbook/deployment/platformsh.rst @@ -25,17 +25,18 @@ Prepare Your Application To deploy your Symfony application on Platform.sh, you simply need to add a ``.platform.app.yaml`` at the root of your Git repository which will tell -Platform.sh how to deploy your application (read more about `Platform.sh -configuration files`_). +Platform.sh how to deploy your application (read more about +`Platform.sh configuration files`_). .. code-block:: yaml # .platform.app.yaml + # This file describes an application. You can have multiple applications # in the same project. # The name of this app. Must be unique within a project. - name: php + name: myphpproject # The toolstack used to build the application. toolstack: "php:symfony" @@ -98,27 +99,27 @@ following file: .. code-block:: php - # app/config/parameters_platform.php + // app/config/parameters_platform.php setParameter('database_driver', 'pdo_' . $endpoint['scheme']); - $container->setParameter('database_host', $endpoint['host']); - $container->setParameter('database_port', $endpoint['port']); - $container->setParameter('database_name', $endpoint['path']); - $container->setParameter('database_user', $endpoint['username']); - $container->setParameter('database_password', $endpoint['password']); - $container->setParameter('database_path', ''); + if (empty($endpoint['query']['is_master'])) { + continue; + } + + $container->setParameter('database_driver', 'pdo_' . $endpoint['scheme']); + $container->setParameter('database_host', $endpoint['host']); + $container->setParameter('database_port', $endpoint['port']); + $container->setParameter('database_name', $endpoint['path']); + $container->setParameter('database_user', $endpoint['username']); + $container->setParameter('database_password', $endpoint['password']); + $container->setParameter('database_path', ''); } # Store session into /tmp. @@ -140,11 +141,12 @@ command that you see on the Platform.sh web UI): .. code-block:: bash - $ git remote add platform [PROJECT-ID]@git.[CLUSTER].platform.sh:[PROJECT].git - + $ git remote add platform [PROJECT-ID]@git.[CLUSTER].platform.sh:[PROJECT-ID].git -* PROJECT-ID: Unique identifier of your project. Something like: *kjh43kbobssae*. -* CLUSTER: Server location where your project is deployed. It can be *eu* or *us*. +``PROJECT-ID`` + Unique identifier of your project. Something like ``kjh43kbobssae`` +``CLUSTER`` + Server location where your project is deplyed. It can be ``eu`` or ``us`` Commit the Platform.sh specific files created in the previous section: @@ -158,20 +160,7 @@ Push your code base to the newly added remote: .. code-block:: bash - $ git push -u platform master - - Counting objects: 27, done. - Delta compression using up to 4 threads. - Compressing objects: 100% (11/11), done. - Writing objects: 100% (16/16), 2.47 KiB | 0 bytes/s, done. - Total 16 (delta 7), reused 12 (delta 5) - - Processing activity environment.push - Found 213 new commits. - - Building application 'php' with toolstack 'php:symfony' (tree: 2248cf8) - Found a `composer.json`, installing dependencies. - ... + $ git push platform master That's it! Your application is being deployed on Platform.sh and you'll soon be able to access it in your browser. From 4e2e14ac2aca188cc90fbdde134de3d05b50f433 Mon Sep 17 00:00:00 2001 From: Augustin Delaporte Date: Tue, 9 Dec 2014 10:58:37 +0100 Subject: [PATCH 10/11] Coding standard for PHP block. --- cookbook/deployment/platformsh.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cookbook/deployment/platformsh.rst b/cookbook/deployment/platformsh.rst index 836a4ed38d3..a8c086f3ecd 100644 --- a/cookbook/deployment/platformsh.rst +++ b/cookbook/deployment/platformsh.rst @@ -95,9 +95,7 @@ Configure Database Access ~~~~~~~~~~~~~~~~~~~~~~~~~ Platform.sh overrides your database specific configuration via importing the -following file: - -.. code-block:: php +following file:: // app/config/parameters_platform.php Date: Wed, 24 Dec 2014 10:36:08 +0100 Subject: [PATCH 11/11] Update map.rst.inc --- cookbook/map.rst.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 24a0cd78371..bc265cff3fc 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -55,6 +55,7 @@ * :doc:`/cookbook/deployment/tools` * :doc:`/cookbook/deployment/azure-website` * :doc:`/cookbook/deployment/heroku` + * :doc:`/cookbook/deployment/platformsh` * :doc:`/cookbook/doctrine/index` pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy