Skip to content

Commit

Permalink
[Docs] Pltform.sh cookbook refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderMaggie committed Dec 13, 2019
1 parent d657d40 commit 743a3b2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 36 deletions.
47 changes: 26 additions & 21 deletions docs/cookbook/deployment/platform-sh.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

How to deploy Sylius to Platform.sh?
====================================

Expand All @@ -13,28 +12,28 @@ In this guide you will find sufficient instructions to have your application up
1. Prepare a Platform.sh project
--------------------------------

* Create an account on `Platform.sh <https://platform.sh/>`_
* Create an account on `Platform.sh <https://platform.sh/>`_.

* Create a new project, naming it **MyFirstShop** and selecting **Blank project** template
* Create a new project, name it (**MyFirstShop** for example) and select the **Blank project** template.

.. hint::

**Platform.sh** offers a trial month, which you can use for testing your store deployment. If you would be asked to provide
your credit card data nevertheless, use `this link <https://accounts.platform.sh/platform/trial/general/setup>`_ for a new
project creation.
**Platform.sh** offers a trial month, which you can use for testing your store deployment. If you would be asked to
provide your credit card data nevertheless, use `this link <https://accounts.platform.sh/platform/trial/general/setup>`_
to create your new project.

.. image:: /_images/getting-started-with-sylius/platform-sh-project.png
:scale: 55%
:align: center

|
* Install a Symfony-Platform.sh bridge in your application with ``composer require platformsh/symfonyflex-bridge``
* Install the Symfony-Platform.sh bridge in your application with ``composer require platformsh/symfonyflex-bridge``.

2. Make the application ready to deploy
---------------------------------------

* Create a file ``.platform/routes.yaml``, which describes how an incoming URL is going to be processed by the server
* Create the ``.platform/routes.yaml`` file, which describes how an incoming URL is going to be processed by the server.

.. code-block:: yaml
Expand All @@ -46,15 +45,15 @@ In this guide you will find sufficient instructions to have your application up
type: redirect
to: "https://{default}/"
* Create a file ``.platform/services.yaml``
* Create the ``.platform/services.yaml`` file.

.. code-block:: yaml
db:
type: mysql:10.2
disk: 2048
* Create a file ``.platform.app.yaml``, which is the main server application configuration file (and the longest one :))
* Create the ``.platform.app.yaml`` file, which is the main server application configuration file (and the longest one 😉).

.. code-block:: yaml
Expand Down Expand Up @@ -89,7 +88,7 @@ In this guide you will find sufficient instructions to have your application up
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
# side is in the form `<service name>:<endpoint name>`.
relationships:
# behind the scene this will be installed mariadb because platform.sh use it instead mysql
# NOTE: this will install mariadb because platform.sh uses it instead of mysql.
database: "db:mysql"
dependencies:
Expand Down Expand Up @@ -151,10 +150,13 @@ In this guide you will find sufficient instructions to have your application up
.. warning::

It is important to place newly created file after importing regular parameters.yml file. Otherwise your database connection will not work.
Also this will be the file where you should set your required parameters. Its value will be fetched from environmental variables.
It is important to place the newly created file after importing regular parameters.yml file. Otherwise your database
connection will not work. Also this will be the file where you should set your required parameters. Its value will
be fetched from environmental variables.

The application secret is used in several places in Sylius and Symfony. Platform.sh allows you to deploy an environment for each branch you have, and therefore it makes sense to have a secret automatically generated by the Platform.sh system. The last 3 lines in the sample above will use the Platform.sh-provided random value as the application secret.
The application secret is used in several places in Sylius and Symfony. Platform.sh allows you to deploy an environment
for each branch you have, and therefore it makes sense to have a secret automatically generated by the Platform.sh system.
The last 3 lines in the sample above will use the Platform.sh-provided random value as the application secret.

3. Add Platform.sh as a remote to your repository
-------------------------------------------------
Expand All @@ -171,10 +173,12 @@ and ``CLUSTER`` can be ``eu`` or ``us`` - depending on where are you deploying y
4. Commit the configuration
---------------------------

Use ``git add . && git commit -m "Platform.sh configuration"``
.. code-block:: bash
$ git add . && git commit -m "Platform.sh configuration"
5. Push your project to the platform remote
-------------------------------------------
5. Push your project to the Platform.sh remote repository
---------------------------------------------------------

.. code-block:: bash
Expand All @@ -185,7 +189,8 @@ The output of this command shows you on which URL your online store can be acces
6. Connect to the project via SSH and install Sylius
----------------------------------------------------

The SSH command can be found in your project data on Platform.sh. Alternatively use the `Platform CLI tool <https://docs.platform.sh/gettingstarted/cli.html>`_.
The SSH command can be found in your project data on Platform.sh. Alternatively use the
`Platform CLI tool <https://docs.platform.sh/gettingstarted/cli.html>`_.

When you get connected please run:

Expand All @@ -195,7 +200,7 @@ When you get connected please run:
.. warning::

By default platform.sh creates only one instance of a database with the `main` name.
By default platform.sh creates only one instance of the database with the ``main`` name.
Platform.sh works with the concept of an environment per branch if activated. The idea is to mimic production settings per each branch.

7. Dive deeper
Expand All @@ -219,8 +224,8 @@ Add the example below to your ``.platform.app.yaml`` file. This runs these cronj
Additional tips:
~~~~~~~~~~~~~~~~

* Platform.sh can serve gzipped versions of your static assets. Make sure to save your assets in the same folder, but with
a .gz suffix. The ``gulp-gzip`` node package comes very helpful integrating saving of .gz versions of your assets.
* Platform.sh can serve gzipped versions of your static assets. Make sure to save your assets in the same folder, but with a .gz suffix.
The ``gulp-gzip`` node package comes very helpful integrating saving of .gz versions of your assets.

* Platform.sh comes with a `New Relic integration <https://docs.platform.sh/administration/integrations/new-relic.html>`_.

Expand Down
19 changes: 4 additions & 15 deletions docs/getting-started-with-sylius/deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,10 @@ Deployment

Development usually takes most of the time in project implementation, but we should not forget about what's at the end of this process -
application deployment into the server. We believe, that it should be as easy and understandable as possible.
There are many servers which you can choose for your store deployment, but in this chapter, we will use `Platform.sh <https://platform.sh/>`_.
There are many servers which you can choose for your store deployment: in our documentation you will find an easy Platform.sh guide.

.. attention::
Check it out!

To deploy your application to the proposed server, you need to have a git repository configured.
.. tip::

Process
-------

For example there is configuration for Platform.sh : :doc:`Deployment platform.sh </cookbook/deployment/platform-sh>`

You have also a URL provided, which you can visit to see if your shop working well. Of course, it does not have your configuration
done locally, as well as your product... but you have an application deployed! Congratulations! You've just finished the first
stage of the first project with Sylius.

.. important::

Of course, using the **Platform.sh** is only an example. You can use any server you want or you're familiar with.
👉 :doc:`</cookbook/deployment/platform-sh>`

0 comments on commit 743a3b2

Please sign in to comment.