This guide outlines how to add a new Parse application to a Datica CPaaS environment.
Variables
The following variables used in this guide should be replaced with values specific to your environment:
Variable | Description |
<env-name> | Replace with the name of your environment (e.g. "myapp-staging") |
<code-service-name> | Replace with the name of your application's code service (e.g. "parse-app") |
<app-id> | A unique ID for this Parse application. Generate this on your own. |
<master-key-uuid> | UUID secret key for this Parse database. Generate this on your own. |
<app-name> | The name of this application (no spaces). Used to set the URI path in the Parse Dashboard (e.g. https://parse.example.com/<app-name>) |
<parse-app-fqdn> | Replace with the fully qualified domain name for your parse application (e.g. "parse.example.com"). This should be different than your parse dashboard fqdn. |
Steps
1. Add a MongoDB service for data storage
Add a new MongoDB service to your environment with the following parameters:
name: <app-name>-db
Scale: 1
RAM: 1 GB
CPU: 1
Storage: 20 GB
2. Add the Parse application code service
Create a new code service with the following characteristics:
Scale: 1
Worker Scale: 0
RAM: 1 GB
CPU: 1
We advise naming your code service something relevant to your application, or something like "parse-app".
3. Configure environment variables
Use the Datica CLI to add the following environment variables to the code service you created in step 2 (refer to the Environment Variables guide for more information about adding & updating environment variables)
APP_ID=<app-id>
MASTER_KEY=<master-key-uuid>
PARSE_SERVER_APP_NAME=<app-name>
PARSE_SERVER_MOUNT_PATH=/<app-name>
SERVER_URL=https://<parse-app-fqdn>/<app-name>
Use the Datica CLI to update the following environment variables for the code service you created in step 2.
IMPORTANT: For this step, you'll need to first retrieve the current values using `datica vars list`, and then update them using `datica vars set`.
DATABASE_1_URL -- replace "/catalyze" with "/<app-name>"
DATABASE_URL -- replace "/catalyze" with "/<app-name>"
4. Initialize the code repository
mkdir ./<app-name>
git clone git@github.com:catalyzeio/stratum-parse-server.git <app-name>-parse-server
cd /path/to/<app-name>-parse-server
git remote remove origin
datica init
Follow the prompts to configure the repository. When prompted for a code service name, use the name of the code service you created in step 2 of this section.
5. Configure the Service Proxy
In order to use the Parse application, it must be exposed through the environment's service proxy. The following steps will create a new site definition and associate it with the code service you created in step 2. This example uses LetsEncrypt for TLS security.
datica -E "<env-name>" sites create <parse-app-fqdn> <code-service-name> --lets-encrypt
6. Deploy the Parse application
cd /path/to/your/<app-name>-parse-server
git push datica master
Once your code services are redeployed, you can add the application to your Parse dashboard by following our instructions for Adding a Parse application to the Parse Dashboard.