5.0.0 to 5.1.0
What you’ll learn
- how to upgrade Webiny from 5.0.0 to 5.1.0
danger
Before continuing, make sure to take the necessary precautions, listed in the Overview section.
#
Upgrade Webiny PackagesExecute the following command in the root of your project:
#
Update Pulumi Infrastructure CodeThe following changes apply only to the production setup of the API project application's cloud infrastructure.
info
Note that the cloud infrastructure, defined within the API project application, is defined as two different setups - development and production.
Read more about it in our Cloud Infrastructure key topic.
#
Add Missing Private Subnet for the ElasticSearch ClusterOpen your api/pulumi/prod/elasticSearch.ts
file, and on line 26, add the vpc.subnets.private[1].id
subnet to the subnetIds
array:
#
Optionally, Mark Mission Critical Resources as ProtectedIn order to prevent accidental deletions of mission critical cloud infrastructure resources, the Pulumi framework allows us to mark a resource as protected, via the protect
property.
info
Learn more about the protect
property in the official Pulumi documentation.
For the prod
setup of your API project application's cloud infrastructure, projects created with Webiny version 5.1.0
and higher, will have the following cloud infrastructure resources marked as protected:
For projects created before Webiny version 5.1.0
, these need to be added manually.
To do that, start by adding the protectedEnvironment
variable, and passing its value to DynamoDB
, Cognito
, ElasticSearch
, and FileManager
classes, in your api/pulumi/prod/index.ts:12
file:
Once you have that in place, make sure to pass the value of protectedEnvironment
to relevant cloud infrastructure resources:
- default DynamoDB table
- ElasticSearch - domain, domain policy, and special ElasticSearch-related DynamoDB table
- File Manager's S3 bucket
info
For more information and code changes, you can check the relevant pull-request.
#
Update Page Builder PluginsWe've upgraded all element plugins to support customization via factory parameters. It now also allows you to create multiple variations of the same element, with different settings.
One of the plugins was not a factory in the previous version of Webiny, and we need to change the usage of that particular plugin in your project. Simply open the file below, and add ()
to execute the grid
plugin factory:
#
Update build configsIf you're developing your custom packages, you'll soon run into ugly import paths like ../../../../../types
, etc. To avoid this, make the following changes in your project:
.babel.node.js
#
Update Replace the entire file with the following code, or only copy/paste the highlighted lines:
.babel.react.js
#
Update Replace the entire file with the following code, or only copy/paste the highlighted lines:
jest.config.base.js
:#
Update Add a moduleNameMapper
parameter to the existing config:
#
Update TS and Babel configs in existing packages (if any)In case you already have custom packages, you will also need to update their tsconfig.build.json
and tsconfig.json
files, by adding the following parameters to them:
Also update the corresponding .babelrc.js
files in your custom packages, as we now use the base babel config as a factory. We need to pass the path
parameter as some babel plugins need to know the exact root of the package.
Now you can use ~
to have nice, clean import paths in your packages, and Jest tests. ~
will always point to your packages' src
folder.
#
Deploy your projectNow you're ready to deploy your project. Run yarn webiny deploy
, or consult the guide on deployment.