Summary

Overview

This course provides a comprehensive, hands-on guide to setting up a Magento 2.4.8 (Community Edition) development environment using Docker and Composer, with a focus on developer and DevOps workflows. It covers the entire process from acquiring Adobe Commerce access keys, initializing a containerized environment via Marcin’s Docker-Magento tool, installing Magento via CLI, configuring environment-specific settings, navigating the Magento file structure, managing modules, and understanding the admin panel. The session emphasizes best practices for local development, including isolation of dependencies, secure configuration handling, and avoiding direct edits to vendor files. It also introduces key concepts like module loading order, environment variables, and the role of composer.json and composer.lock in version control.

Topic (Timeline)

1. Environment Setup & Access Keys [00:00:08 - 00:05:04]

  • Introduction to prerequisite tools: Docker and Magento Composer access keys.
  • Guidance on creating a free Adobe Commerce (formerly Magento Marketplace) account for open-source access.
  • Explanation of public/private key pair usage: public key as username, private key as password for Composer authentication.
  • Introduction to Marcin’s Docker-Magento tool as a pre-configured development environment that abstracts complex service dependencies (PHP, Nginx, MariaDB, Redis, RabbitMQ, MailHog).
  • Emphasis on Docker-based development: no need to install PHP, MySQL, or other services natively on the host machine.

2. Project Initialization with Docker-Magento [00:05:04 - 00:15:26]

  • Use of curl and bash piping to execute the Docker-Magento setup script in one line.
  • Configuration of local domain (e.g., vodacom.test) using .test or .local TLDs reserved for local development.
  • Selection of Magento edition (Community) and version (2.4.8-p3 as the latest stable).
  • Explanation of Magento patching system (p1, p2, p3) for security and bug fixes.
  • Docker workflow: image download → container creation → service orchestration.
  • Overview of containerized services: Nginx (app), PHP-FPM (php-fpm), MariaDB (db), OpenSearch, RabbitMQ, MailHog.
  • Automatic generation of local SSL certificates for HTTPS on localhost.

3. Composer Authentication & Module Installation [00:15:26 - 00:21:48]

  • Input of Adobe access keys during Composer installation: username (public key), password (private key).
  • Global vs. project-specific composer.json and auth.json configuration: global keys apply to all projects; project-specific keys allow per-client access control.
  • Composer resolves and downloads 613+ modules, including core, frontend, API, and framework dependencies.
  • Automatic execution of Magento installation commands post-download.
  • Emphasis on the speed and automation of the one-line setup for non-developers (e.g., QA, business analysts).

4. Post-Installation Configuration & Admin Access [00:21:48 - 00:28:55]

  • Post-installation steps: permission fixes, service restarts, and Magento CLI initialization.
  • Default admin credentials: username John Smith, password 123123 (demonstrated for development only).
  • Critical security practice: change default admin path (/admin) to a custom string via env.php.
  • Two-Factor Authentication (2FA) in Magento admin: enabled by default; recommended to disable in local dev using CLI or a dedicated module (marcink/d2fa-disable).
  • Introduction to Magento CLI: bin/magento command structure, namespaces (e.g., module, admin), and core commands.

5. Module Management & System State [00:28:55 - 00:38:26]

  • Listing enabled/disabled modules via bin/magento module:status.
  • Understanding module load order: determined by dependency and configuration, not alphabetical.
  • Disabling modules: bin/magento module:disable Magento_TwoFactorAuth and Magento_AdminAdobeImsTwoFactorAuth.
  • Dependency constraints: disabling a module fails if others depend on it.
  • Running bin/magento setup:upgrade to flush compiled code and update system state after module changes.
  • Confirmation of successful admin login and dashboard access.

6. Docker & Magento File Structure Deep Dive [00:40:15 - 00:52:29]

  • Analysis of docker-compose.yml and docker-compose.dev.yml: service definitions, port mappings, volume mounts, and environment overrides.
  • Key volumes: app/code (custom modules), var/ (generated files), pub/static (static assets), env/ (environment variables).
  • Mapping host code to containers: enabling full source code visibility by adjusting volume bindings.
  • Use of bin/copy-from-container and bin/copy-to-container for file synchronization.
  • Introduction to generated/ and var/ directories: auto-generated code (classes, proxies, plugins) refreshed on setup:upgrade.

7. Core Magento Directories & Best Practices [00:52:29 - 01:02:41]

  • Vendor folder: Contains all Composer-installed modules (Magento core, third-party, frameworks like Laminas, Guzzle). Rule: never edit files here directly — changes are lost on composer install/update.
  • App/code folder: Location for custom and project-specific modules. Recommended for bespoke development.
  • Composer.json vs. composer.lock:
    • composer.json declares version ranges (e.g., ^8.2).
    • composer.lock pins exact versions — must be committed to version control to ensure environment consistency.
  • env.php: Contains environment-specific configurations (database, cache, session, admin path). Never commit to version control due to sensitive data.
  • Pub/static: Pre-compiled frontend assets (CSS, JS, images) for performance optimization.

8. Admin Panel Navigation & System Overview [01:02:41 - 01:24:30]

  • Dashboard overview: sales metrics, top products, search terms, customer stats (all empty in fresh install).
  • Admin menu structure:
    • Sales: Orders, invoices, shipments, payments.
    • Catalog: Products, categories, attributes.
    • Customers: Customer groups, online users, segments.
    • Marketing: Promotions, email templates, URL rewrites, search terms, reviews.
    • Content: Static blocks, pages, themes.
    • Reports: Built-in analytics (limited), Adobe Commerce Advanced Reporting (external, paid).
    • Stores: Configuration (currency, tax, inventory, attributes, text zones, order statuses).
    • System: Cache management, index management, user roles, integrations, import/export, custom variables.
  • Magento version displayed in admin header: 2.4.8.6.
  • Emphasis on multi-store architecture and configuration flexibility.

Appendix

Key Principles

  • Never edit vendor files: All customizations must be done via overrides, plugins, or custom modules in app/code.
  • Use environment-specific configs: env.php and docker-compose.dev.yml for local; never commit sensitive data to Git.
  • Commit composer.lock: Ensures production and development environments use identical dependency versions.
  • Use .test or .local domains: Reserved for local development; avoid .com/.net in dev setups.
  • Disable 2FA in dev: Use marcink/d2fa-disable module or CLI to avoid login friction during development.

Tools Used

  • Docker-Magento (Marcin’s): Pre-configured Docker environment for Magento development.
  • Composer: Dependency manager for PHP; handles module installation and autoloading.
  • Magento CLI (bin/magento): Primary tool for system management, module control, cache, and index operations.
  • MailHog: Email testing tool for local development (captures outgoing emails).
  • PHPMyAdmin: Optional database GUI (accessible via http://localhost:8080 in Docker setup).

Common Pitfalls

  • Forgetting to commit composer.lock → version mismatches in production.
  • Editing files in vendor/ → changes lost on composer install.
  • Committing env.php to Git → security risk and environment conflicts.
  • Using .com domains locally → potential DNS conflicts or browser warnings.
  • Not running setup:upgrade after enabling/disabling modules → system state out of sync.

Practice Suggestions

  • Recreate the setup from scratch using Docker-Magento on a clean machine.
  • Disable a core module (e.g., Magento_Review) and verify it’s reflected in app/etc/config.php.
  • Modify env.php to change the admin path and confirm access via new URL.
  • Use bin/magento module:status to list modules, then disable one and run setup:upgrade.
  • Inspect composer.lock to find the exact version of a module (e.g., magento/framework).
  • Explore docker-compose.yml and change the PHP version from 8.3 to 8.2, then rebuild containers.