Skip to content

Commit

Permalink
Add warning when transfering data using nginx (#1616)
Browse files Browse the repository at this point in the history
* Add warning when transfering data using nginx

* Rephrase caution callout

---------

Co-authored-by: Pierre Wizla <[email protected]>
  • Loading branch information
christiancp100 and pwizla authored Mar 22, 2023
1 parent 93e7302 commit 9527d63
Showing 1 changed file with 37 additions and 17 deletions.
54 changes: 37 additions & 17 deletions docusaurus/docs/dev-docs/data-management/transfer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ description: Transfer data using the Strapi CLI
displayed_sidebar: devDocsSidebar
canonicalUrl: https://docs.strapi.io/dev-docs/data-management/transfer.html
---

# Data transfer <BetaBadge />

The `strapi transfer` command streams your data from one Strapi instance to another Strapi instance. The `transfer` command uses strict schema matching, meaning your two Strapi instances need to be exact copies of each other except for the contained data. The default `transfer` command transfers your content (entities and relations), files (assets), project configuration, and schemas. The command allows you to transfer data:
Expand Down Expand Up @@ -38,6 +39,25 @@ Either `--to` or `--from` is required.
Data transfers are authorized by transfer tokens, which are [managed from the admin panel](/user-docs/settings/managing-global-settings#managing-transfer-tokens). From the admin panel, you can manage role-based permissions to tokens including `view`, `create`, `read`, `regenerate` and `delete`.
:::

:::warning
When using nginx and a server that proxies requests into a localhost, issues might occur. To prevent them, ensure all the headers are forwarded correctly by changing the configuration file in `/etc/nginx/sites-available/yourdomain` as follows:

```
server {
listen 80;
server_name <yourdomain>;
location / {
proxy_pass http://localhost:1337;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
include proxy_params;
}
}
```

:::

## Generate a transfer token

:::prerequisites
Expand Down Expand Up @@ -138,7 +158,7 @@ yarn strapi transfer --to https://example.com/admin --to-token my-transfer-token
<TabItem value="npm" label="npm">

```bash
npm run strapi transfer -- --to https://example.com/admin --to-token my-transfer-token --force
npm run strapi transfer -- --to https://example.com/admin --to-token my-transfer-token --force
```

</TabItem>
Expand All @@ -147,7 +167,7 @@ npm run strapi transfer -- --to https://example.com/admin --to-token my-transfer

## Include only specified data types during transfer

The default `strapi transfer` command transfers your content (entities and relations), files (assets), project configuration, and schemas. The `--only` option allows you to transfer only the listed items by passing a comma-separated string with no spaces between the types. The available values are `content`, `files`, and `config`. Schemas are always transferred, as schema matching is used for `strapi transfer`.
The default `strapi transfer` command transfers your content (entities and relations), files (assets), project configuration, and schemas. The `--only` option allows you to transfer only the listed items by passing a comma-separated string with no spaces between the types. The available values are `content`, `files`, and `config`. Schemas are always transferred, as schema matching is used for `strapi transfer`.

### Example: only transfer files

Expand Down Expand Up @@ -219,30 +239,30 @@ The `transfer` command is not intended for transferring data between two local i
1. Create a new Strapi project using the installation command:
```bash
npx create-strapi-app@latest <project-name> --quickstart
```
```bash
npx create-strapi-app@latest <project-name> --quickstart
```
2. Create at least 1 content type in the project. See the [Quick Start Guide](/dev-docs/quick-start) if you need instructions on creating your first content type.
:::caution
Do not add any data to your project at this step.
:::
:::caution
Do not add any data to your project at this step.
:::
3. Commit the project to a git repository:
```bash
git init
git add .
git commit -m "first commit"
```
```bash
git init
git add .
git commit -m "first commit"
```
4. Clone the project repository:
```bash
cd .. # move to the parent directory
git clone <path to created git repository>.git/ <new-instance-name>
```
```bash
cd .. # move to the parent directory
git clone <path to created git repository>.git/ <new-instance-name>
```
### Add data to the first Strapi instance
Expand Down

1 comment on commit 9527d63

@vercel
Copy link

@vercel vercel bot commented on 9527d63 Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

documentation – ./

documentation-strapijs.vercel.app
documentation-git-main-strapijs.vercel.app
docs-vercel-v4.strapi.io

Please sign in to comment.