Jun 2, 2008

Installing TYPO3 with upgrades in mind

TYPO3 releases a new version every year or year and half. The system is not the smallest one and upgrading it may not the easiest task. In this article I want to show how to install TYPO3 with upgrades in mind.

Logically TYPO3 installation consists from two big parts: the core and site-specific files. The core is released by TYPO3 core team and it is not changing. Site-specific files is what web site owner creates in order to have a running web site under TYPO3 control. Inside the file system these parts should be seen as a single set of files.

The core is distributed as a compressed archive by TYPO3 core team. When new version is released, this part should be upgraded. However simply extracting files over existing installation is not the way to upgrade. Sometimes TYPO3 files change, so file can be removed, new files can appear. Extracting files to the existing location is not a good way to keep stable TYPO3 installation.

Ideally core files should stay as a package, separate from the site-specific files. Than core can be easily replaced independently from the rest of the site. But how to make the core separate and still keep the proper site structure?Here is when symbolic links come to help. Assuming SuSE Linux, we can extract typo3_src‑4.2.0.tar.gz to the /srv/www:

/srv/www $ tar xzf typo3_src‑4.2.0.tar.gz

This creates typo3_src‑4.2.0 directory. Now we create a symbolic link to this directory. The link will be named named typo3_src:

/srv/www $ ln -s typo3_src-4.2.0 typo3_src

When creating directory structure for the web site we should use index.php, t3lib/ and typo3/ from the typo3_src symbolic link. Later, if we decide to upgrade, we extract newer version into another directory and change a symlink. All directories get new TYPO3 core automatically!

But we could go even further! It makes sense to have another symlink inside web site's directory. By default it can be linked to the first symlink to share core files. If one specific site is not to be updated, this link can be easily set to the proper core directly. Easy and flexible!

Now let's see how we do it. Assuming that new web site is in web01/ directory:

/srv/www/ $ cd web01
/srv/www/web01/ $ ln -s ../typo3_src
/srv/www/web01/ $ ln -s typo3_src/t3lib
/srv/www/web01/ $ ln -s typo3_src/typo3
/srv/www/web01/ $ ln -s typo3_src/index.php

This is all we need to do to have an easily upgradable TYPO3 core. In the next article about upgrade we will talk how to actually perform a TYPO3 upgrade.

No comments:

Post a Comment