deployer/docs/recipe/magento2.md
2022-09-12 11:40:11 +02:00

8.3 KiB
Raw Blame History

How to Deploy a Magento 2 Project

Source

Deployer is a free and open source deployment tool written in PHP. It helps you to deploy your Magento 2 application to a server. It is very easy to use and has a lot of features.

Three main features of Deployer are:

  • Provisioning - provision your server for you.
  • Zero downtime deployment - deploy your application without a downtime.
  • Rollbacks - rollback your application to a previous version, if something goes wrong.

Additionally, Deployer has a lot of other features, like:

  • Easy to use - Deployer is very easy to use. It has a simple and intuitive syntax.
  • Fast - Deployer is very fast. It uses parallel connections to deploy your application.
  • Secure - Deployer uses SSH to connect to your server.
  • Supports all major PHP frameworks - Deployer supports all major PHP frameworks.

You can read more about Deployer in Getting Started.

The deploy task of Magento 2 consists of:

The magento2 recipe is based on the common recipe.

Configuration

static_content_locales

Source

By default setup:static-content:deploy uses en_US. To change that, simply put set('static_content_locales', 'en_US de_DE'); in you deployer script.

'en_US'

magento_themes

Source

You can also set the themes to run against. By default it'll deploy all themes - add('magento_themes', ['Magento/luma', 'Magento/backend']);

[

]

static_content_jobs

Source

Also set the number of conccurent jobs to run. The default is 1 Update using: set('static_content_jobs', '1');

'1'

content_version

Source

shared_files

Source

Overrides shared_files from recipe/deploy/shared.php.

[
    'app/etc/env.php',
    'var/.maintenance.ip',
]

shared_dirs

Source

Overrides shared_dirs from recipe/deploy/shared.php.

[
    'var/composer_home',
    'var/log',
    'var/export',
    'var/report',
    'var/import',
    'var/import_history',
    'var/session',
    'var/importexport',
    'var/backups',
    'var/tmp',
    'pub/sitemap',
    'pub/media'
]

writable_dirs

Source

Overrides writable_dirs from recipe/deploy/writable.php.

[
    'var',
    'pub/static',
    'pub/media',
    'generated',
    'var/page_cache'
]

clear_paths

Source

Overrides clear_paths from recipe/deploy/clear_paths.php.

[
    'generated/*',
    'pub/static/_cache/*',
    'var/generation/*',
    'var/cache/*',
    'var/page_cache/*',
    'var/view_preprocessed/*'
]

magento_version

Source

maintenance_mode_status_active

Source

enable_zerodowntime

Source

Deploy without setting maintenance mode if possible

true

Tasks

magento:compile

Source

Compiles magento di.

Tasks

magento:deploy:assets

Source

Deploys assets.

magento:sync:content_version

Source

Syncs content version.

magento:maintenance:enable

Source

Enables maintenance mode.

magento:maintenance:disable

Source

Disables maintenance mode.

magento:config:import

Source

Config Import.

magento:upgrade:db

Source

Upgrades magento database.

magento:cache:flush

Source

Flushes Magento Cache.

deploy:magento

Source

Magento2 deployment operations.

This task is group task which contains next tasks:

magento:build

Source

Magento2 build operations.

This task is group task which contains next tasks:

deploy

Source

Deploys your project.

This task is group task which contains next tasks: