|
1 | 1 | .. include:: /Includes.rst.txt |
2 | | - |
3 | 2 | .. index:: deployment, composer, production setup |
4 | 3 |
|
5 | 4 | .. _deploytypo3: |
| 5 | +.. _deployment: |
6 | 6 |
|
7 | 7 | =============== |
8 | 8 | Deploying TYPO3 |
9 | 9 | =============== |
10 | 10 |
|
11 | | -This guide outlines the steps required to manually deploy TYPO3 and ensure the installation |
12 | | -is secure and ready to be used in a production context. This guide also highlights a number of |
13 | | -automation tools that can help automate the deployment process. |
| 11 | +.. _deployment-git-composer: |
| 12 | + |
| 13 | +Using Git and Composer on the webserver |
| 14 | +======================================= |
| 15 | + |
| 16 | +* Check if Composer is available on the production server. If it is not |
| 17 | + available consider to use the |
| 18 | + `latest composer.phar <https://getcomposer.org/download/>`__. |
| 19 | +* Keep all development related files in a Git repository. |
| 20 | +* Clone this repository on your production server. |
| 21 | +* Copy the database to the production server. |
| 22 | +* Install TYPO3 without dev dependencies on the production server: |
| 23 | + |
| 24 | + .. code-block:: |
| 25 | +
|
| 26 | + composer install --no-dev |
| 27 | +
|
| 28 | +* Compare the database |
| 29 | +* Fix file permissions |
| 30 | +* Clear caches |
| 31 | + |
| 32 | +.. todo: Link these steps once documented |
14 | 33 |
|
15 | | -There are several different ways to deploy TYPO3. One of the more simple |
16 | | -options is to manually copy its files and database |
17 | | -from a local machine to the live server, adjusting the configuration where |
18 | | -necessary. |
| 34 | +If you do a `composer install` directly on the production server you might |
| 35 | +experience some problems. For this reason some developers and administrators |
| 36 | +decide not to do it: |
19 | 37 |
|
20 | | -General Deployment Steps |
21 | | -======================== |
| 38 | +* There can be several minutes of downtime even if the installation goes |
| 39 | + smoothly. |
| 40 | +* The installation might fail if some packages are not available. |
| 41 | +* You might accidentally call `composer update` as is often done during |
| 42 | + development and do unintended, untested updates. |
| 43 | +* You might omit the `--no-dev` option and accidentally install packages |
| 44 | + that are not save to be used during production. |
| 45 | + |
| 46 | +Some of these problems can be fixed by using a symlink strategy where one |
| 47 | +directory is running on production and another one is being updated. |
| 48 | + |
| 49 | +.. _deployment-copy-files: |
| 50 | + |
| 51 | +Build locally and copy all files and symlinks to the server |
| 52 | +=========================================================== |
22 | 53 |
|
23 | 54 | * Build the local environment (installing everything necessary for the website) |
24 | 55 | * Run :bash:`composer install --no-dev` to install without development dependencies |
25 | 56 | * Copy files to the production server |
26 | 57 | * Copy the database to the production server |
27 | | -* Clearing the caches |
| 58 | +* Compare the database |
| 59 | +* Fix file permissions |
| 60 | +* Clear caches |
| 61 | + |
| 62 | +.. todo: Link these steps once documented |
| 63 | +
|
| 64 | +There can be several problems with this strategy: |
| 65 | + |
| 66 | +* Copying files or unzipping files can be slow, there can be several minutes |
| 67 | + of downtime. |
| 68 | +* A TYPO3 installation depends on symlinks. Make sure these symlinks are |
| 69 | + preserved during copying and or compressing files. |
28 | 70 |
|
29 | | -.. note:: |
| 71 | +.. _deployment-automatic: |
30 | 72 |
|
31 | | - The :bash:`composer install` command should not be run on the live environment. |
32 | | - Ideally, Composer should only run locally or on a dedicated deployment machine, |
33 | | - to allow testing before going live. |
| 73 | +Automatic deployment |
| 74 | +==================== |
34 | 75 |
|
35 | | - To avoid conflicts between the local and the server's PHP version, |
36 | | - the server's PHP version can be defined in the :file:`composer.json` file |
37 | | - (e.g. ``{"platform": {"php": "8.2"}}``), so Composer will always check |
38 | | - the correct dependencies. |
| 76 | +There are multiple tools that can be used to automate deployment. Read more |
| 77 | +about it: :ref:`TYPO3 Explained, automatic deployment <t3coreapi:deployment-automatic>`. |
39 | 78 |
|
40 | 79 | Deployment Automation |
41 | 80 | ===================== |
|
0 commit comments