Skip to content

Commit 61e43dd

Browse files
committed
[TASK] Move automatic deployment to TYPO3 explained (#501)
Chapter needs more love in general: #498 Releases: main, 13.4, 12.4 (cherry picked from commit 4d7727d)
1 parent 4385c53 commit 61e43dd

File tree

7 files changed

+19
-299
lines changed

7 files changed

+19
-299
lines changed
Lines changed: 19 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,38 @@
11
.. include:: /Includes.rst.txt
2+
23
.. index:: deployment, composer, production setup
34

45
.. _deploytypo3:
5-
.. _deployment:
66

77
===============
88
Deploying TYPO3
99
===============
1010

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
33-
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:
37-
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.
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.
4814

49-
.. _deployment-copy-files:
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.
5019

51-
Build locally and copy all files and symlinks to the server
52-
===========================================================
20+
General Deployment Steps
21+
========================
5322

5423
* Build the local environment (installing everything necessary for the website)
5524
* Run :bash:`composer install --no-dev` to install without development dependencies
5625
* Copy files to the production server
5726
* Copy the database to the production server
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.
70-
71-
.. _deployment-automatic:
72-
73-
Automatic deployment
74-
====================
75-
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>`.
78-
79-
Deployment Automation
80-
=====================
81-
82-
A typical setup for deploying web applications consists of three different parts:
83-
84-
* The local environment (for development)
85-
* The build environment (for reproducible builds). This can be a controlled local environment or a remote continuous integration server (for example Gitlab CI or Github Actions)
86-
* The live (production) environment
87-
88-
To get an application from the local environment to the production system, the usage of a deployment tool and/or a continuous integration solution is recommended. This ensures that only version-controlled code is deployed and that builds are reproducible. Ideally setting a new release live will be an atomical operation and lead to no downtime. If there are errors in any of the deployment or test stages, most deployment tools will initiate an automatic "rollback" preventing that an erroneous build is released.
89-
90-
One widely employed strategy is the "symlink-switching" approach:
91-
92-
In that strategy, the webserver serves files from a virtual path :path:`releases/current/public` which consists of a symlink :path:`releases/current` pointing to the latest deployment ("release"). That symlink is switched after a new release has been successfully prepared.
93-
The latest deployment contains symlinks to folders that should be common among all releases (commonly called "shared folders").
94-
95-
Usually the database is shared between releases and upgrade wizards and schema upgrades are run automatically before or
96-
shortly after the new release has been set live.
97-
98-
This is an exemplatory directory structure of a "symlink-switching" TYPO3 installation:
99-
100-
.. directory-tree::
101-
102-
* :path:`shared`
103-
104-
* :path:`fileadmin`
105-
* :path:`var`
106-
107-
* :path:`charset`
108-
* :path:`lock`
109-
* :path:`log`
110-
* :path:`session`
111-
112-
* :path:`releases`
113-
114-
* :path:`current -> ./release1` (symlink to current release)
115-
* :path:`release1`
116-
117-
* :path:`public` (webserver root, via releases/current/public)
118-
119-
* :path:`typo3conf`
120-
* :path:`fileadmin -> ../../../shared/fileadmin` (symlink)
121-
* :file:`index.php`
122-
123-
* :path:`var`
124-
125-
* :path:`build`
126-
* :path:`cache`
127-
* :path:`charset -> ../../../shared/var/charset` (symlink)
128-
* :path:`labels`
129-
* :path:`lock -> ../../../shared/var/lock` (symlink)
130-
* :path:`log -> ../../../shared/var/log` (symlink)
131-
* :path:`session -> ../../../shared/var/session` (symlink)
132-
133-
* :path:`vendor`
134-
* :file:`composer.json`
135-
* :file:`composer.lock`
136-
137-
138-
The files in :path:`shared` are shared between different releases of a web site.
139-
The :path:`releases` directory contains the TYPO3 code that will change between the release of each version.
140-
141-
When using a deployment tool this kind of directory structure is usually created automatically.
27+
* Clearing the caches
14228

143-
The following section contains examples for various deployment tools and how they can be configured to use TYPO3:
29+
.. note::
14430

145-
.. toctree::
146-
:titlesonly:
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.
14734

148-
Deployer/Index
149-
Surf/Index
150-
Magallanes/Index
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.

Documentation/Installation/Deployer/Index.rst

Lines changed: 0 additions & 17 deletions
This file was deleted.

Documentation/Installation/Deployer/_deploy.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

Documentation/Installation/Magallanes/Index.rst

Lines changed: 0 additions & 16 deletions
This file was deleted.

Documentation/Installation/Magallanes/_mage.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

Documentation/Installation/Surf/Index.rst

Lines changed: 0 additions & 17 deletions
This file was deleted.

Documentation/Installation/Surf/_MyDeployment.php

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)