Ad

Automate Creation Of Composer Command For Upgrading TYPO3 To Next Major Version

- 1 answer

Currently in the process of upgrading a TYPO3 site with TYPO3 v9 Composer to next major release 10.4.

How do I automate the process - instead of manually putting together the composer command where I have to check each extension and find out which version I need to upgrade to, is there a way to do this automatically or assist in creating the composer require command with all system and third party extensions?

e.g. as result I would like to perform this (or the equivalent of this):

composer require typo3/cms-backend:10.4 typo3/cms-core:10.4  ...(all system extension) \
... helhum/typo3-console:^6.0.0 ... (3rdparty extensions with correct version constraint) \
--update-with-dependencies 
Ad

Answer

Automating the update is a good idea since it lowers the needed time for backend lock/content freeze for the relaunch.

My steps for the final relaunch are:

  • make sure no data gets changed: lock the backend, disable any frontend forms that would change data.
  • fetch/sync live data into your local test system
  • run update script
  • upload/sync updated data to some temporary place on the live system
  • temporarily disable live website
  • move data on the live system into the right places/import DB (you can even prepare that by using a different database and a symlink to your data)
  • re-enable website, remove backend lock

In order for that to work, you just need a script that allows you to repeat the update process locally (or as a CI pipeline) as often as you need to until you are satisfied with reproducible results.

I know there are some helper scripts/extensions around to facilitate that but I prefer to just put it together as shell scripts. Locally I will have the newest code and what we prepare now is a script that integrates new code with old data (with "data" I refer to DB & /fileadmin, /uploads).

So here are just some pointers:

  • If you use ddev, there will be a ddev pull command in the upcoming v1.17 that facilitates fetching live data. Until now, I used this custom command for ddev.
  • The commands in the vendor/bin/typo3 cleanup: namespace can make it less likely that you are dealing with an inconsistent database
  • Custom Upgrade Wizards are great for anything where you want to use TYPO3 API. - you can run them with vendor/bin/typo3cms upgrade:wizard
  • typo3-console gives you easy raw SQL access to the database (saves you from creating an upgrade wizard for trivial DB queries): For example vendor/bin/typo3cms database:import <<< "UPDATE tt_content SET hidden=1 WHERE ..."
  • DB compare is vendor/bin/typo3cms database:updateschema

For your questions:

do I perform the update of core and 3rdparty extensions in one scoop or is it safer to deactivate the (some?) 3rdparty extensions

Some Upgrade Wizards might behave differently if certain extensions are installed. This is especially true for TCA-reliant migrations. So I would recommend to update all extensions in one step.

Also, how do I automate the process (composer command)

The way I do it you will have to run that composer command only once and afterwards you commit the composer.lock. Building it can be a little hassle but I do not see a need for automating it.

Ad
source: stackoverflow.com
Ad