You can access the tutorial artifact, including the deployment script (Terraform), related source code, sample data, and instruction guidance from this GitHub project.
For more tutorials about Alibaba Cloud Database, please refer to this link.
Database Deployment Tutorials Series: https://community.alibabacloud.com/series/118
Parse is the complete application stack for building applications faster with object and file storage, user authentication, push notifications, a dashboard, and more right out of the box. Compared to Google Firebase, Parse is a bunch of pure open-source projects for application building and life cycle management.
Click this following link to read more about Firebase vs. Parse Server by Back4App.
This tutorial explains how to install and deploy Parse Server with MongoDB on Alibaba Cloud.
Deployment architecture:
If this is your first time using Terraform, please refer to this link to learn how to install and use Terraform on different operating systems.
Run the Terraform script to initialize the resources. (In this tutorial, we use MongoDB as a backend database, so ECS and MongoDB are included in the Terraform script.) Please specify the necessary information and region to deploy it.
After the Terraform script execution is finished, the ECS instance information is listed as below:
eip_ecs
: The public EIP of the ECS for the parse server hostFor the MongoDB instance information, please go to the Alibaba Cloud MongoDB web console to get the connection URI:
The username and password are root
and N1cetest
by default, which are preset in the Terraform provision script. If you've already changed it, please update accordingly.
Please replace the string ****
with N1cetest
in the connection URI string, such as:
mongodb://root:N1cetest@dds-xxxx.mongodb.rds.aliyuncs.com:3717,dds-xxxx.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-55560033
The MongoDB connection URI will be used later when deploying the web application.
Please log on to ECS with ECS EIP
. The password is N1cetest
by default, which is preset in the Terraform provision script in Step 1. If you've already changed it, please update accordingly.
ssh root@<ECS_EIP>
Execute the following commands to install Node.js. Parse Server requires Node 8 or newer. Here we install the Node 12:
wget https://npm.taobao.org/mirrors/node/v12.0.0/node-v12.0.0-linux-x64.tar.xz
tar -xvf node-v12.0.0-linux-x64.tar.xz
rm node-v12.0.0-linux-x64.tar.xz -f
mv node-v12.0.0-linux-x64/ node
ln -s ~/node/bin/node /usr/local/bin/node
ln -s ~/node/bin/npm /usr/local/bin/npm
Execute the following commands to install parse-server
:
npm install -g parse-server
ln -s ~/node/lib/node_modules/parse-server/bin/parse-server /usr/local/bin/parse-server
Execute the following commands to verify the Node modules have been installed successfully:
ll /usr/local/bin/
Then, execute the following command to start the installed parse-server
:
parse-server --appId <APP_ID> --masterKey <MASTER_KEY> --databaseURI <MONGODB_URL> &
Please replace the parameters accordingly:
<APP_ID>
: Your application ID<MASTER_KEY>
: Uour application secret key<MONGODB_URL>
: The MongoDB URL of the provisioned MongoDB instance in Step 1
.For example, execute the command like this:
parse-server --appId my_application_id --masterKey 12345678 --databaseURI mongodb://root:N1cetest@dds-3ns6f7171a6961441.mongodb.rds.aliyuncs.com:3717,dds-3ns6f7171a6961442.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-56568439 &
Now, the parse-server
is running and listening the service port 1337
. The service API URL is http://<ECS_EIP>:1337/parse
.
The parse-server
is ready for serving the application now. You can go to Step 4
to verify and interact with parse-server
directly. However, we highly recommend installing parse-dashboard
for administration and application monitoring on parse-server
.
For more information about parse-dashboard
, please visit https://github.com/parse-community/parse-dashboard.
Now, execute the following commands to install parse-dashboard
:
npm install -g parse-dashboard
ln -s ~/node/lib/node_modules/parse-dashboard/bin/parse-dashboard /usr/local/bin/parse-dashboard
ll /usr/local/bin/
Then, execute the following commands to create a configuration file to start the dashboard of the previous application started on parse-server
:
cd ~/node/lib/node_modules/parse-dashboard/bin
vim parse-dashboard.json
Input the following content into the file parse-dashboard.json
. Please remember to:
<ECS_EIP>
with the provisioned ECS EIP in Step 1
<APP_ID>
with your application ID used when starting parse-server
in Step 2
<MASTER_KEY>
with your application secret key used when starting parse-server
in Step 2
We preset the user name and password as admin
and admin
for parse-dashboard
log on. You can change it accordingly.
{
"apps": [
{
"serverURL": "http://<ECS_EIP>:1337/parse",
"appId": "<APP_ID>",
"masterKey": "<MASTER_KEY>",
"appName": "MyApp",
"supportedPushLocales": ["en", "ru", "fr"]
}
],
"users": [
{
"user":"admin",
"pass":"admin"
}
]
}
Then, execute the following command to start the parse-dashboard
:
parse-dashboard --dev --config parse-dashboard.json &
Now, the parse-dashboard
has been started. Please visit http://<ECS_EIP>:4040
.
Log on to see the dashboard of the application:
Now, the parse-server
and parse-dashboard
are ready. Let's post some data to simulate the interaction with the parse-server
.
Please execute the following commands on ECS and check the response. Please remember to replace the my_application_id
with the defined application ID when starting the parse-server
.
curl -X POST \
-H "X-Parse-Application-Id: my_application_id" \
-H "Content-Type: application/json" \
-d '{"score":100,"playerName":"Sean Plott","cheatMode":false}' \
http://localhost:1337/parse/classes/GameScore
curl -X POST \
-H "X-Parse-Application-Id: my_application_id" \
-H "Content-Type: application/json" \
-d '{"score":120,"playerName":"Sean Plott","cheatMode":false}' \
http://localhost:1337/parse/classes/GameScore
curl -X POST \
-H "X-Parse-Application-Id: my_application_id" \
-H "Content-Type: application/json" \
-d '{"score":999,"playerName":"Julian","cheatMode":true}' \
http://localhost:1337/parse/classes/GameScore
curl -X GET \
-H "X-Parse-Application-Id: my_application_id" \
http://localhost:1337/parse/classes/GameScore
Go to the parse-dashboard
and refresh the web page to see the posted application data:
Creating a Web Game Map App Using Leaflet, PostgreSQL/PostGIS, and Redis on Alibaba Cloud
Alibaba Clouder - January 4, 2019
Alibaba Clouder - December 29, 2020
ApsaraDB - February 9, 2022
Alibaba Clouder - June 13, 2018
Alibaba Clouder - November 14, 2017
Alibaba Clouder - March 11, 2020
A secure, reliable, and elastically scalable cloud database service for automatic monitoring, backup, and recovery by time point
Learn MoreRespond to sudden traffic spikes and minimize response time with Server Load Balancer
Learn MoreLeverage cloud-native database solutions dedicated for FinTech.
Learn MoreCloud-based and lightweight servers that are easy to set up and manage
Learn MoreMore Posts by ApsaraDB