/docs/examples/setup-presta-shop.rst

https://github.com/cytopia/devilbox · ReStructuredText · 201 lines · 126 code · 75 blank · 0 comment · 0 complexity · 7fc8bb54e3fd0d35d079893f683e7a82 MD5 · raw file

  1. .. include:: /_includes/all.rst
  2. .. include:: /_includes/snippets/__ANNOUNCEMENTS__.rst
  3. .. _example_setup_presta_shop:
  4. ****************
  5. Setup PrestaShop
  6. ****************
  7. This example will use ``git`` and ``composer`` to install PrestaShop from within the Devilbox
  8. PHP container.
  9. .. important::
  10. Using ``composer`` requires the underlying file system to support symlinks. If you
  11. use **Docker Toolbox** you need to explicitly allow/enable this.
  12. See below for instructions:
  13. * Docker Toolbox and :ref:`howto_docker_toolbox_and_the_devilbox_windows_symlinks`
  14. After completing the below listed steps, you will have a working PrestaShop setup ready to be
  15. served via http and https.
  16. .. seealso:: |ext_lnk_example_presta_shop|
  17. **Table of Contents**
  18. .. contents:: :local:
  19. Overview
  20. ========
  21. The following configuration will be used:
  22. +--------------+--------------------------+-------------+------------+-------------------------------------------------+
  23. | Project name | VirtualHost directory | Database | TLD_SUFFIX | Project URL |
  24. +==============+==========================+=============+============+=================================================+
  25. | my-presta | /shared/httpd/my-presta | my_presta | loc | http://my-presta.loc |br| https://my-presta.loc |
  26. +--------------+--------------------------+-------------+------------+-------------------------------------------------+
  27. .. note::
  28. * Inside the Devilbox PHP container, projects are always in ``/shared/httpd/``.
  29. * On your host operating system, projects are by default in ``./data/www/`` inside the
  30. Devilbox git directory. This path can be changed via :ref:`env_httpd_datadir`.
  31. Walk through
  32. ============
  33. It will be ready in eight simple steps:
  34. 1. Enter the PHP container
  35. 2. Create a new VirtualHost directory
  36. 3. Install PrestaShop via ``git`` and ``composer``
  37. 4. Symlink webroot directory
  38. 5. Add MySQL database
  39. 6. Configure datbase connection
  40. 7. Setup DNS record
  41. 8. Visit http://my-presta.loc in your browser
  42. 1. Enter the PHP container
  43. --------------------------
  44. All work will be done inside the PHP container as it provides you with all required command line
  45. tools.
  46. Navigate to the Devilbox git directory and execute ``shell.sh`` (or ``shell.bat`` on Windows) to
  47. enter the running PHP container.
  48. .. code-block:: bash
  49. host> ./shell.sh
  50. .. seealso::
  51. * :ref:`enter_the_php_container`
  52. * :ref:`work_inside_the_php_container`
  53. * :ref:`available_tools`
  54. 2. Create new vhost directory
  55. -----------------------------
  56. The vhost directory defines the name under which your project will be available. |br|
  57. ( ``<vhost dir>.TLD_SUFFIX`` will be the final URL ).
  58. .. code-block:: bash
  59. devilbox@php-7.0.20 in /shared/httpd $ mkdir my-presta
  60. .. seealso:: :ref:`env_tld_suffix`
  61. 3. Install PrestaShop
  62. ---------------------
  63. Navigate into your newly created vhost directory and install PrestaShop with ``git`` and ``composer``.
  64. .. code-block:: bash
  65. devilbox@php-7.0.20 in /shared/httpd $ cd my-presta
  66. # Download PrestaShop with git
  67. devilbox@php-7.0.20 in /shared/httpd/my-presta $ git clone https://github.com/PrestaShop/PrestaShop
  68. # Checkout the latest stable git tag
  69. devilbox@php-7.0.20 in /shared/httpd/my-presta $ cd PrestaShop
  70. devilbox@php-7.0.20 in /shared/httpd/my-presta $ git checkout 1.7.4.2
  71. # Install dependencies with Composer
  72. devilbox@php-7.0.20 in /shared/httpd/my-presta $ composer install
  73. How does the directory structure look after installation:
  74. .. code-block:: bash
  75. devilbox@php-7.0.20 in /shared/httpd/my-presta $ tree -L 1
  76. .
  77. PrestaShop
  78. 1 directory, 0 files
  79. 4. Symlink webroot
  80. ------------------
  81. Symlinking the actual webroot directory to ``htdocs`` is important. The web server expects every
  82. project's document root to be in ``<vhost dir>/htdocs/``. This is the path where it will serve
  83. the files. This is also the path where your frameworks entrypoint (usually ``index.php``) should
  84. be found.
  85. Some frameworks however provide its actual content in nested directories of unknown levels.
  86. This would be impossible to figure out by the web server, so you manually have to symlink it back
  87. to its expected path.
  88. .. code-block:: bash
  89. devilbox@php-7.0.20 in /shared/httpd/my-presta $ ln -s PrestaShop/ htdocs
  90. How does the directory structure look after symlinking:
  91. .. code-block:: bash
  92. devilbox@php-7.0.20 in /shared/httpd/my-presta $ tree -L 1
  93. .
  94. PrestaShop
  95. htdocs -> PrestaShop
  96. 2 directories, 0 files
  97. As you can see from the above directory structure, ``htdocs`` is available in its expected
  98. path and points to the frameworks entrypoint.
  99. .. important::
  100. When using **Docker Toolbox**, you need to **explicitly allow** the usage of **symlinks**.
  101. See below for instructions:
  102. * Docker Toolbox and :ref:`howto_docker_toolbox_and_the_devilbox_windows_symlinks`
  103. 5. Add MySQL Database
  104. ---------------------
  105. .. code-block:: bash
  106. devilbox@php-7.0.20 in /shared/httpd/my-presta $ mysql -u root -h 127.0.0.1 -p -e 'CREATE DATABASE my_presta;'
  107. 6. DNS record
  108. -------------
  109. If you **have** Auto DNS configured already, you can skip this section, because DNS entries will
  110. be available automatically by the bundled DNS server.
  111. If you **don't have** Auto DNS configured, you will need to add the following line to your
  112. host operating systems ``/etc/hosts`` file (or ``C:\Windows\System32\drivers\etc`` on Windows):
  113. .. code-block:: bash
  114. :caption: /etc/hosts
  115. 127.0.0.1 my-presta.loc
  116. .. seealso::
  117. * :ref:`howto_add_project_hosts_entry_on_mac`
  118. * :ref:`howto_add_project_hosts_entry_on_win`
  119. * :ref:`setup_auto_dns`
  120. 7. Open your browser
  121. --------------------
  122. All set now, you can visit http://my-presta.loc or https://my-presta.loc in your browser and
  123. follow the installation steps.
  124. Next steps
  125. ==========
  126. .. include:: /_includes/snippets/examples/next-steps.rst