Project structure

All Magento Commerce Cloud projects include essential files for credentials and application configuration:

File Description
/.magento/routes.yaml Configuration file that redirects www to the naked domain and php application to serve HTTP. See Configure environments.
/.magento/services.yaml Configuration file that defines a MySQL instance, Redis, and ElasticSearch. See Configure environments.
/app The code folder is used for custom modules. The design folder is used for custom themes. See Install a theme. The etc folder contains configuration files for Magento.
/m2-hotfixes Used for custom patches.
/update A service folder used by the support module.
.gitignore Specify which files and directories to ignore. See .gitignore reference.
.magento.app.yaml Configuration file that defines the properties to build your application. See Configure environments.
.magento.env.yaml Configuration file that defines actions for the build, deploy, and post-deploy phases. The ece-tools package includes a sample of this file with detailed descriptions for the available variables. See Configure environments.
composer.json Fetches the Magento Enterprise Edition and the necessary configuration scripts to prepare your application. See Prepare your Magento install.
composer.lock Stores version dependencies for every package.
magento-vars.php A file used to define multiple stores and sites using Magento variables.

When you push your local environment to the remote server, our deploy script uses the values defined by configuration files in the .magento directory, then the script deletes the directory and its contents. Your local development environment is not affected.

Magento application root directory

The Magento application root directory is located in different locations depending on the environment.

  • Starter and Pro Integration: /app
  • Starter Production: /<project-ID>
  • Pro Staging: /<project-ID>_stg
  • Pro Production: /<project-ID>

Writable directories

In Integration, Staging, and Production, only the following directories are writable due to security reasons:

  • var
  • pub/static
  • pub/media
  • app/etc
  • /tmp

In Production, each node in the three-node cluster has a /tmp directory that is not shared with the other nodes.

Ignoring files

We include a base .gitignore file with the Magento Commerce Cloud project repository. See the latest .gitignore file in the magento-cloud repository. If you need to add a file that is in the ignore list, you can use the -f (force) option when staging a commit:

1
git add <path/filename> -f

Change base template

You can use the following steps to change the structure of an existing project to reflect the latest base template for Magento Commerce Cloud.

  1. Clone project to local workstation.

  2. Update the composer.json file with the following values for the extra section.

    1
    2
    3
    4
    
    "extra": {
        "magento-force": true
        "magento-deploystrategy": "copy"
    }
    
  3. Add the .gitignore file designed for the base template. For example, if you need the .gitignore file for the version 2.2.6 template, use the .gitignore for 2.2.6 file as a reference.

  4. Clear the git cache.

    1
    
    git rm -r --cached .
    
  5. Add and commit changes.

    1
    
    git add -A && git commit -m "Update base template"