Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 8ff6e20

Browse files
authored
Cloud: update migrate files section (#8552)
* Add the correct cli commands for migrating files * fix problems from test * Improved rsync remote to remote, added better example to cli * add remote to remote recommendation * some fixes for the notes
1 parent f0b8146 commit 8ff6e20

File tree

1 file changed

+72
-23
lines changed

1 file changed

+72
-23
lines changed

src/cloud/live/stage-prod-migrate.md

Lines changed: 72 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Previous step
1414
To migrate your database and static files to Staging and Production:
1515

1616
- [Deploy code](#code)
17-
- [Migrate static files](#cloud-live-migrate-static)
17+
- [Migrate static files](#migrate-static-files)
1818
- [Migrate the database](#cloud-live-migrate-db)
1919

2020
If you encounter errors or need to change project configuration, complete the required updates in your local environment. Then, push the code changes to the Integration environment to deploy and test before pushing to Staging and Production environments.
@@ -27,21 +27,23 @@ You can use the [Project Web Interface](#interface) or [SSH and CLI commands](#s
2727

2828
The Project Web Interface provides features to create, manage, and deploy code in Integration, Staging, and Production environments for Starter and Pro plans.
2929

30-
For Pro projects, deploy the Integration branch you created to Staging and Production:
30+
{:.procedure}
31+
For Pro projects, deploy the Integration branch to Staging and Production:
3132

3233
1. [Log in](https://accounts.magento.cloud) to your project.
3334
1. Select the Integration branch.
3435
1. Select the **Merge** option to deploy to Staging. Complete all testing.
3536
1. Select the Staging branch.
3637
1. Select the **Merge** option to deploy to Production.
3738

38-
For Starter, deploy the development branch you created to Staging and Production:
39+
{:.procedure}
40+
For Starter, deploy the development branch you created to Staging and Production (master):
3941

4042
1. [Log in](https://accounts.magento.cloud) to your project.
4143
1. Select the prepared code branch.
4244
1. Select the **Merge** option to deploy to Staging. Complete all testing.
4345
1. Select the Staging branch.
44-
1. Select the **Merge** option to deploy to Production.
46+
1. Select the **Merge** option to deploy to Master.
4547

4648
![Use the merge option to deploy]({{ site.baseurl }}/common/images/cloud/cloud_project-merge.png)
4749

@@ -54,7 +56,7 @@ You can use the [Magento Cloud CLI commands]({{ site.baseurl }}/cloud/reference/
5456
- [Build and deploy on local]({{ site.baseurl }}/cloud/live/live-sanity-check.html)
5557
- [Prepare to deploy to Staging and Production]({{ site.baseurl }}/cloud/live/stage-prod-migrate-prereq.html)
5658

57-
#### Step 1: Deploy and test the Integration environment:
59+
#### Step 1: Deploy and test the Integration environment
5860

5961
1. After logging into the project, check out the Integration environment:
6062

@@ -112,7 +114,7 @@ You can use the [Magento Cloud CLI commands]({{ site.baseurl }}/cloud/reference/
112114

113115
1. Complete site testing.
114116

115-
#### Step 3: Deploy to Production:
117+
#### Step 3: Deploy to Production
116118

117119
1. Check out, synchronize, and create a snapshot of your local Production environment.
118120

@@ -124,13 +126,63 @@ You can use the [Magento Cloud CLI commands]({{ site.baseurl }}/cloud/reference/
124126

125127
1. Complete site testing.
126128

127-
## Migrate static files {#cloud-live-migrate-static}
129+
## Migrate static files
130+
131+
[Static files](https://glossary.magento.com/static-files) are stored in `mounts`. There are two methods for migrating files from a source mount location, such as your local environment, to a destination mount location. Both methods use the `rsync` utility, but we recommend using the `magento-cloud` CLI for moving files between the local and remote environment. And we recommend using the `rsync` method when moving files from a remote source to a different remote location.
132+
133+
### Migrate files using the CLI
134+
135+
You can use the `mount:upload` and `mount:download` CLI commands to migrate files between the local and remote environment. Both commands use the `rsync` utility, but the CLI commands provide options and prompts tailored to the {{site.data.var.ece}} environment. For example, if you use the simple command with no options, the CLI prompts you to select which mount or mounts to upload or download.
136+
137+
```bash
138+
magento-cloud mount:download
139+
```
140+
141+
Sample response:
128142

129-
You migrate [static files](https://glossary.magento.com/static-files) from your `pub/media` directory to Staging or Production.
143+
```terminal
144+
Enter a number to choose a mount to download from:
145+
[0] app/etc
146+
[1] pub/static
147+
[2] var
148+
[3] pub/media
149+
[4] All mounts
150+
> 3
130151
131-
We recommend using the Linux remote synchronization and file transfer command [`rsync`](https://en.wikipedia.org/wiki/Rsync). The rsync utility uses an algorithm that minimizes the amount of data by moving only the portions of files that have changed. Rsync also supports compression.
152+
Target directory: ~/pub/media/
132153
133-
Use the following command to migrate files:
154+
Downloading files from the remote mount pub/media to pub/media
155+
156+
Are you sure you want to continue? [Y/n] Y
157+
```
158+
159+
{:.procedure}
160+
To upload files from a local `pub/media/` folder to the remote `pub/media/` folder for the current environment:
161+
162+
```bash
163+
magento-cloud mount:upload --source /path/to/project/pub/media/ --mount pub/media/
164+
```
165+
166+
Sample response:
167+
168+
```terminal
169+
Uploading files from pub/media to the remote mount pub/media
170+
171+
Are you sure you want to continue? [Y/n] Y
172+
173+
building file list ... done
174+
./
175+
sample-file.jpeg
176+
177+
sent 8.43K bytes received 48 bytes 3.39K bytes/sec
178+
total size is 154.57K speedup is 18.23
179+
```
180+
181+
Use the `--help` option for the `mount:upload` and `mount:download` commands to see more options. For example, there is a `--delete` option to remove extraneous files during the migration.
182+
183+
### Migrate files using rsync
184+
185+
Alternatively, you can use the `rsync` utility to migrate files.
134186

135187
```bash
136188
rsync -azvP <source> <destination>
@@ -139,38 +191,35 @@ rsync -azvP <source> <destination>
139191
This command uses the following options:
140192

141193
- `a`–archive
142-
- `z`–compress
194+
- `z`–compress files during the migration
143195
- `v`–verbose
144196
- `P`–partial progress
145197

146-
For additional options, see the [rsync man page](http://linux.die.net/man/1/rsync).
147-
148-
To migrate static files from your local machine, use the `rsync` command to copy the `pub/media` directory from your local Magento server to staging or production:
198+
See the [rsync man page](http://linux.die.net/man/1/rsync).
149199

150-
```bash
151-
rsync -azvP local_machine/pub/media/ <[email protected]>:pub/media/
152-
```
200+
{:.bs-callout-info}
201+
To transfer media from remote-to-remote environments directly, you must enable SSH agent forwarding, see [GitHub guidance](https://developer.github.com/v3/guides/using-ssh-agent-forwarding/).
153202

154203
{:.procedure}
155204
To migrate static files from remote-to-remote environments directly (fast approach):
156205

157-
{:.bs-callout-info}
158-
To transfer media from remote-to-remote environments directly, you must enable ssh agent forwarding, see [GitHub guidance](https://developer.github.com/v3/guides/using-ssh-agent-forwarding/).
159-
160-
1. [Open an SSH connection]({{ site.baseurl }}/cloud/env/environments-ssh.html#ssh) to the source environment.
206+
1. Use SSH to log in to the source environment. Do not use the `magento-cloud` CLI. Using the `-A` option is very important because it enables forwarding of the authentication agent connection.
161207

162-
To find the **SSH access** link in your Project Web Interface, select the environment and click **Access Site**. The syntax for the SSH command is as follows:
208+
{:.bs-callout-tip}
209+
To find the **SSH access** link in your Project Web Interface, select the environment and click **Access Site**.
163210

164211
```bash
165212
166213
```
167214

168-
1. Use the `rsync` command to copy the `pub/media` directory from your current environment to another remote environment:
215+
1. Use the `rsync` command to copy the `pub/media` directory from your source environment to a different remote environment.
169216

170217
```bash
171218
rsync -azvP pub/media/ <[email protected]>:pub/media/
172219
```
173220

221+
1. Log in to the other remote environment to verify the files migrated successfully.
222+
174223
## Migrate the database {#cloud-live-migrate-db}
175224

176225
{%include cloud/note-db-import-export-warning.md%}

0 commit comments

Comments
 (0)