Setup a Local Development Environment using Parse Server in a few minutes using Docker Compose

Fadi William Abdelmessih
4 min readDec 19, 2016
DISCLAIMER: The logos used herein remain the property of their respective owners. The listing of the logos is not intended to imply any endorsement or direct affiliation.

In this post, I’m targeting web and mobile developers who are interested in building the backend of their next web/mobile application using Parse Server. Here, I’ll walk you through the installation of the server using Docker Compose and I’ll point you to the official documentation to get started with the server.

What is Parse Server ?

Parse Server is an open source version of the Parse backend that can be deployed to any infrastructure that can run Node.js. Parse Server works with the Express web application framework. It can be added to existing web applications, or run by itself. [1]

If you want to know more information about the Parse Server. You may want to read this post.

What is Docker and Docker Compose ?

As described on their website, Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center virtual machines, or the cloud.

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration. [2]

Context

Developing a back-end for your application from scratch might take some time and you might want to prototype quickly your application. In a such case, you may find Parse Server helpful.

When the time comes to deploy your application to production. It’s worth to mention that it’s completely easy to deploy Parse Server to Microsoft Azure while relying on Azure AppService and the awesome CosmosDb. Maybe, I’ll write in the future a detailed guide on how to deploy a Parse Server on Microsoft Azure.

Setting up the Docker Toolbox

In this section, I’ll walk you through the installation of the Docker Toolbox on a Mac. The process should be similar on Windows.

  1. Go to https://www.docker.com/products/docker-toolbox and install the toolbox by following the installation workflow.
  2. Make sure that the docker-machine is running by typing “docker-machine status” in a terminal window. If the docker-machine is not running; type “docker-machine start”
  3. Now, we will need to get the ip of our docker-machine as well as we will need it in Parse’s docker compose configuration. Type “docker-machine ip” to get it. My ip was “192.168.99.100”.

Now, we are ready to set-up Parse’s docker compose configuration.

Setting up Parse’s docker compose configuration

In the section, I’m not explaining the syntax of the configuration of the “docker-compose.yml” file. You can find these information in the compose file reference.

The configuration steps are as follows:

  • Open your terminal and create a directory for your Parse’s Docker Compose configuration and change your terminal’s current location to that directory by typing the following:
$mkdir -p ~/Desktop/Docker/Parse && cd $_;
  • Load the docker-machine’s environment variables by typing the following:
$eval `docker-machine env default`
  • Create a “docker-compose.yml” file using a text-editor of your choice or by using the nano command line if you are familiar with it.
  • Paste the following content to your “docker-compose.yml” file. Please note that the following configuration is for a development Parse Server. In a production Parse Server, you will need to remove the PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1 environment variable; as the dashboard must be accessible through HTTPS. You may also need to configure your docker volumes. For more information about docker volumes, you may want to check this article.
mongo-parse-server:
image: mongo
parse-server:
image: yongjhih/parse-server
links:
- mongo-parse-server:mongo
environment:
- APP_ID=YOUR_APP
- MASTER_KEY=DA5AC2FF-8F44-4082-8E5C-A78F2A96ACAD
- FILE_KEY=1DAFE373-5D8A-4E7A-AD05-67C3BA0EDB64
ports:
- 1337:1337
parse-dashboard:
image: yongjhih/parse-dashboard
environment:
- PARSE_DASHBOARD_CONFIG={"apps":[{"appId":"YOUR_APP","serverURL":"http://192.168.99.100:1337/parse","masterKey":"DA5AC2FF-8F44-4082-8E5C-A78F2A96ACAD","appName":"YA"}],"users":[{"user":"foo","pass":"bar"}]}
- PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=1
ports:
- 4040:4040
  • Change the configuration of the environment variables of the Parse Server to reflect your own configuration.
  • Change the configuration of the PARSE_DASHBOARD_CONFIG environment variable to reflect your app configuration and don’t forget to change the user and the pass of the dashboard.
  • The value of the PARSE_DASHBOARD_CONFIG environment variable is a normal JSON Object. For readability, please find it below:
{
"apps": [
{
"appId": "YOUR_APP",
"serverURL": "http://192.168.99.100:1337/parse",
"masterKey": "DA5AC2FF-8F44-4082-8E5C-A78F2A96ACAD",
"appName": "YA"
}
],
"users": [
{
"user": "foo",
"pass": "bar"
}
]
}
  • You will need to run the configuration using the following command (from the directory that contains your “docker-compose.yml”):
$docker-compose up

This command will download the appropriate docker images and it will start the containers according to the configuration.

Conclusion

In this post, I’ve walked you through the steps of setting up a Parse Server using Docker Compose while pointing to some references that will help get more information about the Parse Server and Docker.

References

[1] “Parse Server’s Git Repo”, https://github.com/ParsePlatform/parse-server, Accessed 19th December, 2016.

[2] “Overview of Docker Compose”, https://docs.docker.com/compose/overview/, Accessed 19th December, 2016.

--

--

Fadi William Abdelmessih

I’m a Staff Software Engineer. #CloudEngineer #SoftwareEngineer #ViewsAreMyOwn