Cloud 9.03

Upgrade to New Version

Understanding version range syntax, composer update workflow, and deployment path.

Exam Critical: Understanding version range syntax, upgrade workflow, and the metapackage version format is important for the exam!

Upgrade to New Version

mindmap root((Upgrade Process)) Magento Upgrade Quite easy Composer update Version range Version Range >= desired version < desired version + 1 patch Example 2.3.2 Flexibility Workflow Integration first Then Staging Finally Production Test each ece tools Also upgraded Compatible version

Upgrading Magento Overview

Upgrade Process

Good News!

Upgrading Magento is quite easy.

What Gets Upgraded:
  • Magento Cloud Metapackage: Core Magento for Cloud
  • ece-tools: Cloud deployment tools
  • Dependencies: All related packages

Version Range Syntax

Critical: Require Version Range

Before Running Composer Update

Before running composer update, you need to require a range of versions (between two versions).

Version Range Format

The Range Is:

>= the desired version AND < the desired version + one patch version

Example: Upgrading to Magento 2.3.2

composer.json
"require": {
    "magento/magento-cloud-metapackage": ">=2.3.2 <2.3.3"
}
Breaking Down the Syntax:
  • >=2.3.2 - Greater than or equal to 2.3.2
  • <2.3.3 - Less than 2.3.3 (not including 2.3.3)
  • Result: Allows 2.3.2, 2.3.2.1, 2.3.2.2, etc.
  • Excludes: 2.3.3 and higher

Why Use Version Range?

Flexibility for Updates

Reasoning

While the reason for this condition is not stated in Magento documentation, this likely gives Magento the flexibility to release updates to the Cloud meta package (like version 2.3.2.1, for example).

What This Enables

Magento Can Release:
  • 2.3.2 - Original release
  • 2.3.2.1 - Patch or hotfix
  • 2.3.2.2 - Another patch
  • 2.3.2-p1 - Security patch

Your version range automatically allows these updates without requiring you to change composer.json again!

Version Matches >=2.3.2 <2.3.3? Will Install?
2.3.1 ❌ No (< 2.3.2) No
2.3.2 ✅ Yes Yes
2.3.2.1 ✅ Yes Yes
2.3.2.2 ✅ Yes Yes
2.3.2-p1 ✅ Yes Yes
2.3.3 ❌ No (>= 2.3.3) No
2.4.0 ❌ No (>= 2.3.3) No

Upgrade Workflow

Step-by-Step Process

Step 1: Update composer.json

# Edit composer.json
"require": {
    "magento/magento-cloud-metapackage": ">=2.4.6 <2.4.7"
}

Step 2: Run composer update

# Update dependencies
composer update magento/magento-cloud-metapackage --with-dependencies

Step 3: Commit Changes

git add composer.json composer.lock
git commit -m "Upgrade Magento to 2.4.6"

Step 4: Push to Integration

Deployment Path

Then, of course, push to integration > staging > production.

# Push to integration first
git push origin integration

# Test thoroughly
# Verify functionality
# Check logs

Step 5: Merge to Staging

# After testing in integration
git checkout staging
git merge integration
git push origin staging

# Test in staging
# Full regression testing

Step 6: Deploy to Production

# After successful staging tests
git checkout master  # or production for Pro
git merge staging
git push origin master

# Monitor production deployment
# Verify site functionality

Version Range Examples

Common Upgrade Scenarios

Upgrade to 2.4.6

"magento/magento-cloud-metapackage": ">=2.4.6 <2.4.7"

Upgrade to 2.4.5

"magento/magento-cloud-metapackage": ">=2.4.5 <2.4.6"

Upgrade to 2.3.7

"magento/magento-cloud-metapackage": ">=2.3.7 <2.3.8"
Pattern:

For version X.Y.Z, use: ">=X.Y.Z <X.Y.(Z+1)"

Upgrading ece-tools

Cloud Deployment Tools

ece-tools Version

Upgrade of Magento and ece-tools to newer versions

ece-tools Compatibility:
  • ece-tools version should be compatible with Magento version
  • Usually updated automatically with metapackage
  • Check compatibility matrix in documentation

Explicit ece-tools Upgrade

# If needed, specify ece-tools version
composer require magento/ece-tools:^2002.1.0 --no-update
composer update magento/ece-tools --with-dependencies

Complete Upgrade Example

Full Workflow: 2.4.5 to 2.4.6

1. Prepare Local Environment

# Create feature branch
git checkout -b upgrade-2.4.6
git pull origin master

2. Update composer.json

