Get started with a project

This topic shows how to get started working on a project.

Local project directory structure

Not including the Magento application itself, your local project has the following structure:

├── .git
├── .gitignore
├── .magento
│   ├── routes.yaml
│   └── services.yaml
├── .magento.app.yaml
├── auth.json
├── composer.json
├── composer.lock
├── magento-vars.php
├── php.ini
└── README.md

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 isn't affected.

Magento Commerce directories

The following sections discuss information you need to know about directories in the systems deployed to Magento Commerce.

Magento application root directory

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

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.

Logs

Logs for the integration, staging, and production environments are located under the /var/log directory. You can access that directory by opening an SSH tunnel to the environment using the magento-cloud environment:ssh -e <environment id> command.

In staging and production environments, the deployment log is located in /var/log/platform/<project ID>.

Magento logs are located in the <magento root dir>/var/log directory.

Command summary

The following commands can be run from any directory. However, it’s simpler to run them from a project directory. If so, you can omit the -p <project ID> parameter.

All commands are shown with required options only. Get help for any magento-cloud command by appending --help. For more commands, see Magento Cloud CLI reference.

git commit --allow-empty -m "redeploy" && git push <branch name>
Push an empty commit to force a redeployment. Some actions, like adding a user for example, don’t result in deployment.
magento-cloud login
Log in to the project
magento-cloud project:list
List project IDs
magento-cloud environment:list -p <project ID>
List the environments in the current project (that is, the project that corresponds to the directory in which you run the command).
magento-cloud project:get <project ID> <directory> -e <environment ID>
Clone a project to a directory. To clone the master environment, omit -e <environment ID>.
magento-cloud project:info -p <project ID>
List information about the project, including ID, name, region, URL, and Git URL.