This checklist was used to upgrade craft and magento on 12-19-22 as part of PAP-6952
Craft 3 → 4 procedure
https://craftcms.com/docs/4.x/upgrade.html#preparing-for-the-upgrade
- 1. Upgrade PHP/install dependencies
-- This might take the site down --
https://tecadmin.net/how-to-install-php-8-on-centos-rhel-8/
If you're in ddev just change the config.yaml file to read v 8.1 and do a
ddev restart
then you can skip this step
sudo dnf update -y sudo yum install yum-utils sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.4.rpm sudo dnf module list php # Review php modules to confirm 8.0 is available sudo dnf module reset php sudo dnf module enable php:remi-8.0 sudo dnf module install php:remi-8.0 sudo dnf update --skip-broken --nobest #the RHEL we were given is locked to a weird version without subscriptions sudo dnf install php-imagick sudo dnf install php-bcmath sudo dnf install php-intl sudo chown -R php:php /var/lib/php/
- 2. Confirm PHP 8.0.2+
- 3. Confirm MySQL 5.7.8+ (We’re actually on MariaDB 10.3.32 but that’s fine)
- 4. Confirm PHP has BCMath and Intl
- 4.5 confirm the .env file has the new security key variable in it -
CRAFT_SECURITY_KEY
in duplicate of the oldSECURITY_KEY
- 5. Backup db (
mysqldump DBNAMEHERE -u USERNaMEHeRE -p -h 127.0.0.1 | gzip > /tmp/CraftCms_ENV_$(date "+%Y-%m-%d_%H%M").sql.gz
)
- 6. pull branch (For composer update in a bit)
- 7. truncate
craft_plugins
table - 8. rename
feed_me_feeds
table for use later on the new table - 8.5 copy/rename the navigation tables for restore (The schema changes with this upgrade in those tables)
- 9.
rm -rf vendor
composer update
- 10. Run
deploy.sh
This script is global on the dev server and it’s location can be found by which deploy.sh
This should do
npm install
php craft migrate/up --track craft
php craft project-config/apply
php craft migrate/all
npx mix
- 11. if there's a 500 error loading from and back- it's probably the security key, so run
php craft setup/security-key
and/or check that nginx user can write to/var/lib/php
- 12. Install all the plugins
php craft plugin/install allow-list php craft plugin/install azure-blob php craft plugin/install blitz php craft plugin/install ckeditor php craft plugin/install feed-me php craft plugin/install linkit php craft plugin/install navigation php craft plugin/install redactor php craft plugin/install retour php craft plugin/install seomatic php craft plugin/install templatecomments
- 13. copy the feedme feeds and navigation tables to their new tables
DataGrip copies booleans as empty because of its interface or something, so there's a few columns that need to be manually tweaked before it'll accept an insert. If you’re doing it that way
- 14. Flush caches, invalidate indexes, run image indexer
Magento 2.4.5 upgrade/deploy procedure
- Confirm ElasticSEARCH version is still supported- 2.4.5 does support ES but only when self hosting. Cloud is now OpenSearch, so this will need/want to switch soon.
- Upgrade to PHP8 in the same way as craft above (It’s also a RHEL box)
- Except - php version 8.1 (Swap any 8.0 for 8.1)
- cd into the integration path (/var/www/magento/integration) and do:
- sudo git fetch && sudo git pull
- sudo rm -rf vendor/* generated/*
- composer self-update --2
- composer update
- Run
deploy.sh
script (Should point to theintegration
folder - not a PAP branch)
This script is global on the dev server and it’s location can be found by which deploy.sh
- On the Dev environment, run the following command:
bin/magento config:set system/security/max_session_size_admin 2560000
- On the Dev database, run the following commands to remove ElasticSUITE:
DELETE FROM setup_module where module='Smile_ElasticsuiteAdminNotification'; DELETE FROM setup_module where module='Smile_ElasticsuiteAnalytics'; DELETE FROM setup_module where module='Smile_ElasticsuiteCatalog'; DELETE FROM eav_attribute where attribute_code='use_name_in_product_search'; DELETE FROM eav_attribute where attribute_code='is_displayed_in_autocomplete'; ALTER TABLE catalog_eav_attribute DROP COLUMN is_displayed_in_autocomplete; ALTER TABLE catalog_eav_attribute DROP COLUMN is_used_in_spellcheck; ALTER TABLE catalog_eav_attribute DROP COLUMN facet_min_coverage_rate; ALTER TABLE catalog_eav_attribute DROP COLUMN facet_max_size; ALTER TABLE catalog_eav_attribute DROP COLUMN facet_sort_order; ALTER TABLE search_query DROP COLUMN is_spellchecked; ALTER TABLE catalog_eav_attribute DROP COLUMN display_pattern; ALTER TABLE catalog_eav_attribute DROP COLUMN display_precision; ALTER TABLE catalog_eav_attribute DROP COLUMN sort_order_asc_missing; ALTER TABLE catalog_eav_attribute DROP COLUMN sort_order_desc_missing; ALTER TABLE catalog_eav_attribute DROP COLUMN facet_boolean_logic; ALTER TABLE catalog_eav_attribute DROP COLUMN is_display_rel_nofollow; ALTER TABLE catalog_eav_attribute DROP COLUMN include_zero_false_values; DROP TABLE smile_elasticsuitecatalog_category_filterable_attribute; DROP TABLE smile_elasticsuitecatalog_search_query_product_position; DELETE FROM setup_module where module='Smile_ElasticsuiteCatalogGraphQl'; DELETE FROM setup_module where module='Smile_ElasticsuiteCatalogOptimizer'; DELETE FROM smile_elasticsuite_optimizer where optimizer_id is not null; DELETE FROM smile_elasticsuite_optimizer_search_container where optimizer_id is not null; DROP TABLE smile_elasticsuite_optimizer_limitation; DROP TABLE smile_elasticsuite_optimizer_search_container; DROP TABLE smile_elasticsuite_optimizer; DELETE FROM setup_module where module='Smile_ElasticsuiteCatalogRule'; DELETE FROM setup_module where module='Smile_ElasticsuiteCore'; DROP TABLE smile_elasticsuite_relevance_config_data; DELETE FROM setup_module where module='Smile_ElasticsuiteIndices'; DELETE FROM setup_module where module='Smile_ElasticsuiteSwatches'; DELETE FROM setup_module where module='Smile_ElasticsuiteThesaurus'; DROP TABLE smile_elasticsuite_thesaurus_expanded_terms; DROP TABLE smile_elasticsuite_thesaurus_reference_terms; DROP TABLE smile_elasticsuite_thesaurus_store; DROP TABLE smile_elasticsuite_thesaurus; DELETE FROM setup_module where module='Smile_ElasticsuiteTracker'; DROP TABLE elasticsuite_tracker_log_event; DROP TABLE elasticsuite_tracker_log_customer_link; DELETE FROM setup_module where module='Smile_ElasticsuiteVirtualCategory'; DELETE FROM eav_attribute where attribute_code='is_virtual_category'; DELETE FROM eav_attribute where attribute_code='virtual_category_root'; DELETE FROM eav_attribute where attribute_code='virtual_rule'; DROP TABLE smile_virtualcategory_catalog_category_product_position; DELETE FROM eav_attribute where attribute_code='use_store_positions'; DELETE FROM eav_attribute where attribute_code='generate_root_category_subtree';
Post Upgrade Release Procedure
- Reconfigure the .env file for Craft CMS, and any other configurations to replace
PAP-5294
withintegration
in all magento urls (We are dropping the PAP feature branch environments) - Eventually reconfigure the nginx config to drop the folder location all together (url/integration → url)
- Restart craft queue daemon, and release all queue jobs if stuck (
sudo systemctl restart craft-queue
) - Flush Magento cache after configs are complete