Skip to content

Commit a2cdea6

Browse files
committed
Deployment Process / deploy
1 parent 857eb8f commit a2cdea6

File tree

1 file changed

+116
-1
lines changed

1 file changed

+116
-1
lines changed

5. Deployment Process.md

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,122 @@ Ece-tools [\Magento\MagentoCloud\App\Container](https://github.com/magento/ece-t
204204

205205

206206
**Deploy**
207-
- `php ./vendor/bin/ece-tools deploy`
207+
208+
`php ./vendor/bin/ece-tools deploy`
209+
210+
> notice: Starting deploy. (magento/ece-tools version: 2002.0.17, magento/magento2-base version: 2.2.8)
211+
212+
- delete `var/.deploy_is_failed` flag file
213+
- [Process\Deploy\PreDeploy](https://github.com/magento/ece-tools/blob/develop/src/Process/Deploy/PreDeploy.php)
214+
- Runs all processes that have to be run before deploy starting. see [Process\Deploy\PreDeploy](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/PreDeploy) folders
215+
- Process\PreDeploy\ConfigUpdate\Cache
216+
- `CACHE_CONFIGURATION` from `.magento.env.yaml`
217+
- Process\Deploy\PreDeploy\CleanStaticContent
218+
- check `.static_content_deploy` flag file exists
219+
- `CLEAN_STATIC_FILES` is true
220+
- clean `pub/static/` folder
221+
- Process\Deploy\PreDeploy\CleanViewPreprocessed
222+
- clean `var/view_preprocessed` directory when the deployment variable `SKIP_HTML_MINIFICATION` is true
223+
- Process\Deploy\PreDeploy\CleanRedisCache
224+
- `redis-cli -h $redisHost -p $redisPort -n $redisCacheDb flushdb` ($redisCacheDb = 1)
225+
- Process\Deploy\PreDeploy\CleanFileCache
226+
- delete `/var/cache` folder
227+
- Process\Deploy\PreDeploy\RestoreWritableDirectories
228+
- see [Filesystem\RecoverableDirectoryList::getList](https://github.com/magento/ece-tools/blob/develop/src/Filesystem/RecoverableDirectoryList.php#L83)
229+
- copy `init/app/etc` to `app/etc`
230+
- copy `init/pub/media` to `pub/media`
231+
- copy (symlink) `init/pub/static` to `pub/static`
232+
- delete `var/.regenerate` flag file
233+
- Process\Deploy\PreDeploy\SetProductionMode
234+
- switching magento to production mode (`app/etc/env.php` => `'MAGE_MODE' => 'production',`)
235+
- Enabling Maintenance mode: `php ./bin/magento maintenance:enable --ansi --no-interaction`
236+
- [Process\Deploy\DisableCron](https://github.com/magento/ece-tools/blob/develop/src/Process/Deploy/DisableCron.php)
237+
- disable cron (`app/etc/env.php` => `['cron' => ['enabled' => 0]]`)
238+
- [Process\ValidateConfiguration](https://github.com/magento/ece-tools/tree/develop/src/Process/ValidateConfiguration.php)
239+
```php
240+
$this->container->make(\Magento\MagentoCloud\Process\ValidateConfiguration::class, [
241+
'validators' => [
242+
ValidatorInterface::LEVEL_CRITICAL => [
243+
$this->container->make(ConfigValidator\Deploy\DatabaseConfiguration::class),
244+
$this->container->make(ConfigValidator\Deploy\ResourceConfiguration::class),
245+
$this->container->make(ConfigValidator\Deploy\SessionConfiguration::class),
246+
],
247+
ValidatorInterface::LEVEL_WARNING => [
248+
$this->container->make(ConfigValidator\Deploy\AdminData::class),
249+
$this->container->make(ConfigValidator\Deploy\PhpVersion::class),
250+
$this->container->make(ConfigValidator\Deploy\SearchEngine::class),
251+
$this->container->make(ConfigValidator\Deploy\ElasticSearchUsage::class),
252+
$this->container->make(ConfigValidator\Deploy\ElasticSearchVersion::class),
253+
$this->container->make(ConfigValidator\Deploy\AppropriateVersion::class),
254+
$this->container->make(ConfigValidator\Deploy\ScdOptionsIgnorance::class),
255+
$this->container->make(ConfigValidator\Deploy\DeprecatedVariables::class),
256+
$this->container->make(ConfigValidator\Deploy\RawEnvVariable::class),
257+
$this->container->make(ConfigValidator\Deploy\MagentoCloudVariables::class),
258+
$this->container->make(ConfigValidator\Deploy\JsonFormatVariable::class),
259+
],
260+
],
261+
]),
262+
```
263+
validators list: [Config/Validator/Deploy/](https://github.com/magento/ece-tools/tree/develop/src/Config/Validator/Deploy)
264+
- [Process\Deploy\UnlockCronJobs](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/UnlockCronJobs.php)
265+
- In magento version 2.2 was implemented locking functionality for cron jobs, new cron jobs can't be started if exist job in status 'running' with same 'job_code'.
266+
- ```UPDATE `cron_schedule` SET `status` = 'error', `messages` = 'The job is terminated due to system upgrade' WHERE `status` = 'running'```
267+
- [Process\Deploy\SetCryptKey](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/SetCryptKey.php)
268+
- update crypt/key in `app/etc/env.php` with `CRYPT_KEY` variable value (MAGENTO_CLOUD_VARIABLES)
269+
- [Process\Deploy\InstallUpdate](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/InstallUpdate.php)
270+
- magento not installed
271+
- see [Process/Deploy/InstallUpdate/Install](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/InstallUpdate/Install)
272+
- Process\Deploy\InstallUpdate\Install\Setup: `php ./bin/magento setup:install -n --session-save=db --cleanup-database`
273+
- run `php ./bin/magento app:config:import --ansi --no-interaction`
274+
- sends email with link to reset password
275+
- magento already installed
276+
- see [Process/Deploy/InstallUpdate/Update](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/InstallUpdate/Update)
277+
- sets an admin URL from `ADMIN_URL` variable value (MAGENTO_CLOUD_VARIABLES) (Process\Deploy\InstallUpdate\Update\SetAdminUrl)
278+
- Running setup upgrade:`php ./bin/magento setup:upgrade --keep-generated --ansi --no-interaction` (Process\Deploy\InstallUpdate\Update\Setup)
279+
- Updating configuration from environment variables (DeployProcess\InstallUpdate\ConfigUpdate)
280+
- see [Process/Deploy/InstallUpdate/ConfigUpdate](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/InstallUpdate/ConfigUpdate)
281+
```php
282+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\PrepareConfig::class),
283+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\CronConsumersRunner::class),
284+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\DbConnection::class),
285+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\Amqp::class),
286+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\Session::class),
287+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\SearchEngine::class),
288+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\Urls::class),
289+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\DocumentRoot::class),
290+
291+
$this->container->when(DeployProcess\InstallUpdate\ConfigUpdate\Urls::class)
292+
->needs(ProcessInterface::class)
293+
->give(function () {
294+
return $this->container->makeWith(ProcessComposite::class, [
295+
'processes' => [
296+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\Urls\Database::class),
297+
$this->container->make(DeployProcess\InstallUpdate\ConfigUpdate\Urls\Environment::class),
298+
],
299+
]);
300+
});
301+
```
302+
- [Process\Deploy\DeployStaticContent](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/DeployStaticContent.php)
303+
- clean `pub/static` and `var/view_preprocessed` if `SCD_ON_DEMAND` = true
304+
- skip this step if `SKIP_SCD` = true or `.static_content_deploy` file flag exists
305+
- clean `pub/static` and `var/view_preprocessed` if `CLEAN_STATIC_FILES` = true
306+
- Generating fresh static content
307+
- see [Process\Deploy\DeployStaticContent\Generate](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/DeployStaticContent/Generate.php)
308+
- see build SCD commands [StaticContent\CommandFactory::matrix](https://github.com/magento/ece-tools/blob/develop/src/StaticContent/CommandFactory.php#L98)
309+
- [Process\Deploy\CompressStaticContent](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/CompressStaticContent.php)
310+
- skip if `SCD_ON_DEMAND` = true
311+
- skip if exists `.static_content_deploy` flag
312+
- use [Util\StaticContentCompressor::process](https://github.com/magento/ece-tools/tree/develop/src/Util/StaticContentCompressor.php)
313+
- [Process\Deploy\DisableGoogleAnalytics](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/DisableGoogleAnalytics.php)
314+
- if `ENABLE_GOOGLE_ANALYTICS` = false (default: false) in the `.magento.env.yaml`
315+
- if not master branch (`/^(master|production|staging)(?:-[a-z0-9]+)?$/i`) (check `MAGENTO_CLOUD_ENVIRONMENT` env variable)
316+
- execute ```UPDATE `core_config_data` SET `value` = 0 WHERE `path` = 'google/analytics/active'```
317+
- [Process\Deploy\DeployCompletion](https://github.com/magento/ece-tools/tree/develop/src/Process/Deploy/DeployCompletion.php)
318+
- checks is `post_deploy` hook enabled in `.magento.app.yaml`
319+
- runs processes if only post_deploy hook is not configured
320+
- Disable maintenance mode: `php ./bin/magento maintenance:disable --ansi --no-interaction`
321+
322+
> notice: Deployment completed..
208323

209324
**Post_deploy**
210325
- `php ./vendor/bin/ece-tools post-deploy`

0 commit comments

Comments
 (0)