App Migration
CLI Migration
13 min
migrate your parse app to back4app using cli introduction in this guide, you will learn how to migrate your parse app to back4app using the migration cli the migration process consists of transferring the database, cloud functions, and files from your current parse app to a back4app app the cli migration tool will help you with the database and files migration it will pick a copy of your database (a dump file) and restore the data in your back4app app then will pick your files from a local folder and upload them to back4app s3 bucket the cloud code migration is not covered for this cli migration tool but you can use the back4app cli https //www back4app com/docs/platform/parse cli (other cli) to migrate them or do it manually using the dashboard prerequisites to begin with this tutorial, you will need a dump of your parse app in your own machine node js (>=8 0) https //nodejs org/en/ and npm 1 install our cli tool first of all, it’s necessary to install @back4app/m2b4a @back4app/m2b4a on your machine as described below 2 start the parse app migration you will now migrate your database go to your current parse app and download a copy of your database then go to the folder that contains your dump files and run 3 access your account you can sign up or log in to your account and choose if you want to save your session then, the next time you use this tool you won’t need to put your account credentials again 4 choose a back4app app you can migrate your parse app to an existing app or a new one if you decide to use an existing app, be careful, it’s possible to decide if you’ll overwrite the existing data or just insert new objects for new apps, you must set a name and press enter enter 5 restore your data once you’re already in the folder where your dump files are, you just need to press enter enter 6 migrate your parse files in case you have parse files, browse in the folder where your files are, and press enter enter to continue the files will be automatically associated with your parse objects otherwise, just type n n to skip this step and start the restoration process here’s what the end of the migration will look like never share these credentials to anyone you can add collaborators in your project and they can get these keys here 7 test your cloud code check this guide https //www back4app com/docs/platform/parse cli to learn how to deploy your cloud code files here are some pieces of information you must know 1 back4app uses 2 main folders public/ public/ to public files, like html, css, etc , and cloud/ cloud/ to private cloud code 2 inside cloud/ cloud/ back4app import 2 files one named app js app js for your custom api (app get(‘/my custom api’) for ex ) and main js main js for parse cloud functions and jobs 3 very important! app app (the express js instance) and parse parse variables are global do not install them on your package json or require them in your cloud code 4 do not use require('express') require('express') or require('parse/node') require('parse/node') , just use app and parse variables 8 connect your current api to your new database at back4app once you finished all app tests, it’s time to point your current parse server to use the back4app database you have two possibilities here the first is to point the parse server to the back4app database and then make an incremental database restore (as described in step 5 ) the second is to turn off your parse server, make a complete database restore, and then turn it on again, pointing to the back4app database our suggestion here is the first step, which will avoid downtime to your app to proceed with the first option, copy your back4app connection string at server settings > settings > core settings > connection string and paste it into your old parse app settings now you need to make a new dump of your data and restore them in your application (step 5) , but, instead of creating a new app, choose yes, i want to update one of them! yes, i want to update one of them! and no! only insert new ids no! only insert new ids , afterward it will help to prevent data inconsistency for your users after concluding this step, your users will be using the back4app database instead of the old one 9 updating your frontend now, you need to update your front end to connect to the back4app app you can get your app id, keys, and api address in the core settings section at server settings > settings > core settings update your frontend/app connection (pointing to back4app now) and release a new application version to your users now you have a new app pointing to the back4app api and database and an old app pointing to the previous parse api but using the back4app database 10 finishing the process we recommend only turning off your old parse api when most of your users are using the new app version (pointing to back4app api) once you turn off the old api, users who use the old version will lose access to the backend it’s done! now you know how to migrate your parse app to the back4app using the cli in case you need any help or a link doesn’t work, please contact our team! https //www back4app com/support