There are times that when deploying your Strapi application you'll want the data and settings you developed with to be transferred to your production environment. To do this we can use Strapi's data transfer feature.
To start the data transfer we will need to log into the production environment and create a transfer token. When the token is created we will just need to run yarn strapi transfer --to :heroku-url
and paste the transfer token when prompted. You'll notice that all the data is present in your production enviroment as well as the roles you set up in development.
Instructor: [0:00] We'd like to transfer data from our Strapi local application to our Strapi production application in Heroku. When we check our Strapi application deployed on Heroku, we notice that we have zero entries in posts. However, locally, we have nine.
[0:14] We can use Strapi's data transfer feature to transfer our posts and content, settings, and configurations from our local Strapi to our deployed Strapi. To do that, we go to settings, transfer tokens, generate new transfer token.
[0:30] We'll call this "Local to remote transfer from dev environment" as the description. We'll set the token duration to 30 days, token type to full access and save. We'll copy our transfer token, as we'll not be able to see it again. In our terminal, we'll stop our Strapi application.
[0:50] We'll type yarn transfer to. Then we need to enter our Heroku URL. We'll paste our Heroku URL and click Enter. We'll paste our transfer token, press Enter, and say yes to proceed.
[1:08] We get a message saying, "The transfer has been processed successfully." When we go to our Strapi application, put our dashboard, in our content manager, we now see in our production environment all our posts from our local environment.
[1:24] When we go to settings, roles, public role, and click posts, we also see that our configuration for end user permissions has been transferred to our production also. We can go back to our dashboard.
[1:37] That is how you use the Strapi data transfer feature to transfer data from your local environment to your dev environment.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!