Skip to content
MAGENTO

CI/CD for Magento 2: A Staging and Deployment Pipeline Guide

The pipeline that stops deploy-day breakage: what belongs in the build, what staging is for, and how blue-green deploys make rollback boring.

Shane Blandford
Shane Blandford · FOUNDERPUBLISHED · 1 MIN READ

Most Magento breakage we get called about has the same origin story: a change went straight to production. The fix isn't discipline, it's a pipeline - a path to production where the risky steps happen before customers can see them.

The pipeline

01

Commit

Everything in Git - code, config, composer.lock. If it isn't in the repo, it doesn't exist.

02

Build

Composer install, DI compile, and static content deploy happen once, in CI - never on the production box.

03

Stage

The build lands on a staging environment that mirrors production: same PHP, same modules, a scrubbed copy of real data.

04

Test

Checkout, key catalog pages, and whatever this release touched. Automated where it pays, human where it matters.

05

Deploy blue-green

The new release comes up alongside the old one and traffic switches over. Zero downtime, no maintenance page.

06

Rollback

The old release is still there, so rolling back is flipping the switch again - seconds, not a restore job.

What belongs in the build, not on the server

setup:di:compile and static content deployment are the slow, fragile steps - running them on production during a deploy is how stores end up half-broken for twenty minutes. Do them in CI, ship the result as an artifact, and production deploys become file swaps plus setup:upgrade.

What staging is actually for

Not a demo site - a rehearsal. Extension updates, security patches, and version upgrades all get their conflicts found on staging, where finding them costs nothing. A staging environment that drifts from production rehearses the wrong play, so refresh it on a schedule.

We build these pipelines as part of our Magento staging and deployment service - Git workflows, CI/CD, and blue-green deploys with instant rollback. Deploying straight to production is a habit we'll help you break.

FAQ

Does a small Magento store need CI/CD?+
Smaller than you'd think. The pipeline's value is proportional to the cost of downtime, not the size of the team - and one broken peak-hour deploy usually costs more than the setup.
Can Magento really deploy with zero downtime?+
Yes - build outside production, bring the new release up alongside the old, and switch traffic. Maintenance-mode deploys are a choice, not a requirement.
What should a staging environment match?+
PHP version, module set, and configuration - with a scrubbed copy of production data. Parity is the whole point.
Shane Blandford

Shane Blandford

FOUNDER

Founder of Orange Collar Media, a Denver ecommerce agency behind 800+ Magento and Shopify builds. In Magento since version 1.x - building, rescuing, and supporting revenue-critical stores since 2008.

All posts by Shane Blandford

KEEP READING

Related from the Journal.

Your store can sell more. Let's find out how much.

Start a project