Surviving Parse Shutdown, Exploring The Kinto Alternative (2/2)
This blog post is the second part of a 2 blog posts serie. In the first part, we've talked about Parse shutting down and going open source. We also explained how you can easily setup Parse Server on Scalingo. In this part we'll explore Kinto as an alternative.
With Parse closing down, developers are seeking alternatives to fill their needs. Of course, there is the open source Parse Server, but maybe what you need is a data storage service that can handle data synchronisation across various devices. Kinto, which positionned itself as an alternative to Parse and Firebase is here to answer this particular need and it is already being used in Firefox and FirefoxOS. Backed by Mozilla, the first version was released back in June 2015, it is currently actively developped by the community.
To read more about Kinto, the concepts and how to use it please refer to the Kinto documentation. If you are ready to test Kinto read on!
Setup Kinto on Scalingo
Kinto developers did a good job on making Kinto really easy to setup. Deploying Kinto on Scalingo is as simple as clicking on the Deploy to Scalingo button (read more about our one-click deploy solution). Just give your Kinto instance a name and you are ready to deploy it.
If you want to make change to the code of the deployed application you can git clone it. The command is git clone [email protected]:my-kinto.git where my-kinto is the app name you gave earlier. You can now make change to the cloned project such as updating it when a new version of Kinto is released. To deploy your changes just do a git push scalingo master and your app will be updated.
Interacting With Your Kinto Instance
Once deployed, your Kinto instance is immediatly accessible at for example my-kinto.scalingo.io. You can query information about your Kinto instance by doing:
$ curl -X GET https://my-kinto.scalingo.io/v1/ {"project_name":"kinto","capabilities":{},"settings":{"readonly":false,"cliquet.batch_max_requests":25,"batch_max_requests":25},"project_docs":"https://kinto.readthedocs.org/","http_api_version":"1.3","project_version":"1.11.0","url":"http://my-kinto.scalingo.io/v1/","cliquet_protocol_version":"2"}
And start to interact with it, to for example create a new bucket and list your buckets.
Surviving Parse Shutdown, Exploring The Kinto Alternative (1 / 2)
This blog post is the first part of a 2 blog posts serie. In this part, we'll talk about Parse shutting down and going open source. We'll explore Kinto in the second part.
The shutdown announcement was a surprise for all of us, thankfully the Parse team provided a migration guide and open-sourced the Parse Server. The service will stop working on January 28, 2017, so now it's time to prepare for the big change. In this post we are going to explain the steps to migrate your Parse-hosted apps to your own Parse Server instances on Scalingo.
Setup Parse Server on Scalingo
parse-server is a Parse-compatible Node.js module made for Express. It is not a stand alone solution but Parse do provide the parse-server-example app that can run out-of-the-box after a git clone.
To setup an instance of Parse Server on Scalingo 2 options are available, the automated one-click deployment and the manual way. We recommand you to use the automated solution to setup your Parse Server which is a great base project customizable in the future.
Automated One-Click Deployment
The automated solution is to use the Scalingo deployment button:
This button will deploy the official parse-server-example project which is suitable to be used for existing Parse app migration. A MongoDB instance will be provisionned automatically for you during the process.
Follow these simple steps to setup your own Parse Server:
Click on the Deploy to Scalingo button.
Give your future Parse instance a name.
Fill the APP_ID and MASTER_KEY. If you are migrating from an existing Parse app you can use the same values here. Otherwise, you can choose any string.
You are now ready to deploy the application, click on the Deploy Application button.
If you want to use the deployed application as a base to your project you can git clone it. The command is git clone [email protected]:my-parse.git where my-parse is the app name you gave earlier. You can now make change to the cloned project such as adding some Cloud Code. To deploy your changes just do a git push scalingo master and your app will be updated.
Manual setup
To follow the following steps you will need the Scalingo CLI. If you prefer using a GUI, steps 2 to 4 can be done in Scalingo Dashboard.
Clone the parse-server-example project and change directory to it.
Create an app on Scalingo: scalingo create my-parse
Add the Scalingo MongoDB addon: scalingo addons-add scalingo-mongodb free
Your are now ready to deploy your own Parse Server: git push scalingo master
Migrating from Parse to Scalingo
Once you've setup your Parse Server on Scalingo it's time to migrate your Parse-hosted app. Be sure to read the official Migrating an Existing Parse App guide first to understand the process. The following points are the big steps that must be done to successfully migrate to a Scalingo hosted Parse Server.
Migrating Client apps
To allow your client apps (iOS, Android, web, etc.) to access your own Parse Server, you'll have to change the server URL in each of your client apps to the Scalingo app URL (e.g. my-parse.scalingo.io). Instructions for each SDK are detailed in Using Parse SDKs with Parse Server.
By default, Parse Server will serve the Parse API on /parse. To change this, or if you are using older client SDKs, you can run scalingo env-set PARSE_MOUNT=/1. This command will set the environment variable PARSE_MOUNT to the value of /1.
Migrating Database
On Scalingo, databases are not publicly accessible for security reasons, so the process described in the official migration guide will not work. Instead, you'll have to manually transfer the data to your Scalingo MongoDB instance. Here are the steps:
Go to the new Parse Dashboard > App Settings > General, and click on Export Data.
Wait for the email containing the link to download exported data.
Change directory to your Parse Server project
Start a tunnel to your Scalingo MongoDB using Scalingo CLI:
$ scalingo db-tunnel SCALINGO_MONGO_URL Building tunnel to my-parse-4727.mongo.dbs.appsdeck.eu:31068 You can access your database on '127.0.0.1:10000'
Prepare downloaded files by deleting the { "results": and } that wrap the array containing your collection data.
Import each collection with the following command and change the options accordingly (--db, --collection, --file, --username, --password). To find out the password to your database you can use the commandscalingo env | grep MONGO.
By following the official Parse migration guide and this blog post you should now have a working Parse Server. As mentionned by the Parse team, the migration will not be easy for everyone, you should conduct tests to ensure your data is consistent and your Cloud Code still work. We hope by providing a quickly deployable solution on Scalingo will help you ease the transition.
An interesting Parse alternative is the Mozilla backed Kinto that we will discuss in the second blog post tomorrow.