Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88f8c85

Browse files
shiftedrealitySteve Johnson
authored and
Steve Johnson
committed
[Falcons][Deployment] Move var/di var/generate to git checkin-able directory (magento#569)
* MAGETWO-62708: Documentation * MAGETWO-62708: Documentation
1 parent eadbc64 commit 88f8c85

16 files changed

+1408
-20
lines changed

guides/v2.2/cloud/discover-deploy.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

guides/v2.2/cloud/discover-deploy.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
layout: default
3+
group: cloud
4+
subgroup: 01_welcome
5+
title: Deployment process
6+
menu_title: Deployment process
7+
menu_order: 4
8+
menu_node:
9+
version: 2.2
10+
github_link: cloud/discover-deploy.md
11+
---
12+
13+
Deploying Magento means simply pushing the source code to your Git repository. The Git repository is part of your projects cluster so it is totally isolated from
14+
other clients.
15+
16+
The built-in Git repository is at the same time "just a normal Git repository" and a very smart piece of software. When you push to it, it will parse the configuration files you committed to your repository so it knows what it needs to deploy.
17+
18+
If you are pushing directly to the Magento Enterprise Cloud Edition Git repository, you will see in your terminal
19+
what is happening in real-time. The same information is going to get streamed in real-time to the Web Interface.
20+
21+
## GitHub and Bitbucket {#cloud-deploy-over-gh}
22+
If you are using external Bitbucket or GitHub repositories, the log
23+
of the operations does not display in the GitHub session. You can still follow what's happening in their interface and in the Magento Enterprise Cloud Edition's Web Interface.
24+
25+
## Project configuration {#cloud-deploy-conf}
26+
What makes it all work is a set of YAML configuration files located in the project root directory. These files define your Magento installation and describe its dependencies. Configuration files specify, for
27+
example, that Magento uses MySQL, some PHP extensions, and Elasticsearch. (These are referred to as *services*.)
28+
29+
## Five phases of deployment {#cloud-deploy-over-phases}
30+
Deployment consists of the following phases:
31+
32+
1. [Phase 1: Configuration validation and code retrieval](#cloud-deploy-over-phases-conf)
33+
2. [Phase 2: Build](#cloud-deploy-over-phases-build)
34+
3. [Phase 3: Prepare slug](#cloud-deploy-over-phases-slug)
35+
4. [Phase 4: Deploy slugs and cluster](#cloud-deploy-over-phases-slugclus)
36+
5. [Phase 5: Deployment hooks](#cloud-deploy-over-phases-hook)
37+
6. [Post-deployment: configure routing](#cloud-deploy-over-phases-route)
38+
39+
### Phase 1: Configuration validation and code retrieval {#cloud-deploy-over-phases-conf}
40+
The remote server gets your code using Git. When you initially set up a project from a template, we retrieve the code from the [the Magento ECE template](https://github.com/magento/magento-cloud){:target="_blank"}.
41+
42+
The built-in Git server checks what you are pushing: if you have a syntax error in a configuration file, our Git server refuses the push.
43+
44+
Suppose you had a single MySQL database in your cluster and now you want two of those, or maybe you want to add an Elasticsearch instance. The built-in Git server detects this and verifies that the topology of your cluster is modified to your new needs.
45+
46+
This phase also runs `composer install` to retrieve dependencies.
47+
48+
### Phase 2: Build {#cloud-deploy-over-phases-build}
49+
We build only what has changed since the last build. This is one of the things that
50+
make Magento Enterprise Cloud Edition so fast in deployment.
51+
52+
Magento Enterprise Cloud Edition builds the codebase. It runs hooks in the `build` section of `.magento.app.yaml`.
53+
54+
The default Magento build hook is a CLI command called `magento-cloud:build`. It does the following:
55+
56+
* Applies patches located in vendor/magento/magento-cloud-configuration/patches, as well as optional project-specific patches in m2-hotfixes
57+
* Enables all modules
58+
* Regenerates code and the dependency injection configuration (that is, the Magento `generated/code` and `generated/metadata` directories) using `bin/magento setup:di:compile`.
59+
60+
It is important to note that at this point the cluster has not been
61+
created yet. So you should not try to connect to a database or imagine
62+
anything was daemonized.
63+
64+
But also know that once the application has been built it is going to be
65+
mounted on a read-only file system (you will be able to configure specific
66+
mount points that are going to be read/write).
67+
68+
This means you cannot FTP to the server and add modules. Instead, you must add code to your git repo and run `git push`, which builds and deploys the environment.
69+
70+
### Phase 3: Prepare the slug {#cloud-deploy-over-phases-slug}
71+
The result of the build phase is a read-only file system we refer to as a *slug*. In this phase, we create an archive and put it in permanent storage. The next time
72+
you push code, if a service did not change, you can use a slug from the archive.
73+
74+
It also means that reverting a deployment is basically
75+
instantaneous.
76+
77+
### Phase 4: Deploy slugs and cluster {#cloud-deploy-over-phases-slugclus}
78+
Now we provision your applications and all the backend services you
79+
need:
80+
81+
* Mounts each service in its own container
82+
* Mounts the read-write file system is mounted on a highly available distributed storage grid
83+
* Configures the network so Magento's services can "see" each other (and only each other)
84+
85+
<div class="bs-callout bs-callout-info" id="info">
86+
<p>The main file system is <em>read-only</em>. This
87+
is what guarantees we can do deterministic deployments. The read-only file system also dramatically improves your site's security because no process can write to the file system.</p>
88+
</div>
89+
90+
### Phase 5: Deployment hooks {#cloud-deploy-over-phases-hook}
91+
The last step runs a deployment script. You can use this for example to anonymize data in development environments, clear caches, ping external continuous integration tools, and so on.
92+
93+
When this script runs, you have access to all the services in your environment (Redis, database, and so on).
94+
95+
There are two default deploy hooks. One is `pre-deploy.php`, which does some necessary cleanup and retrieval of
96+
resources that were generated in the build hook. The second is `bin/magento magento-cloud:deploy`, which does the following
97+
98+
* If Magento is not installed, it installs Magento with `bin/magento setup:install`, updates the deployment configuration, `app/etc/env.php`, and the database for your specified environment (for example, Redis and website URLs).
99+
100+
* If Magento is installed, performs any necessary upgrades.
101+
102+
The deployment script runs [`bin/magento setup:upgrade`]({{ page.baseurl }}install-gde/install/cli/install-cli-subcommands-db-upgr.html) to update the database schema and data (which is necessary after extension or core code updates), and also updates the [deployment configuration]({{ page.baseurl }}config-guide/config/config-php.html), `app/etc/env.php`, and the database for your environment.
103+
104+
Finally, the deployment script and clears the Magento cache.
105+
106+
* Sets the mode to either [`developer`]({{ page.baseurl}}config-guide/bootstrap/magento-modes.html#mode-developer}}) or [`production`]({{ page.baseurl}}config-guide/bootstrap/magento-modes.html#mode-production) based on the environment variable [`APPLICATION_MODE`]({{ page.baseurl }}cloud/env/environment-vars_magento.html).
107+
108+
In `production` mode, the script optionally generates static web content using the command
109+
[`magento setup:static-content:deploy`]({{ page.baseurl }}config-guide/cli/config-cli-subcommands-static-view.html).
110+
111+
<div class="bs-callout bs-callout-info" id="info">
112+
<p>Our deploy script uses the values defined by configuration files in the <code>.magento</code> directory, then the script deletes the directory and its contents. Your local development environment isn't affected.</p>
113+
</div>
114+
115+
### Post-deployment: configure routing {#cloud-deploy-over-phases-route}
116+
While the deployment is running, we freeze the incoming traffic at the entry point
117+
for 60 seconds. We are now ready to configure routing so your
118+
web traffic will arrive at your newly created cluster.
119+
120+
#### Related topics
121+
* [Get started with a project]({{page.baseurl}}cloud/project/project-start.html)
122+
* [Get started with an environment]({{page.baseurl}}cloud/env/environments-start.html)
123+
* [`.magento.app.yaml`]({{page.baseurl}}cloud/project/project-conf-files_magento-app.html)
124+
* [`routes.yaml`]({{page.baseurl}}cloud/project/project-conf-files_routes.html)
125+
* [`services.yaml`]({{page.baseurl}}cloud/project/project-conf-files_services.html)

guides/v2.2/comp-mgr/cli/cli-upgrade.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
layout: default
3+
group: compman
4+
subgroup: 28_cli-upgr
5+
title: Command-line upgrade
6+
menu_title: Command-line upgrade
7+
menu_node: parent
8+
menu_order: 1
9+
version: 2.2
10+
github_link: comp-mgr/cli/cli-upgrade.md
11+
---
12+
13+
## Command-line upgrade
14+
You can upgrade Magento from the command line if you installed the software using any of the following:
15+
16+
* Downloaded the metapackage using `composer create-project`
17+
* Installed the compressed archive
18+
19+
<div class="bs-callout bs-callout-info" id="info">
20+
<ul><li>If you cloned the Magento 2 GitHub repository, you <em>cannot</em> use this method to upgrade; instead, see <a href="{{page.baseurl}}install-gde/install/cli/dev_update-magento.html">Update the Magento application</a>.</li>
21+
<li>If you configured Magento use use <code>pub</code> as its root directory, see the next section.</li>
22+
<li>If you're upgrading to Magento 2.1 (including a Release Candidate) from Magento 2.0.7 or earlier <em>and</em> you installed sample data, see <a href="{{page.baseurl}}comp-mgr/cli/cli-rc1-samp.html">Command-line upgrade to Magento 2.1 with sample data</a> instead of this topic.</li></ul>
23+
</div>
24+
25+
<div class="bs-callout bs-callout-warning">
26+
<ul><li>If you're upgrading to version 2.1, see <a href="{{ page.baseurl }}release-notes/tech_bull_21-upgrade.html">Upgrade to Magento version 2.1 (June 22, 2016)</a>.</li>
27+
<li>If you're upgrading from Magento CE or EE 2.0.0 or 2.0.1, you must first perform the tasks discussed in the <a href="{{page.baseurl}}release-notes/tech_bull_201-upgrade.html">Technical Bulletin (1/28/16)</a>.</li></ul>
28+
</div>
29+
30+
## Prerequisite: `pub` directory root {#upgrade-cli-pub}
31+
This section applies to you *only* if you set the Magento root directory to `<your Magento install dir>/pub`. If you did not do this, skip this section and continue with the next section.
32+
33+
{% collapsible If you use pub as your Magento root directory: %}
34+
35+
* For the upgrade, create another subdomain or docroot that uses the Magento installation directory as its root.
36+
37+
Run the [System Upgrade utility]({{page.baseurl}}comp-mgr/upgrader/upgrade-start.html) using that subdomain.
38+
* Use the [following procedure](#upgrade-cli-upgr) to upgrade Magento using the command line.
39+
40+
{% endcollapsible %}
41+
42+
## Put your store in maintenance mode {#upgrade-cli-maint}
43+
To prevent access to your store while it's being upgraded, put your store in maintenance mode.
44+
45+
<div class="bs-callout bs-callout-info" id="info">
46+
<p>You can optionally create a <a href="{{page.baseurl}}comp-mgr/trouble/cman/maint-mode.html">custom maintenance mode page</a>.</p>
47+
</div>
48+
49+
{% collapsible To enable maintenance mode: %}
50+
51+
1. Log in to your Magento server as, or switch to, the Magento file system owner.
52+
2. Enter the following command:
53+
54+
php <your Magento install dir>/bin/magento maintenance:enable
55+
56+
For additional options, see [Enable or disable maintenance mode]({{page.baseurl}}install-gde/install/cli/install-cli-subcommands-maint.html).
57+
58+
{% endcollapsible %}
59+
60+
## Upgrade using the command line {#upgrade-cli-upgr}
61+
62+
{% collapsible To upgrade using the command line: %}
63+
64+
1. Log in to your Magento server as, or switch to, the Magento file system owner.
65+
2. Change to the directory in which you installed the Magento software.
66+
67+
For example, `cd /var/www/html/magento2`
68+
2. Enter the following commands in the order shown:
69+
70+
composer require <product> <version> --no-update
71+
composer update
72+
73+
For example, to upgrade to Magento CE version 2.0.11, enter:
74+
75+
composer require magento/product-community-edition 2.0.11 --no-update
76+
composer update
77+
78+
To upgrade to Magento EE version 2.0.11, enter:
79+
80+
composer require magento/product-enterprise-edition 2.0.11 --no-update
81+
composer update
82+
83+
<div class="bs-callout bs-callout-info" id="info">
84+
<p>If an error displays about a missing <code>.gitignore</code> files, see the <a href="{{page.baseurl}}release-notes/tech_bull_201-upgrade.html#resolution2">Technical Bulletin (1/28/16)</a>.</p>
85+
</div>
86+
87+
3. If prompted, enter your [authentication keys]({{page.baseurl}}comp-mgr/prereq/prereq_auth-token.html).
88+
4. Manually clear `var` subdirectories:
89+
90+
rm -rf <Magento install dir>/var/cache/*
91+
rm -rf <Magento install dir>/var/page_cache/*
92+
rm -rf <Magento install dir>/generated/code/*
93+
4. Update the database schema and data:
94+
95+
php bin/magento setup:upgrade
96+
5. Restart Varnish if you use it for page caching.
97+
98+
service varnish restart
99+
6. Access your storefront.
100+
101+
The following error might display:
102+
103+
We're sorry, an error has occurred while generating this email.
104+
105+
If so, perform the following tasks:
106+
107+
1. Reset [file system ownership and permissions]({{page.baseurl}}install-gde/prereq/file-system-perms.html) as a user with `root` privileges.
108+
2. Clear the following directories and try again:
109+
110+
<your Magento install dir>/var/cache
111+
<your Magento install dir>/var/page_cache
112+
<your Magento install dir>/generated/code
113+
114+
{% endcollapsible %}

guides/v2.2/comp-mgr/extens-man/extensman-new-purchase.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ layout: 0 -> 1
7171
[2016-07-28 15:22:17 UTC] Job "setup:upgrade []" has started
7272
Cache cleared successfully
7373
File system cleanup:
74-
/var/www/html/magento2/var/generation/Composer
75-
/var/www/html/magento2/var/generation/Magento
76-
/var/www/html/magento2/var/generation/Symfony
77-
The directory '/var/www/html/magento2/var/di/' doesn't exist - skipping cleanup
74+
/var/www/html/magento2/generated/code/Composer
75+
/var/www/html/magento2/generated/code/Magento
76+
/var/www/html/magento2/generated/code/Symfony
77+
The directory '/var/www/html/magento2/generated/metadata/' doesn't exist - skipping cleanup
7878
/var/www/html/magento2/pub/static/_requirejs
7979
/var/www/html/magento2/pub/static/adminhtml
8080
/var/www/html/magento2/var/view_preprocessed/source

guides/v2.2/comp-mgr/upgrader/upgrade.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
layout: default
3+
group: compman
4+
subgroup: 32_UseUpgrade
5+
title: Step 4. Upgrade
6+
menu_title: Step 4. Upgrade
7+
menu_node:
8+
menu_order: 20
9+
version: 2.2
10+
github_link: comp-mgr/upgrader/upgrade.md
11+
---
12+
13+
The components you're upgrading display. The following figure shows an example.
14+
15+
<img src="{{ site.baseurl }}common/images/upgr_upgrade.png" width="550px" alt="Click upgrade to complete the task">
16+
17+
18+
To complete the upgrade, click **Upgrade**. If the upgrade is successful, a page similar to the following displays.
19+
20+
<img src="{{ site.baseurl }}common/images/upgr_success.png" width="350px" alt="Your upgrade was successful">
21+
22+
Messages similar to the following display in the Console Log:
23+
24+
{% collapsible Click to view the Console Log %}
25+
26+
<img src="{{ site.baseurl }}common/images/upgrade-success-consolelog.png" width="650px">
27+
28+
{% endcollapsible %}
29+
30+
## Manually clear directories
31+
After the upgrade completes, manually clear `var` subdirectories:
32+
33+
rm -rf <Magento install dir>/var/cache/*
34+
rm -rf <Magento install dir>/var/page_cache/*
35+
rm -rf <Magento install dir>/generated/code/*
36+
37+
## Restart Varnish
38+
After the upgrade completes, restart Varnish if you use it for page caching.
39+
40+
service varnish restart
41+
42+
Then access your storefront and verify everything is working properly.
43+
44+
## Errors after upgrade
45+
After you finish your upgrade, errors might display.
46+
47+
* On the main storefront page, the following error might display.
48+
49+
We're sorry, an error has occurred while generating this email.
50+
* On a category page, the following error might display:
51+
52+
We can't find products matching the selection.
53+
54+
If any of the preceding errors display, perform all of the following tasks.
55+
56+
{% include install/sampledata/file-sys-perms-digest.md %}
57+
58+
### Clear `var` and `generated` directories
59+
Clear the `var/cache`, `var/page_cache`, `generated/code`
60+
61+
A sample command follows:
62+
63+
rm -rf var/cache/* var/page_cache/* generated/code/*
64+
65+
### Access your storefront again
66+
After performing the preceding tasks, access your storefront again. If necessary, press Control+R to force the page to reload.

guides/v2.2/config-guide/cache/caching-database.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)