So I am at the place where I lost all of my Strapi data after moving from local to remote host and deploying my Strapi through herokuapp.com
I am using Strapi in my personal NEXT.JS project.
Luckily my Strapi database wasn't so huge and all content-types were kept so I was able to recreate the database quite quick. Also this was just a personal project.
I am wondering though, if I decide to push Strapi to use in in more professional context and in real project – how do I move from local development to deployment without loosing all data?
Is there a way to export everything before deployment and then import it into the deployed CMS or how does this work?
Also – what if I want to do it the other way around? I will keep working on my app using my Strapi on Heroku but at some point I will want to replicate the CMS locally. Where is the data stored and how do it get access to it?
From docs: "Strapi does not currently provide any tools for migrating or deploying your data changes between different environments (ie. from development to production). With the exception being the Content-Manager settings"
And there is no export/import content for now.
To export your data for example from the local environment to the production you have to handle:
content-types - Strapi store this stuff at files so version control will help
database data - you have to make database backup manually and then import data at the production server
static files - if you use Srapi to handle the static files you probably will have to copy them manually and import them to the production server or use version control for it (bad option). They are stored at app/public/uploads
I didn't tried this myself but it looks like a pretty tough task.
Conclusion: if it's OK for you to migrate only your content types, just put a git on your Strapi folder
You can do it via the CLI now, new from version 4.6.
Strapi supports export, import, and transfer.
To create a tar of your data:
npm run strapi export --file my-strapi-export
To import data into your project:
npm run strapi import -f export_file.tar.gz
There are more options in the docs:
https://docs.strapi.io/developer-docs/latest/developer-resources/data-management.html#export-data-using-the-cli-tool
With the new data export & import system, you can backup & restore
your Strapi project data without acting manually and directly into the
database.
More info: https://strapi.io/blog/announcing-strapi-v4.6
Keep in mind Heroku is in the middle of shutting down its free tier, so using another provider like railway.app or render.com might be a good idea.
Anyway: As Eugene already mentioned in his answer there are 3 types of data that might have to transmitted (content types, the actual database, and files).
After your first deployment to Heroku you should end up with all content types being there, but with an empty database and no files.
Following this guide you will create an own database while setting up your project where you can now either export and import your database from your local development environment (which you would have to do manually) or put in new data by hand. Sometimes this is even better since development environments tend to include a lot of "Lorem Ipsum" content for testing purposes.
Future deployments should not reset your database though but keep your data from that environment.
Finally there are the files which I would recommend to store on Cloudinary since it's free, and Strapi offers an easy-to-use plugin for it. Just create a free account on Cloudinary, install the plugin in your Strapi project, and set your ENV variables for your production environment within Heroku.
I found this
Apparently they recently did a plugin tutorial that had to do with this issue. There is a plugin called strapi-plugin-import-export-content on git hub that might be able to help your issue.
git hub link
Related
i have got a problem, which i am trying to find a solution for weeks now.
I think it´s an understanding error on my side, but i couldn't figure it out.
What i am trying to do:
Develop, not deploy, a react app on an Apache2 server.
I know that react is an frontend library, so it should be possible to do.
I also know that nodeJs is kinda required to "npm" all the packages and to create the "Simple" react app..
What i want also to do:
Use the MATERIAL-UI
Build a PHP Backend
Collaborate with my Team Members (they should also work on the react app)
Thanks in advance.
Hosting a ReactJS App is no different than hosting any other javascript code on any type of server - by having it as a static file on your web server and including it in the html returned from the server.
Depending on the way your React project is set up, you would:
use node to build a javascript bundle of your react app (possibly by running "npm run build" in any CLI),
include the resulting script file or files in the head element of your root or master template
Make the Apache web server return the needed page with the master template where the script tag is
Additional setup could include starting the PHP server and react development build at the same time, but that is highly specific on your setup and would require you to add some more information on used frameworks and setup.
It is not possible to deploy apps with Apache and React. The nodejs based- Webpack server is incompatible with Apache web server. You'll have to pick one server or another, you can not route index.html -> index.tsx and vice versa. Besides if you ever got both servers working in tandem with SSL, it's a technically security nightmare and has no production value. It's best to avoid java(script) all together as it's merit in real software development has greatly diminished. Mostly for gold diggers.
We have no clue about deployment of a react app that is currently running with strapi and a mongoDB.
The Problem is that me and my colleague can't see each others changes in the DB without importing the data files manually everytime.
We would like to be able to access the Strapi CMS from our server and store all the data in a shared DB. That way the customer does not need to open the code whenever he wants to change something.
We would like to avoid heroku and aws and deploy it on our own server.
Where should we start?
ps. We are Frontend guys!
For the database, you can use MongoDB Atlas.
Like this, you can have one database (hosted) for your development environment.
Here how to start with Strapi + MongoDB Atlas - https://strapi.io/documentation/3.0.0-beta.x/guides/databases.html#mongodb-installation
I'm currently trying to make a turn-based game for a class project using gameboard.io. My biggest issue is I don't know how to set up my folder structure with react and MongoDB as its a new technology I've been using.
I've tried a couple of different things but every time I try to use mongoDB I get loads of errors and files missing/not connecting and I'm sure my folder structure is broken.
Can anyone help me with an outline for a folder structure using those technologies? I know this isn't a typical question but I've been struggling with this. Any help would be appreciated, thank you.
Normally mongoDB runs on the back-end. Your front-end application would interact with mongo through an api. If you want to use a node.js powered back-end server application, express is a popular choice, but there are many others ( koa, hapi, Meteor, ...to name a few).
Then install mongoDB on (not the npm package but the server application, the npm package is the mongoDB driver that you use in your application to connect to the database, you will find instructions on mongoDB's website), I would also recommend installing mongoose, it's an object data modeling library.
If I where you, start with installing express, and work on communicating with express from your react app. Then install mongo/mongoose, and give it a try.
I try to setup a deployment workflow, but I am completely new to it. I consider to use Git and Bamboo and in this whole thing I am stuck with the database.
Let's say I want to make changes on a CMS website and keep my files versioned on git (bitbucket), I understand how to setup Bamboo that it can SCP the files to my webserver, but I don't get it how I can get the database into this whole system? Are there any tools I am missing?
What I want:
I want to be able to checkout my website files from the gitserver, make changes and send them back to the gitserver and this (via Bamboo) should push the files to the live or testserver.
But even after searching for hours, I don't get a smooth way how to handle the database (getting it local, making changes and pushing it to the server via git) or any other smooth way.
I know there are tools to quickly dump the db for WordPress sites, but for other CMS there are no such tools.
Any advice how to do this right?
Is there a way to export the data on my AppEngine database to the development server (for testing purposes etc.) ?
Yes! Check out Google's "Uploading and Downloading Data"
If you'd like to test how your data
works with the app before uploading
it, you can load it into the
development server. Use the --url
option to point the tool at the
development server URL. For example:
appcfg.py upload_data --config_file=album_loader.py --filename=album_data.csv --kind=Album --url=http://localhost:8080/remote_api <app-directory>
The subsection on uploading and downloading all data is also worth looking at.
Not yet it seems
Of course you can go pulling the data yourself, one batch at a time...
Yes we can download all data from google app engine and can upload to datastore but sometimes uploading data to local development server is painfull because of errors. App Engine SDK versioning diffrences occurs this like problems. For example i developed an app 1 year ago. Today, i want update it. I downloaded all data from Google App Engine real servers. But i can't upload its to local development server. You know, we using EntityLoader class for this operation. Entity Class importing db module, but SDK throws, "no module named by db".
I suggest for App Engine lovers that; save your first test data for future. Don't think that i will download all datum for testing future. Save your own test data with Sqlite support. And save your deveopment enviromenment version for future. SDK Version updating sometimes causing painfully times for developers