Using Azure, we will want to first create the networks that we will be provisioning, as well as configure the traffic between them in a way that keeps our database deployments secure. Conceptually, we will be configuring our deployment to reflect the diagram below.
The specifications we recommend for running MongoDB on Azure will exceed the core quota restrictions imposed by Microsoft on their Azure free trial subscription. To provision machines suitable for migrating Parse to a performant system, consider purchasing a paid Azure subscription.
parse-server
and mdb-parse
) and configure inbound rules for each one as per the diagrams below.
- Note that 54.85.224.0/20
corresponds to the public IP range of the Parse migration servers. Allowing traffic from this address space is required for the Parse migration process.
Under mongo-resource-group > Settings > Subnets associate your two subnets with the appropriate network security groups as below.
You have now configured your virtual network and created two subnets into which we will be provisioning our servers with Azure.
During this stage, you will provision Microsoft Azure instances to run your database processes. To help you best size your deployment, we have created a sizing chart. To use the worksheet, first get your Data Storage, and Data Transfer Rate per month from the Parse dashboard.
Choose the cell in the sizing chart that matches your usage profile. Note this down, as we will use it later in the instructions to determine which machine to provision. All sizes in this chart correspond to the size of the premium storage disk to be attached to your VM.
Low Data Transfer Rate | High Data Transfer Rate | |
Parse Data Storage < 4GB | DS3, 128GB | DS4, 512GB |
Parse Data Storage > 4GB | DS3, 512GB | DS4, 512GB |
mdb-subnet
as configured in the previous stage of the guide.
8. ssh
into your newly provisioned Azure instance using the username and password provided during creation.
9. Initialize the disk on your VM
sudo fdisk /dev/sdc
# when prompted enter 'n' for new partition
# then enter 'p' for primary
# then enter '1' for 1st partition
# then enter '' for default first sector
# then enter '' for default last sector
# then enter 'p' to review new partition
# then enter 'w' to finalize and write your changes
sudo mkfs -t ext4 /dev/sdc1 # note partition number appended to device id
11. Create the data directory and mount the premium storage disk there.
sudo mkdir /data
sudo mount /dev/sdc1 /data
Use sudo -i blkid
to determine the UUID associated with your device
Modify /etc/fstab
to automatically mount disk on reboot.
sudo sed -i -e "\$aUUID=<SDC1-UUID> /data ext4 defaults 1 2" /etc/fstab
sudo umount /data
sudo mount /data
Generate SSL Certificates
For a secure deployment, one should enable TLS/SSL for traffic between the MongoDB database and the application server, as well as for traffic between the members of a MongoDB replica set.
For development purposes, you can configure a local certificate authority and generate your own certificates with openssl for the hosts provisioned by Cloud Manager.
Self-signed certificates, however, are still vulnerable to man-in-the-middle attacks and secure deployments should use an SSL/TLS certificate from a trusted Certificate Authority.
/data
directory to the mongodb user on all virtual machines to allow automation to provision correctlysudo chown mongodb:mongodb /data
mongodb://testuser:testpass@<HOSTNAME-0>:27017,<HOSTNAME-1>:27017,<HOSTNAME-2>:27017/parse?replicaSet=mongodb-rs&ssl=true
More detailed information on the connection string format can be found in the MongoDB documentation.
ssh
into newly provisioned machine and install Node.JS and git.curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y git
git clone https://github.com/ParsePlatform/parse-server.git
# configure environment variables and run.
export PARSE_SERVER_DATABASE_URI='<MONGO-CONNECTION-STRING>'
export PARSE_SERVER_APPLICATION_ID='<APP-ID>'
export PARSE_SERVER_MASTER_KEY='<MASTER-KEY>'
npm install
npm start
curl
to test that everything is functioning properly.curl -X POST \
-H "X-Parse-Application-Id: ${MY_PARSE_APP_ID}" \
-H "X-Parse-Master-Key: ${MY_PARSE_MASTER_KEY}" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
http://<PARSE-SERVER-PUBLIC-IP>:1337/parse/classes/GameScore
curl -X GET \
-H "X-Parse-Application-Id: ${MY_PARSE_APP_ID}" \
-H "X-Parse-Master-Key: ${MY_PARSE_MASTER_KEY}" \
http://<PARSE-SERVER-PUBLIC-IP>:1337/parse/classes/GameScore
Please use your standard application tests to ensure all functionality works on your new, open source Parse infrastructure. The open source parse-server package does not cover the complete feature set offered by Parse, and your application may not function exactly the same as before. The Parse migration guide has more details on the differences between Parse and parse-server in "Section 8 - Compatibility Issues". We urge users to read these sections carefully and test their apps thoroughly before moving forward with a full migration. If you are interested in getting help with this process, or learning more about your options for running your own MongoDB deployment, our professional services team is here to speak with you.
Go to the new Parse dashboard, navigate to App Settings and click on Migrate to external database.
Provide the MongoDB connection string which we constructed earlier, but replace the internally resolvable hostnames with publicly resolvable IP addresses as below. Ensure that the database pointed to by your connection string is empty.
mongodb://testuser:testpass@<HOST-IP-0>:27017,<HOST-IP-1>:27017,<HOST-IP-2>:27017/parse?replicaSet=mongodb-rs&ssl=true