From 609519696ecf3d9adfd56bc668f19ff6754af017 Mon Sep 17 00:00:00 2001 From: Shaun Brown Date: Wed, 27 Apr 2022 07:10:44 +0200 Subject: [PATCH 1/2] updated migration guide to match template. --- .../v4/migration-guide-4.0.x-to-4.1.8.md | 43 ++++++++++++++++--- .../v4/snippets/Rebuild-and-start-snippet.md | 2 +- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md b/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md index de8845519e..7a0688c6a5 100644 --- a/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md +++ b/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md @@ -8,14 +8,47 @@ canonicalUrl: https://docs.strapi.io/developer-docs/latest/update-migration-guid The Strapi v4.0.x to v4.1.8 migration guide upgrades versions of v4.0.6 through v4.1.7 to v4.1.8. The minimum configuration for `config/admin` now includes the API token `API_TOKEN_SALT`. Strapi no longer populates default values for the admin JWT in `config/admin`. Initial values are generated and stored in the .env file during project creation. Strapi no longer passes secrets to non-development environments, requiring users to set the secrets purposefully. The migration to v4.1.8 consists of 4 steps: +- upgrading the application dependencies - adding the API token to `config/admin`, - removing the default `ADMIN_JWT_SECRET` (recommended for improved security), - configuring `JWT_SECRET` in `config/plugins` (recommended), - setting secrets for non-development environments. -## Modifying the `config/admin` file +## Upgrading the application dependencies to 4.1.8 -Strapi, by default, creates the environmental variable `API_TOKEN_SALT` and populates a unique value, stored in `/.env` at project creation. In order to update `config/admin`: +:::prerequisites +Stop the server before starting the upgrade. +::: + +1. Upgrade all of the Strapi packages in the `package.json` to `4.1.8`: + +```jsx +// path: package.json + +{ + // ... + "dependencies": { + "@strapi/strapi": "4.1.8", + "@strapi/plugin-users-permissions": "4.1.8", + "@strapi/plugin-i18n": "4.1.8", + "better-sqlite3": "7.4.6" + // ... + } +} + +``` + +2. Save the edited `package.json` file. + +3. Run either `yarn` or `npm install` to install the new version. + +::: tip +If the operation doesn't work, try removing your `yarn.lock` or `package-lock.json`. If that doesn't help, remove the `node_modules` folder as well and try again. +::: + +## Fixing the breaking changes + +1. Modify the `config/admin` file. Strapi, by default, creates the environmental variable `API_TOKEN_SALT` and populates a unique value, stored in `/.env` at project creation. In order to update `config/admin`: - add the apiToken object, - remove the comma and default value from the `ADMIN_JWT_SECRET` parenthetical. @@ -62,9 +95,7 @@ export default ({ env }) => ({ -## Configuring `JWT_SECRET` - -`JWT_SECRET` is used by the Users and Permissions plugin, and populated in `/.env`. The property should be stored in `config/plugins.js` (or `config/plugins.ts` for a TypeScript project). The `plugins` file is not created by default in a Strapi application. If the file does not exist, users should create the file and add the follow code snippet. +2. Configure`JWT_SECRET`. `JWT_SECRET` is used by the Users and Permissions plugin, and populated in `/.env`. The property should be stored in `config/plugins.js` (or `config/plugins.ts` for a TypeScript project). The `plugins` file is not created by default in a Strapi application. If the file does not exist, users should create the file and add the follow code snippet. @@ -124,3 +155,5 @@ There are multiple methods to generate secrets, such as running `openssl rand -b The [Hosting Provider Guides](/developer-docs/latest/setup-deployment-guides/deployment.html#hosting-provider-guides.md) are being updated to reflect these changes. Community contributions updating the hosting guides are encouraged. ::: + +!!!include(developer-docs/latest/update-migration-guides/migration-guides/v4/snippets/Rebuild-and-start-snippet.md)!!! \ No newline at end of file diff --git a/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/snippets/Rebuild-and-start-snippet.md b/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/snippets/Rebuild-and-start-snippet.md index f9aefa5644..40ebdd0800 100644 --- a/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/snippets/Rebuild-and-start-snippet.md +++ b/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/snippets/Rebuild-and-start-snippet.md @@ -1,4 +1,4 @@ -### Reinitializing the application +## Reinitializing the application Rebuild the administration panel and start the application: From c232bcdbeaf37f83009385b40910464b6cda3379 Mon Sep 17 00:00:00 2001 From: Shaun Brown <97027841+StrapiShaun@users.noreply.github.com> Date: Wed, 27 Apr 2022 10:58:37 +0200 Subject: [PATCH 2/2] Update docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md Co-authored-by: Pierre Wizla --- .../migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md b/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md index 7a0688c6a5..ce59305d4c 100644 --- a/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md +++ b/docs/developer-docs/latest/update-migration-guides/migration-guides/v4/migration-guide-4.0.x-to-4.1.8.md @@ -95,7 +95,7 @@ export default ({ env }) => ({ -2. Configure`JWT_SECRET`. `JWT_SECRET` is used by the Users and Permissions plugin, and populated in `/.env`. The property should be stored in `config/plugins.js` (or `config/plugins.ts` for a TypeScript project). The `plugins` file is not created by default in a Strapi application. If the file does not exist, users should create the file and add the follow code snippet. +2. Configure`JWT_SECRET`. `JWT_SECRET` is used by the Users and Permissions plugin, and populated in `/.env`. The property should be stored in `config/plugins.js` (or `config/plugins.ts` for a TypeScript project). The `plugins` file is not created by default in a Strapi application. If the file does not exist, users should create the file and add the following code snippet.