Parse Migration Guide .. As Parse is shutting down !

If your app is not using the Parse backend then you dont need to worry, but if your app is, then it is time to plan migration from Parse as the service shuts down by the year end. We have carefully drafted this parse migration guide with step by step process, which will tell you exactly what to do if you are in a fix.
We have carefully drafted this parse migration guide with step by step process, which will tell you exactly what to do if you are in a fix.
First of all the happy news is that Parse has released a database migration tool. With this service you can migrate data from your Parse app to any other MongoDB database. During this migration, the Parse API will continue to operate as usual depending on your new database, so this happens without any downtime.
Second, Parse has released the open source Parse Server. This will let you run majority of the Parse APIs from your own Node.js server. Once you have your data in your own database, Parse Server allows you to keep your application running without major changes in the client-side code. So, now let’s get into the details of Parse migration with our ultimate parse migration guide.
Special Thanks to Hector Remos on whose inputs this parse migration guide is based. https://github.com/ParsePlatform/parse-server/wiki/Migrating-an-Existing-Parse-App
The Parse Migration Guide :
Migrating an existing Parse app involved 2 steps
1.Data migrated to a self-hosted MongoDB
2.Setting up the self-hosted Parse Server and then releasing a new app pointing to it
Data migrated to a self-hosted MongoDB
To get started with Parse migration, you will need to migrate data to self hosted MongoDB. Here, you need to use Heroku and either mLab or ObjectRocket.
What is Heroku?
It’s a cloud Platform-as-a-Service which supports several programming languages. It allows to build and deploy web apps in new ways.
What is mLab?
mLab hosts MongoDB in 25 datacenters around the world!
What is ObjectRocket?
The ObjectRocket platform is built for speed, scalability and safety. It provides fully managed instances of Elasticsearch, Redis and MongoDB in data centers across the world.
You can also opt to use any infrastructure provider that supports Node.js environments.
Current Scenario:
Client gets connected to Database hosted on Parse with Parse API.
Transferring Database :
Here, you will have to transfer all your database from Parse Hosted DB to Self Hosted MongoDB. Then you will have to point your Parse API to new Self Hosted MongoDB. This allows Client to interact with New Self Hosted MongoDB via Parse API.
To do this :
Set up a MongoDB instance that conforms to Parse database specifications. If this is your first time with setting up a production MongoDB instance, we will recommend to use either mLab or ObjectRocket. These database as a service firms provide fully managed MongoDB instances, and can also help you scale up as per the requirement. You need to Take care of following things while setup MongoDB instance in a parse migration process.
1.Size your MongoDB at least 10x. Due to data being compressed in the hosted Parse database, you need to size your Mongo at least 10X the amount of data storage you are using currently.
2.Set failIndexKeyTooLong=false Because MongoDB don’t allow index keys that are larger than 1024 bytes. If a write operation attempts to store a value which is greater than 1024 bytes in size to a field that has been indexed, it can result in an error. Due to the way that Parse dynamically indexes collections based on query traffic, Parse have indexed some fields with values greater than 1024 bytes. In order to avoid random write errors from occurring, we configured “failIndexKeyTooLong=false” on Parse databases, and accept the write even if the field is indexed. Because of this, data with fields larger than 1024 bytes will appear as “missing” based on which index is selected by the MongoDB query planner.Users which are migrating their data will only need to configure failIndexKeyTooLong parameter if they have indexed fields greater than 1024 bytes in size and have collections more than 1 million docs. For apps which are smaller, Parse will automatically clean up offending indexes during the parse migration. Larger apps should follow this procedure. You need to configure failIndexKeyTooLong back to true after the parse migration is completed.
3.Latency between Parse and self-hosted MongoDB should not be more than 20ms. Our Recommendation will be to choose either mLab or ObjectRocket for your hosted MongoDB because they have datacenters based in the US East geographic region.
4.If you are planning to host your production database in a different geographic region, do so after first migrating your data into the self-hosted MongoDB and out of Parse, in US East.
5.To minimize latency, plan to host your Parse Server in the same geographic region
6.Once MongoDB is set up, note the Mongo connection URL. Use the database migration tool for transfering your data (you can find it in the new Parse.com Dashboard under App Settings →General → Migrate to external database). Make sure that the user in the connection string has admin privileges, because the migration tool will be setting some parameters automatically during the process.
7.Snapshot: The database migration tool will first take a snapshot of your existing data and then transfers it to your Mongo database.
8.Sync Next, it will pause to allow manual verification, while continuing to keep things in sync with writes that are coming in from your live app. While you are at this stage, your app will continue to read and write from your Parse hosted database.
9.Now, Connect to your Mongo instance and browse through the collections in the new database created. Check the collection counts and do a few spot checks to make sure that your data was migrated successfully.
10.You may stop the migration and try again as many times as you need to (until the time you click on Finalize). The tool will keep things in sync for up to 24 hours after the parse migration started. Once you’re satisfied with the database migration, you can finalize the transfer in the migration UI and now your app is now using the new MongoDB instance. Here, your app is hitting api.parse.com, but it is using your MongoDB instance. You need to administer over your database instance by yourself, including maintaining indexes and scaling up.
11.You can elect to skip migrating your data and test the functionality of your Parse Server hosted app with blank database. You can also migrate your data sometimes later.
Setting up local environment
To create Local Parse Server :
Now, you have to setup local Parse Server that will communicate between Development Client and Self Hosted MongoDB.
Go to the Security & Keys section of App Settings in Parse.com Dashboard and take note of the Master Key, File Key, JavaScript Key, Client Key, and dotNETKey values. Pass it into the Parse Server constructor in index.js. Make sure saving an object and retrieving it via a query works:

