[Docs] Refresh "Installation" section of the book

This commit is contained in:
Kamil Kokot 2019-03-11 16:56:24 +01:00
parent 20a6da6526
commit 689a12dc06
No known key found for this signature in database
GPG key ID: 7BD76F7054D93C89
3 changed files with 48 additions and 98 deletions

View file

@ -7,15 +7,8 @@ Installation
The Sylius main application can serve as an end-user app, as well as a foundation The Sylius main application can serve as an end-user app, as well as a foundation
for your custom e-commerce application. for your custom e-commerce application.
.. warning:: To create your Sylius-based application, first make sure you use PHP 7.2 or higher
and have `Composer`_ installed.
This article assumes you're familiar with `Composer`_, a dependency manager
for PHP. It also assumes you have `Composer installed globally`_.
.. note::
If you downloaded the Composer phar archive, you should use
``php composer.phar`` where this guide uses ``composer``.
.. note:: .. note::
@ -29,7 +22,7 @@ for your custom e-commerce application.
Initiating A New Sylius Project Initiating A New Sylius Project
------------------------------- -------------------------------
To create a new project using Sylius Standard Edition, run this command: Create your new project by running:
.. code-block:: bash .. code-block:: bash
@ -39,22 +32,26 @@ To create a new project using Sylius Standard Edition, run this command:
Make sure to use PHP ^7.2. Using an older PHP version will result in installing an older version of Sylius. Make sure to use PHP ^7.2. Using an older PHP version will result in installing an older version of Sylius.
This will create a new Symfony project in ``acme`` directory. When all the dependencies are installed, This will create a new Symfony project in the ``acme`` directory. Move to the project directory next:
you should create `.env` file basing on provides `.env.dist` files. The most important parameter that need to be set,
is `DATABASE_URL`.
.. code-block:: text
DATABASE_URL=mysql://username:password@host/database_name_%kernel.environment%
After everything is in place, run the following commands:
.. code-block:: bash .. code-block:: bash
$ cd acme # Move to the newly created directory $ cd acme
$ php bin/console sylius:install
This package has the whole ``sylius/sylius`` package in vendors, so you can easily update it and focus on your custom development. Sylius uses enviornment variables to configurethe connection with database and mailer services.
You can look up the default values in ``.env`` file and customise them by creating ``.env.local`` with variables you want to override.
For example, if you want to change your database name from the default ``sylius_%kernel.environment`` to ``my_custom_sylius_database``,
the contents of that new file should look like the following snippet:
.. code-block:: text
DATABASE_URL=mysql://username:password@host/my_custom_sylius_database
After everything is in place, run the following command to install Sylius:
.. code-block:: bash
$ bin/console sylius:install
.. warning:: .. warning::
@ -68,19 +65,15 @@ Installing assets
In order to see a fully functional frontend you will need to install its assets. In order to see a fully functional frontend you will need to install its assets.
**Sylius** already has a ``gulpfile.babel.js``, therefore you just need to get `Gulp`_ using `Yarn`_. **Sylius** uses `Gulp`_ to build fronted assets using `Yarn`_ as a JavaScript package manager.
.. note:: Having Yarn installed, go to your project directory to install the dependencies:
We recommend using stable versions (`^1.0.0`) of `Yarn`_.
Having Yarn installed go to your project directory and run:
.. code-block:: bash .. code-block:: bash
$ yarn install $ yarn install
And now you can use gulp for installing views, by just running a simple command: Then build the frontend assets by running:
.. code-block:: bash .. code-block:: bash
@ -89,29 +82,16 @@ And now you can use gulp for installing views, by just running a simple command:
Accessing the Shop Accessing the Shop
------------------ ------------------
.. tip:: We strongly recommend using the Symfony built-in web server by running the ``php bin/console server:start``
command and then accessing ``http://127.0.0.1:8000`` in your web browser to see the shop.
We strongly recommend using the Symfony built-in web server by running the
``php bin/console server:start``
command and then accessing ``http://127.0.0.1:8000`` in your web browser to see the shop.
.. note:: .. note::
The localhost's 8000 port may be already occupied by some other process. The localhost's 8000 port may be already occupied by some other process.
If so you should try other ports, like for instance: If that happens, please try using a different port - ``php bin/console server:start 127.0.0.1:8081``.
``php bin/console server:start 127.0.0.1:8081``
Want to know more about using a built-in server, see `here <http://symfony.com/doc/current/cookbook/web_server/built_in.html>`_. Want to know more about using a built-in server, see `here <http://symfony.com/doc/current/cookbook/web_server/built_in.html>`_.
You can log in as an administrator, with the credentials you have provided during the installation process. You can log to the administrator panel located at ``/admin`` with the credentials you have provided during the installation process.
Since now you can play with your clean Sylius installation.
Accessing the Administration Panel
----------------------------------
.. note::
Have a look at the ``/admin`` url, where you will find the administration panel.
Remember that you have to be logged in as an administrator using the credentials provided while installing Sylius.
How to start developing? - Project Structure How to start developing? - Project Structure
-------------------------------------------- --------------------------------------------
@ -134,11 +114,8 @@ In the root directory of your project you will find these important subdirectori
Contributing Contributing
------------ ------------
.. tip:: If you would like to contribute to Sylius - please go to the :doc:`Contribution Guide </contributing/index>`
If you would like to contribute to Sylius - please go to the :doc:`Contribution Guide </contributing/index>`
.. _Gulp: http://gulpjs.com/ .. _Gulp: http://gulpjs.com/
.. _Yarn: https://yarnpkg.com/lang/en/ .. _Yarn: https://yarnpkg.com/lang/en/
.. _Composer: http://packagist.org .. _Composer: http://packagist.org
.. _`Composer installed globally`: http://getcomposer.org/doc/00-intro.md#globally

