Cloud Architecture Overview
Adobe Commerce Cloud Architecture
Internet
|
+-- CDN (Fastly)
|
+-- Load Balancer
|
+-- Web Nodes (Nginx + PHP-FPM)
| |
| +-- Magento Application
| +-- Static Content
|
+-- Services
| +-- MySQL (MariaDB)
| +-- Redis
| +-- Elasticsearch/OpenSearch
| +-- RabbitMQ
|
+-- Build Node
| +-- composer install
| +-- static-content:deploy
|
+-- Shared Storage (NFS)
+-- pub/media
+-- pub/static
Cloud Services
# .magento/services.yaml
mysql:
type: mysql:10.6
disk: 2048
redis:
type: redis:6.0
elasticsearch:
type: elasticsearch:7.17
disk: 1024
rabbitmq:
type: rabbitmq:3.9
disk: 512
Cloud Project Structure
.magento/
services.yaml # Service configuration
routes.yaml # Route configuration
cloud.meta.yaml # Cloud metadata
app/
code/Vendor/ # Custom modules
design/ # Custom themes
composer.json # Dependencies
composer.lock # Locked dependencies
Key Takeaway
Adobe Commerce Cloud uses a PaaS architecture with managed services (MySQL, Redis, Elasticsearch, RabbitMQ), web nodes with Nginx/PHP-FPM, and shared storage via NFS.
Cloud Environments
Environment Hierarchy
Production
|
+-- Staging (pre-production)
|
+-- Integration (development)
|
+-- Branch: feature/checkout
+-- Branch: bugfix/tax-calc
+-- Branch: release/2.4.6
Environment Management
# List environments
magento-cloud environment:list
# Get environment details
magento-cloud environment:info
# Activate environment
magento-cloud environment:activate <branch>
# Deactivate environment
magento-cloud environment:deactivate <branch>
Environment Variables
# Set variables
magento-cloud variable:create \
--name env:ENABLE_MODULES \
--value Vendor_Module \
--level environment
# List variables
magento-cloud variable:list
# Delete variable
magento-cloud variable:delete <name>
Environment Access
# SSH into environment
magento-cloud ssh
# SSH into specific environment
magento-cloud ssh --environment <branch>
# Run commands in environment
magento-cloud environments:info <branch>
Key Takeaway
Cloud environments mirror deployment hierarchy. Use magento-cloud CLI for environment management, variable configuration, and SSH access.
Cloud Services Configuration
MySQL Configuration
# .magento/services.yaml
mysql:
type: mysql:10.6
disk: 2048
configuration:
schema: main
Redis Configuration
redis:
type: redis:6.0
configuration:
maxmemory: 1073741824
maxmemory_policy: allkeys-lru
Elasticsearch Configuration
elasticsearch:
type: elasticsearch:7.17
disk: 1024
configuration:
plugins:
- analysis-icu
RabbitMQ Configuration
rabbitmq:
type: rabbitmq:3.9
disk: 512
configuration:
plugins:
- rabbitmq_management
Service Relationships
# app/etc/env.php (auto-generated)
return [
'db' => [
'table_prefix' => '',
'connection' => [
'default' => [
'host' => $MAGENTO_CLOUD_RELATIONSHIPS->mysql->host,
'dbname' => $MAGENTO_CLOUD_RELATIONSHIPS->mysql->dbname,
'username' => $MAGENTO_CLOUD_RELATIONSHIPS->mysql->username,
'password' => $MAGENTO_CLOUD_RELATIONSHIPS->mysql->password,
],
],
],
'cache' => [
'frontend' => [
'default' => [
'backend' => 'Magento\Framework\Cache\Backend\Redis',
'backend_options' => [
'server' => $MAGENTO_CLOUD_RELATIONSHIPS->redis->host,
'port' => $MAGENTO_CLOUD_RELATIONSHIPS->redis->port,
],
],
],
],
];
Key Takeaway
Cloud services are configured via .magento/services.yaml. Service relationships are injected as environment variables and used in env.php.
Cloud Deployment
Deployment Process
git push origin main
|
+-- Build Phase
| +-- composer install
| +-- static-content:deploy
| +-- Compile DI
|
+-- Deploy Phase
| +-- Setup upgrade
| +-- Deploy static content
| +-- Clear cache
|
+-- Post-Deploy
+-- Health checks
+-- Warm cache
Build Hooks
# .magento.app.yaml
type: php:8.1
build:
flavor: none
deploy:
flavor: none
hooks:
build: |
set -e
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
deploy: |
set -e
php bin/magento setup:upgrade --keep-generated
php bin/magento cache:clean
php bin/magento cache:flush
Routes Configuration
# .magento/routes.yaml
'http://{default}/':
type: upstream
upstream: magento:php
'https://{default}/':
type: upstream
upstream: magento:php
cache:
enabled: true
ttl: 60
Deployment Commands
# Get deployment status
magento-cloud environment:info
# View deployment log
magento-cloud environment:log
# View build log
magento-cloud builds:list
# SSH and check status
magento-cloud ssh
bin/magento cache:status
Performance Optimization
# Enable Varnish
magento-cloud variable:create \
--name env:HTTP_CACHE_HOSTS \
--value 'varnish:6081'
# Configure Redis
magento-cloud variable:create \
--name env:REDIS_HOST \
--value redis
# Enable Elasticsearch
magento-cloud variable:create \
--name env:ELASTICSEARCH_HOST \
--value elasticsearch
Key Takeaway
Cloud deployment uses git push with build and deploy hooks. Routes configuration handles URL routing. Optimize with Varnish, Redis, and Elasticsearch variables.
Quiz
1. What file configures cloud services?
2. How do you SSH into a cloud environment?
3. What triggers cloud deployment?
4. What is the cloud environment hierarchy?
5. What are cloud hooks?
Flashcards
Question
What configures cloud services?
Click to reveal answer
Answer
.magento/services.yaml defines MySQL, Redis, Elasticsearch, RabbitMQ
Question
How to SSH into cloud?
Click to reveal answer
Answer
magento-cloud ssh command
Question
What triggers deployment?
Click to reveal answer
Answer
git push to main branch
Question
Environment hierarchy?
Click to reveal answer
Answer
Integration -> Staging -> Production
Question
What are cloud hooks?
Click to reveal answer
Answer
Build and deploy scripts in .magento.app.yaml
Question
What is shared storage?
Click to reveal answer
Answer
NFS-based storage for pub/media and pub/static
Question
How to set variables?
Click to reveal answer
Answer
magento-cloud variable:create --name NAME --value VALUE
Question
What is Fastly?
Click to reveal answer
Answer
CDN service for caching and performance optimization
Revision Notes
Key Takeaways
- 1. Adobe Commerce Cloud is a PaaS with managed services
- 2. .magento/services.yaml configures services
- 3. Deployment triggered by git push to main
- 4. Environment hierarchy: Integration -> Staging -> Production
- 5. Cloud hooks run build and deploy scripts
Interview Tips
- • Explain cloud architecture and services
- • Describe environment management
- • Discuss cloud deployment process
- • Explain cloud-specific optimizations
Cheat Sheet
Adobe Commerce Cloud
Services:
.magento/services.yaml
MySQL, Redis, Elasticsearch, RabbitMQ
Deployment:
git push -> build -> deploy
CLI:
magento-cloud environment:list
magento-cloud ssh
magento-cloud variable:create
Hooks:
.magento/app.yaml hooks section
Routes:
.magento/routes.yaml
Optimization:
Varnish, Redis, Elasticsearch variables