Skip to content

Instantly share code, notes, and snippets.

@hassy
Last active January 17, 2024 04:11
Show Gist options
  • Save hassy/48bae515c393e9214d3f to your computer and use it in GitHub Desktop.
Save hassy/48bae515c393e9214d3f to your computer and use it in GitHub Desktop.
Deploying Parse Server on AWS (WIP)

Deploying Parse Server on AWS

Note: this is a work-in-progress and will be updated with more information over the next few days.

Intro

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! 💥

Set up a local Node.js environment

First, we'll set up a local Node.js dev environment. Skip this if you have one set up already.

Install Node.js

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

Install Mongodb

brew install mongodb

(On Linux: install Mongo with your distro's package manager)

Run Parse Server locally

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.

Set up Elastic Beanstalk

Once we have the server running locally, let's deploy it to the cloud.

Get an AWS account

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

Install the CLI

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)

Configure Elastic Beanstalk

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 events
  • eb logs to see the logs

Deploy the Parse Server with Elastic Beanstalk

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. 👌

Next Steps

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 [email protected]

@mitchellporter
Copy link

@nitrag thank you for doing this and keeping us updated.

@goldendousa
Copy link

i got the same error by @otto1020

@sainathg1245
Copy link

i had deployed my parse server to aws, it was successful but when i hit my server it is saying "DNS server could not be found (URL : http://testingParseServer.elasticbeanstalk.com/parse)
screen shot 2016-04-05 at 11 07 08 am
"

@kalitas
Copy link

kalitas commented Oct 20, 2016

what should I use in the server url key ? (local host is working good but after deploy to aws i need to put my server url, but is there an option to put a general key like: "serverURL": "http://localhost:1337/parse" || "process.myurl/parse" ?
ar dashboardApps = new ParseDashboard({
"apps": [
{
"serverURL": "http://localhost:1337/parse",
"appId": "",
"masterKey": "",
"appName": "",
"javascriptKey": "",
"restKey": "",
"production": false
}
]
});

@kaanselhep
Copy link

@kalitas I think serverUrl should be something like: https://api.parse.com/1
instead of localhost.

Copy link

ghost commented Dec 28, 2016

am getting several errors in my parse-php-sdk ,mainly in Parse/ParseQuery.php ,after migration,aws elastic bean setup and everything,u hv any idea why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment