|
2 | 2 |
|
3 | 3 | #### 5.1 Determine the processes during deployment |
4 | 4 |
|
| 5 | +###### Describe all processes that are running during deployment: Build, deploy and post-deploy phases. Explain why downtime occurs on your project |
| 6 | + |
| 7 | +Build and deploy full steps: |
| 8 | +1. Code and configuration validation |
| 9 | + - run series of checks and code validation |
| 10 | + - modify cluster topology (e.g. elasticsearch was added) |
| 11 | + - run `composer install` |
| 12 | + - on syntax error in a configuration file, Git server refuses the push, see [Protective block](https://devdocs.magento.com/guides/v2.3/cloud/live/live-prot.html) |
| 13 | + - to disable protective block |
| 14 | + ``` |
| 15 | + # .magento.app.yaml |
| 16 | + preflight: |
| 17 | + enabled: false |
| 18 | + ``` |
| 19 | +2. Build |
| 20 | + - site is not in maintenance mode |
| 21 | + - will not be brought down if errors or issues occur |
| 22 | + - cluster has not been created yet (don't try to connect to a database or assume anything was daemonized) |
| 23 | + - execute commands before packaging your application |
| 24 | + - runs hooks in the `build` section from `.magento.app.yaml` |
| 25 | + ```yaml |
| 26 | + # We run build hooks before your application has been packaged. |
| 27 | + build: | |
| 28 | + set -e |
| 29 | + php ./vendor/bin/ece-tools build:generate |
| 30 | + php ./vendor/bin/ece-tools build:transfer |
| 31 | + # old style |
| 32 | + #php ./vendor/bin/ece-tools build |
| 33 | + ``` |
| 34 | + - result of the build phase is a read-only file system referred to as a slug |
| 35 | + - TODO: ./vendor/bin/ece-tools build:generate / build:transfer |
| 36 | +3. Prepare the slug |
| 37 | + - create an archive and put the slug in permanent storage |
| 38 | + - slug includes all files and folders excluding the mounts configured in `magento.app.yaml` |
| 39 | + ```yaml |
| 40 | + mounts: |
| 41 | + "var": "shared:files/var" |
| 42 | + "app/etc": "shared:files/etc" |
| 43 | + "pub/media": "shared:files/media" |
| 44 | + "pub/static": "shared:files/static" |
| 45 | + ``` |
| 46 | +4. Deploy slugs and cluster |
| 47 | + - file systems are read-only |
| 48 | + - mounts each service in a container (web server, Elasticsearch, RabbitMQ) |
| 49 | + - mounts the read-write file system (mounted on a highly available distributed storage grid) |
| 50 | + - configures the network so services can “see” each other (and only each other) |
| 51 | +5. Deployment hooks |
| 52 | + - freeze the incoming traffic at the entry point for 60 seconds |
| 53 | + - puts the application in maintenance mode until deployment is complete |
| 54 | + - execute commands after packaging and deploying your application |
| 55 | + - runs hooks in the `deploy` section from `.magento.app.yaml` |
| 56 | + ```yaml |
| 57 | + # We run deploy hook after your application has been deployed and started. |
| 58 | + deploy: | |
| 59 | + php ./vendor/bin/ece-tools deploy |
| 60 | + ``` |
| 61 | + - deploy script uses the values defined by configuration files in the `.magento` directory, then the script deletes the directory and its contents |
| 62 | + - TODO: php ./vendor/bin/ece-tools deploy |
| 63 | +6. Post-deployment: configure routing |
| 64 | + - creates backup (BAK) files for the app/etc/env.php and the app/etc/config.php configuration files |
| 65 | + - execute commands after deploying your application and after the container begins accepting connections |
| 66 | + - runs hooks in the `post_deploy` section from `.magento.app.yaml` |
| 67 | + ```yaml |
| 68 | + # We run post deploy hook to clean and warm the cache. Available with ECE-Tools 2002.0.10. |
| 69 | + post_deploy: | |
| 70 | + php ./vendor/bin/ece-tools post-deploy |
| 71 | + ``` |
| 72 | + - TODO: php ./vendor/bin/ece-tools post-deploy |
| 73 | +
|
| 74 | +###### What role every process/phase plays and how to impact every process |
| 75 | +
|
| 76 | +###### How Magento Cloud deploys Magento. What every script does on every deployment phase |
| 77 | +
|
| 78 | +###### How to extend these scripts and best practices for doing so |
| 79 | +
|
| 80 | +###### Describe the ways to retrieve logs for phases and its scripts |
| 81 | +
|
5 | 82 | #### 5.2 Demonstrate the ability to create Magento Cloud script configurations |
| 83 | +
|
| 84 | +Documentation: |
| 85 | +- [Deployment process](https://devdocs.magento.com/guides/v2.3/cloud/reference/discover-deploy.html#cloud-deploy-over-phases) |
0 commit comments