curl -X POST \
  -H “X-Parse-Application-Id: YOUR_APP_ID” \
  -H “Content-Type: application/json” \
  -d ‘{“score”:1337,”playerName”:”Sean Plott”,”cheatMode”:false}’ \
  http://localhost:1337/parse/classes/GameScore

curl -X GET \
  -H “X-Parse-Application-Id: YOUR_APP_ID” \
  -H “X-Parse-Master-Key: YOUR_APP_MASTER_KEY” \
  http://localhost:1337/parse/classes/GameScore

You now have a Parse Server running locally that is connected to the data in MongoDB.
To create Local Development Client:
i.Make sure you have at least Node 4.3. node –version
ii.Clone this (https://github.com/ParsePlatform/parse-server-example) repo and change directory to it.
iii.Install npm
iv.Install Mongo locally : http://docs.mongodb.org/master/tutorial/install-mongodb-on-os-x/
v.Run mongo to connect to your database, to make sure it’s working. Once you see a mongo prompt, exit with Ctrl-D
vi.Run the server with: npm start
vii.By default it will use a path of /parse for the API routes. To change the default path, or to use older client SDKs, run export PARSE_MOUNT=/1 before launching the server.
viii.Now, you have a database named “dev” that contains your Parse data
ix.Install ngrok and test with devices
For more Parse server on Heroku, AWS, Azure, Scalingo check the link: https://github.com/ParsePlatform/parse-server-example
Deployment :
Now you need to deploy the Production Parse Server to an infrastructure. Then point  the Development Client to this Production Parse Server which will communicate with Self Hosted MongoDB.

For deploying Parse Server to Heroku check this link
https://github.com/ParsePlatform/parse-server/wiki#deploying-to-heroku-and-mLab

For deploying Parse Server to NodeChef check this link
https://nodechef.com/blog/post/6/migrate-from-parse-to-nodechef%E2%80%99s-managed-parse-server

For deploying Parse Server to AWS check this link
http://mobile.awsblog.com/post/TxCD57GZLM2JR/How-to-set-up-Parse-Server-on-AWS-using-AWS-Elastic-Beanstalk

For deploying Parse Server to Digital Ocean check this link
https://www.digitalocean.com/community/tutorials/how-to-run-parse-server-on-ubuntu-14-04

For deploying Parse Server to Google Cloud Platform check this link
https://cloud.google.com/nodejs/resources/frameworks/parse-server

For deploying Parse Server to Microsoft Azure check this link
https://azure.microsoft.com/en-us/blog/azure-welcomes-parse-developers/

For deploying Parse Server to any other infrastructure provider check this link
https://github.com/ParsePlatform/parse-server/wiki#community-links

Pointing New App :
Now instead of Development Client point New Client (Your App) to the deployed Production Parse Server.
As a next step, test Your App pointed to Self hosted MongoDB with Parse API which is deployed on your choice of platform which is using your new backend.
Finally, Ask users to use your new app because on January 28, 2017, any calls to the hosted Parse backend service (api.parse.com) will result in call off of its function.
We are sure if you follow this Parse Migration Guide, you will successfully get to your objective at the end.
Thanks to all the online buddies and technical guys at mindbowser for sharing valuable inputs to shape this parse migration guide.
Still if you think it is too difficult or you need a technical hand, contact us and we will help you out. You can fill the form below. Start early because it is unavoidable and any delay puts you in the danger of losing your app.

Your Name (required)

Your Email (required)

Related Post

Comments

Leave a Comment