Run Parse Server on your own server using DigitalOcean
Tags: node, mongodb, javascript, digitalocean
Published: 2020-05-17 09:27:30

---
published: true
firstPublishedAt: 1454270112689
latestPublishedAt: 1458262625230
slug: run-parse-server-on-your-own-server-using-digitalocean
title: Run Parse Server on your own server using DigitalOcean
canonical_url: https://medium.com/@jcminarro/run-parse-server-on-your-own-server-using-digitalocean-b2a7d66e1205
tags: NodeJS, MongoDB, JavaScript, DigitalOcean

---

Recently Parse announced they’re [shutting down](http://blog.parse.com/announcements/moving-on/) their mobile backend as a service. If you’ve built an app on top of Parse, this is probably bad news. The good news is that they’re giving developers 12 months to find a new solution, and they’re providing a path to [running your own](http://blog.parse.com/announcements/introducing-parse-server-and-the-database-migration-tool/) Parse-compatible service. There’s a great migration guide that covers [exporting Parse data](https://parse.com/docs/server/guide) to MongoDB, and running a Parse server built on Node.js and express.

This guide is going to cover how to install all dependencies that we need to run Parse Server on own server. We are going to use [DigitalOcean](https://m.do.co/c/a67c2caf773d) to host our server, if you don’t have an account you can get one [here](https://m.do.co/c/a67c2caf773d) and **obtain \$10 for free ;)**

#### Setting Up the server

Once that we have our DigitalOcean account we need to create a new Droplet. Droplet is the name used to refer to virtual private servers (VPS) on DigitalOcean. It is very easy to create a new one, but if you have some problem you can follow [this guide](https://www.digitalocean.com/community/tutorials/how-to-create-your-first-digitalocean-droplet-virtual-server) to create one. We are going to use Ubuntu 14.04 as our Operating System.

#### Setting Up MongoDB

Parse Server use MongoDB as a DataBase. They are using MongoDB version 2.6 or 3.0.x. MongoDB is already included in Ubuntu package repositories but it is not the version that we need, then we are going to add the official MongoDB repository to install the correct version.

```
$ echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9ECBEC467F0CEB10
$ sudo aptitude update
$ sudo aptitude install mongodb-org -y
```

Ok, now we have MongoDB installed on our server, but we have to config it with a couple of parameters and need a user to access to MongoDB remotely.

The first thing that we are going to do is allow remotely connections to MongoDB. It is because we need to import Parse Data from theirs servers and Parse will be using this DB every time that an old user send information to their servers.

```
$ vi /etc/mongod.conf
```

And comment next line, To comment a line you have to put `#` at the begin of the line.

```
# bindIp: 127.0.0.1
```

Then we only have to restart mongo daemon and it will allow remote connections.

```
$ sudo service mongod restart
```

Now we are going to create a new database, new user and disable an option that Parse need. The user is going to be `parseuser` and password `password`. **You must change it.**

```
$ mongo
> use parse
> db.createUser({ user: "parseuser", pwd: "password", roles: [ { role: "userAdmin", db: "parse" } ] })
>  db.getSiblingDB('admin').runCommand( { setParameter: 1, failIndexKeyTooLong: false } )
```

To go out from `mongo shell` we have to press `ctrl+d`.
We have our MongoDB configured and we can start to import data from Parse. The Uri that Parse ask us is:

```
mongodb://parseuser:password@IP_SERVER:27017/parse
```

#### Setting Up NodeJS

Parse Server works over NodeJS 4.1 and, like MongoDB, NodeJS is already included in Ubuntu package repositories but it is not the version that we need. We are going to download and install the version that we need.

```
$ curl -sL [https://deb.nodesource.com/setup_4.x](https://deb.nodesource.com/setup_4.x) | sudo -E bash -
$ sudo aptitude install nodejs -y
$ sudo aptitude install build-essential -y
```

#### Setting Up ParseServer

Parse has released their server source code, but we have to instanciate it. I have create a project that help you to run the server. It is on [Github](https://github.com/JcMinarro/ParseServer), then you need to have `git` installed to download the project. If you have installed `git` on your server you don’t need to do next step.

```
$ sudo aptitude install git -y
```

Now we are going to download the project and configure it

```
$ git clone [https://github.com/JcMinarro/ParseServer.git](https://github.com/JcMinarro/ParseServer.git)
$ cd ParseServer
$ npm install
```

After that you need to setup a few environment variables. Open up `config/default.json` and set up the environment variables you need to run the app. You can learn more about the Parse config in the [migration guide](https://parse.com/docs/server/guide):

```
{
 “databaseURI”: “mongodb://parseuser:[password@I](mailto:12345@ds033113.mongolab.com)P_SERVER:27017/parse”,
 “cloud”: “./cloud/main.js”,
 “port”: 8080,
 “appId”: “YOUR_APP_ID”,
 “masterKey”:”YOUR_MASTER_KEY”,
 “fileKey”: “”
}
```

And then you can run it:

```
$ npm start
```

When data migration is complete you have to upload the SDK EndPoint and with your server url and will have your own Parse Server working.

P.S. Thanks for reading this far! If you found value in this, I’d really appreciate it if you recommend this post (by clicking the ❤ button) so other people can see it!.