IBM Developer Advocacy

Parse on IBM Bluemix



Mike Elsmore
1/29/16

Parse has become huge in recent years, especially in the mobile app space. The whole point of Parse is to offload data storage and some other features on to a service, rather than the developer having to produce a complete backend to manage everything.

Although Parse is sunsetting, it's helping migrate people away from its platform to an alternative, self-hosted version. This version, available via npm, can be found at https://github.com/ParsePlatform/parse-server. It is a Node.js service compatible with the original data system used by Parse that was written in Go.

The team behind the open source code have been quite open with what does and doesn't work. These and other details are provided in a full migration guide https://parse.com/docs/server/guide and the in-depth README.

But the point is to not have to manage your own backend for data management, so standing up your own Parse-like server is probably exactly what you don't want to do if you have been a Parse user. Luckily, the tools exist to manage, support, and scale Parse Server within IBM Bluemix and MongoDB by Compose.io.

What can Parse Server do?

It's designed to let users or Parse clients migrate the data portion of the API to a self-hosted service. The Node.js code lets you use the existing Parse SDKs and REST API on a platform hosted by you, the developer, rather than the Parse service, owned by Facebook.

If you are running a node application that depends on Express, you can easily include this as middleware into your existing application. However, if you were relying entirely on the Parse service, or had a different backend service architecture, you have to deploy your own. To do this, you need somewhere to host a Node.js application, and MongoDB to handle storage of the data.

What to do if you need your own?

At IBM, we have ideal tools to help make this a bit easier for you. You can use IBM Bluemix to host the Node.js application, and use MongoDB on Compose.io to store your data. Both these services allow you to easily scale your application. This means your existing parse applications will be able to keep up with your needs.

We've put together a small Node.js application to act as starter code, and let you try the Parse Server. You can find the source code at https://github.com/ibm-cds-labs/parse-on-bluemix.

How to get started

  1. If you're not already signed up, create both an IBM Bluemix account and a Compose account. (Both services offer a free trial.)
  2. Clone this repo, by entering the following in your terminal
    git clone git@github.com:ibm-cds-labs/parse-on-bluemix.git
    cd parse-on-bluemix
    
  3. In your the Compose.io account, create a new MongoDB instance and save the details.

  4. Push the app to IBM Bluemix. If this is your first time deploying an app to IBM Bluemix, go checkout https://www.eu-gb.bluemix.net/docs/#starters/upload_app.html which is an excellent guide.

  5.   cf push
  6. In Bluemix, add the MongoDB instance to your application:

    1. Select ADD A SERVICE OR API
      Select "ADD A SERVICE OR API"
    2. Scroll down to Data and Analytics and select MongoDB by Compose
      Scroll down to "Data and Analytics" and select "MongoDB by Compose.io"
    3. On the bottom right of the dialog box, enter your MongoDB Credentials from Compose.io.
      Enter your MongoDB Credentials from Compose.io into the form in the bottom right.
    4. Let the app restage with the new MongoDB Credentials
  7. Add the additional Parse API Keys

    1. In the left navigation, select Environment Variables.
      Select "Environment Variables" from the left navigation
    2. Click USER-DEFINED to add the necessary variables.
      Select "USER-DEFINED" to add the necessary variables.
    3. Add your Application ID and Master Key from Parse and save.
      Add your Application ID and Master Key from Parse and save.

And that's that. You've deployed the app. All you need to do is follow the instructions in the Parse docs migration step to point your code at the new URL.

If you have any questions, feel free to ask in Stack Overflow or in the comments here. Be sure to tag your Stack Overflow questions with mongodb, compose, bluemix or parse.

Good luck and enjoy.

blog comments powered by Disqus