Note: this is a work-in-progress and will be updated with more information over the next few days.
This guide will walk you through deploying your own instance of the open-source Parse Server. This would be a good starting point for testing your existing application to see if the functionality provided by the server is enough for your application, and to potentially plan your migration off the Parse Platform.
This guide will walk you through using Elastic Beanstalk (EB), which is an AWS service similar to Heroku. Why use EB rather than Heroku? Elastic Beanstalk does not lock you into Heroku-specific ways of doing things, is likely cheaper to run your backend on than Heroku, and it integrates with other services that AWS offer (and they offer almost everything one needs to run an application these days).
Why AWS? It's an enterprise-grade cloud platform which is miles ahead of competitors when it comes to features, price, and support. IMO if you're not using Heroku (good for when you don't want to manage anything) or bare metal (good for when you want to manage everything), you should be on AWS.
This guide presumes you are using Mac or Linux. Let's get this set up! 💥
First, we'll set up a local Node.js dev environment. Skip this if you have one set up already.
I recommend using nvm
to install Node.js. It's an easy way to install Node and to manage multiple versions of it on the same machine. Install nvm
with:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
And then install Node.js v4 with:
nvm install 4
brew install mongodb
(On Linux: install Mongo with your distro's package manager)
Clone parse-server-example, which is a barebones example of running the Parse Server with Express.
git clone https://github.com/hassy/parse-server-example
Install dependencies and start the server with:
cd parse-server-example
npm install
npm start
Open http://localhost:1337
in your browser to verify that it's running.
Once we have the server running locally, let's deploy it to the cloud.
Sign up for an AWS account if you don't have one at https://aws.amazon.com/free
We will need an Access Key Id and a Secret Access Key - you can create them in the AWS Dashboard as described in http://docs.aws.amazon.com/general/latest/gr/getting-aws-sec-creds.html
First, we need to install Elastic Beanstalk command-line tools (EB CLI):
Install with Homebrew on a Mac:
brew install awsebcli
Or with pip
on Linux:
pip install awsebcli
(This command should be all you need - however if you're having troubles, refer to the official installation guide: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html)
In the directory where you have cloned parse-server-example
, run:
eb init
This will ask you a few questions to get set up. The important ones are:
- Access Key Id and a Secret Access Key set up in the dashboard (as above)
- Geographical region closest to you
Node.js
specified as the environment we want
Once the init process is completed, we will create an EB environment for our deployment with:
eb create
At this stage, we can accept the default values for everything and just Enter
through the questions.
To check that everything has been set up properly, run:
eb status
If we see "Green" in the output, we're good. ✅
To see what's happening with EB itself and our application we'd use:
eb events
to see a log of EB eventseb logs
to see the logs
We're ready to get something running in the cloud now. Deploy the application with:
eb use my-parse-server-dev # specify the default environment
eb deploy
Once that completes, check that the application is running with:
eb open
And you should see the message from the server in your browser.
You'll notice that we haven't configured Mongo to be used by the server deployed to Elastic Beanstalk. The easiest option is to use compose.io - provision a trial database from them and add the Mongo URL to index.js
in parse-server-example
and redeploy. 👌
This guide is enough to set up a minimalistic deployment. There's a lot more to a real production deployment, e.g.:
- managing your server's configuration for different environments
- setting up a production-like dev and staging environment
- monitoring and alerting
- configuring TLS - critical for production applications 🔑
- setting up DNS with Route53
- hooking up push notifications with AWS Push Notification Service
- multi-region setup for speed (important for applications with users in mulitple geographies) and resiliency
- performance and scale testing of your backend (important for popular applications)
- keeping Parse Server up-to-date (it's likely to be actively updated by the community to develop missing features)
I intend to cover these topics over the course of the next few weeks. Follow me @hveldstra for updates. Feel free to @-message me with any questions you have too. You can also email me on h@veldstra.org
i got the same error by @otto1020