# Edit composer.json
{
    "require": {
        "magento/magento-cloud-metapackage": ">=2.4.6 <2.4.7",
        "magento/ece-tools": "^2002.1.0"
    }
}

3. Run Composer Update

composer update magento/magento-cloud-metapackage --with-dependencies

# Review output
# Check for conflicts
# Resolve any issues

4. Test Locally (Optional)

bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

# Test basic functionality

5. Commit and Push to Integration

git add composer.json composer.lock
git commit -m "Upgrade Magento Cloud to 2.4.6"
git push origin upgrade-2.4.6

# Create pull request or merge to integration

6. Monitor Integration Deployment

# Watch deployment logs
magento-cloud log deploy -e integration

# SSH and verify
magento-cloud ssh -e integration
bin/magento --version  # Should show 2.4.6

7. Test Integration

  • Frontend functionality
  • Admin panel access
  • Checkout process
  • Third-party integrations
  • Custom modules

8. Merge to Staging

git checkout staging
git merge upgrade-2.4.6
git push origin staging

9. Full Staging Tests

  • Regression testing
  • Performance testing
  • UAT (User Acceptance Testing)
  • Third-party service verification

10. Deploy to Production

# Schedule maintenance window
# Create production snapshot
magento-cloud snapshot:create -e production

# Merge to production
git checkout master
git merge staging
git push origin master

# Monitor production deployment
# Verify site is live and functional

Pre-Upgrade Checklist

Before You Upgrade

Preparation Steps

  1. Review release notes: Check what's new and breaking changes
  2. Check compatibility: Verify third-party extensions support new version
  3. Create backup: Snapshot production before upgrade
  4. Review requirements: PHP version, MySQL version, etc.
  5. Plan downtime: Schedule maintenance window if needed
  6. Notify stakeholders: Inform team of upgrade schedule
  7. Test in integration first: Always test before production

Post-Upgrade Verification

After Deployment

Verify Version

# SSH to environment
magento-cloud ssh -e staging

# Check Magento version
bin/magento --version

# Check ece-tools version
composer show magento/ece-tools | grep versions

Check Functionality

  • ✅ Homepage loads correctly
  • ✅ Admin login works
  • ✅ Product pages display
  • ✅ Checkout process completes
  • ✅ Payment gateways work
  • ✅ Shipping methods available
  • ✅ Email notifications sent
  • ✅ Cron jobs running
  • ✅ Third-party integrations functional

Monitor Logs

# Check for errors
tail -f /var/log/error.log
tail -f /app/var/log/exception.log
tail -f /app/var/log/system.log

Troubleshooting Upgrades

Common Issues

Issue 1: Composer Conflicts

Symptom:

Composer cannot resolve dependencies

Solutions:
  1. Check for incompatible third-party modules
  2. Update conflicting packages
  3. Temporarily remove incompatible modules
  4. Use composer why-not magento/magento-cloud-metapackage 2.4.6

Issue 2: Deployment Failures

Symptom:

Build or deploy phase fails

Solutions:
  1. Check deployment logs: magento-cloud log deploy
  2. Verify database schema upgrades completed
  3. Clear cache and retry
  4. Check for module compatibility issues

Best Practices

Upgrade Guidelines

Do's

  • Use version range: >=X.Y.Z
  • Test in integration first: Never skip this step
  • Full staging tests: Regression and UAT
  • Create production snapshot: Before production upgrade
  • Review release notes: Understand changes
  • Check extension compatibility: Update or remove incompatible
  • Monitor deployment: Watch logs during upgrade
  • Verify functionality: Test critical paths post-upgrade

Don'ts

  • Don't use exact version: Use range for flexibility
  • Don't skip integration testing: Always test first
  • Don't upgrade production directly: Use integration > staging > production
  • Don't forget snapshot: Always create backup first
  • Don't ignore warnings: Review composer output
  • Don't rush: Thorough testing prevents downtime

Exam Tips

Key Points to Remember

  • Upgrading is easy: Magento Cloud makes it straightforward
  • Version range required: Before composer update
  • Range format: >= desired version AND < desired version + one patch
  • Example for 2.3.2: ">=2.3.2 <2.3.3"
  • Why range: Gives Magento flexibility to release patches (e.g., 2.3.2.1)
  • Package name: magento/magento-cloud-metapackage
  • Deployment path: Integration > Staging > Production
  • ece-tools: Also upgraded to compatible version
  • composer.json: Update version range in require section
  • Test each environment: Verify before promoting
  • Pattern: For X.Y.Z, use >=X.Y.Z