View file

@ -29,7 +29,7 @@ PHP required modules and configuration
**PHP version**: **PHP version**:
+---------------+-----------------------+ +---------------+-----------------------+
| PHP | ^7.1 | | PHP | ^7.2 |
+---------------+-----------------------+ +---------------+-----------------------+
**PHP extensions**: **PHP extensions**:
@ -62,21 +62,21 @@ Database
By default, the database connection is pre-configured to work with a following MySQL configuration: By default, the database connection is pre-configured to work with a following MySQL configuration:
+---------------+-----------------------+ +---------------+-----------------------+
| MySQL | 5.x | | MySQL | 5.7+, 8.0+ |
+---------------+-----------------------+ +---------------+-----------------------+
.. note:: .. note::
Of course you may use any other RDBMS for instance PostgreSQL. You might also use any other RDBMS (like PostgreSQL), but our database mirations support MySQL only.
Access rights Access rights
------------- -------------
Most of the application folders and files require only read access, but a few folders need also the write access for the Apache/Nginx user: Most of the application folders and files require only read access, but a few folders need also the write access for the Apache/Nginx user:
* var/cache * ``var/cache``
* var/log * ``var/log``
* public/media * ``public/media``
You can read how to set these permissions in the `Symfony - setting up permissions <http://symfony.com/doc/current/setup/file_permissions.html>`_ section. You can read how to set these permissions in the `Symfony - setting up permissions <http://symfony.com/doc/current/setup/file_permissions.html>`_ section.

View file

@ -4,53 +4,26 @@
Upgrading Upgrading
========= =========
Sylius is releasing new versions from time to time. Each release is supported with an `UPGRADE <https://github.com/Sylius/Sylius/blob/1.0/UPGRADE-1.0.md>`_ file, which is meant to help in the upgrading process, Sylius regularly releases new versions according to our :doc:`release process </contributing/organization/release-process>`.
especially for the major versions, which can break the backwards compatibility. Each minor release comes with an ``UPGRADE.md`` file, which is meant to help in the upgrading process.
**Update the Sylius library version constraint by modifying the** ``composer.json`` **file:** 1. **Update the Sylius library version constraint by modifying the ``composer.json`` file:**
.. code-block:: yaml .. code-block:: yaml
{ {
... "require": {
"sylius/sylius": "^1.4"
}
}
"require": { 2. **Upgrade dependencies by running a Composer command:**
"...": "...",
"sylius/sylius": "^1.0@beta", .. code-block:: bash
"...": "...", $ composer update sylius/sylius --with-all-dependencies
},
... If this does not help, it is a matter of debugging the conflicting versions and working out how your ``composer.json`` should look after the upgrade.
} You can check what version of Sylius is installed by running ``composer show sylius/sylius`` command.
**Then run** ``composer update`` **command:** 3. **Follow the instructions found in the ``UPGRADE.md`` file for a given minor release.**
.. code-block:: bash
$ composer update sylius/sylius
If this results in a dependency error, it may mean that other Sylius dependencies also have to be upgraded.
Using this command may help you upgrade Sylius dependencies.
.. code-block:: bash
$ composer update sylius/sylius --with-dependencies
If this does not help, it is a matter of debugging the conflicting versions and working out how your ``composer.json`` should look after the upgrade.
**Finally to make everything work check the UPGRADE file of Sylius for instructions.**
**One more important thing is running the database migrations:**
.. code-block:: bash
$ bin/console doctrine:migrations:migrate
.. tip::
Check if the migrations (more than 1) are in your ``app/migrations`` directory. If not, then replace the contents
of this directory with the migrations from the ``vendor/sylius/sylius/app/migrations/`` directory.
After fixing the project according to the upgrade and having run the migrations you are done!