Cloud Installation

Install API

Setup Git repository

Using the command line, navigate to the folder ~/Nearme-X.X.X/api

Initialize a new repository.

git init

Add all the files to the repository.

git add .

Commit the changes made to the repository.

git commit -m "Initial commit"

Go to GitHub, and create a new repository.

Github - New repository

Enter a repository name, choose Private and click Create repository.

Github - Create repository

Copy the repo URL and add the remote:

~/Nearme-X.X.X/api > git remote add origin https://github.com/user/nearme-api

Push the code to the repo

git push -u origin master

Replace user with your github username.

App Platform

Setup Database

Go to DigitalOcean, and click on Databases > Create a Database Cluster

Sign up using our referral link to get $100 USD credit.

App Platform - Create database cluster

Choose MongoDB as the database engine.

The basic plan ($15/mo) is good starting point. You can upgrade later to a machine with more resources, if it’s needed.

App Platform - Create database cluster

Choose a datacenter. Ideally, the location should be close to where your users are.

App Platform - Create database cluster

Enter a database name and click Create a Database Cluster.

App Platform - Create database cluster

Once the database is up and running, click Users & Databases. Add a new user nearme and a new database nearme.

App Platform - Create database cluster

Go back to Overview, and follow these steps:

  1. Select the option Connection string
  2. Select the user nearme
  3. Select the database nearme
  4. Click Copy
  5. Download CA Certificate

Copy the file ca-certificate.crt to ~/Nearme-X.X.X/api/, and add the database certificate to the repository.

git add ca-certificate.crt
git commit -m "Add database certificate"
git push origin master

Also, save a copy of the connection string somewhere safe. We will need it later.

App Platform - Create database cluster

Setup App

Go to DigitalOcean, and click on Apps > Launch Your App

App Platform - Launch app

Choose GitHub as the source. Select the repo and click Next.

App Platform - Choose source

Under Environment variables, click Edit.

App Platform - Environment variables

The following variables are required:

  • NODE_ENV
  • PUBLIC_SERVER_URL
  • LOG_LEVEL
  • APP_ID
  • MASTER_KEY
  • READ_ONLY_MASTER_KEY
  • DATABASE_URL
  • DB_PATH_CERTIFICATE
  • APP_NAME
  • MAX_REQUEST_SIZE

App Platform - Environment variables

Notes:

  • Use the connection string as the value of the DATABASE_URL variable.
  • Visit random.org to generate the APP_ID, MASTER_KEY, and READ_ONLY_MASTER_KEY.
  • Set the PUBLIC_SERVER_URL with your own domain, or use the one provided by DigitalOcean (see next step).

Click Next. In the following screen, type the web service name, select a Region, and click Next again.

If you don’t have a domain name yet, you could use the starter domain as the PUBLIC_SERVER_URL

App Platform - Environment variables

Choose the Basic plan (you can change it later), and click Launch Basic App.

App Platform - Environment variables

It will take several minutes to build the dependencies and deploy the final code.

App Platform - Environment variables

Once it’s done, if you get a similar output, the deployment ended well!

App Platform - Environment variables

To use a custom domain, click Settings > Add Domain

App Platform - Environment variables

Depending in your situation, choose the option more suitable for you. In our case, we have our domain hosted on another provider. So we need to create a CNAME record as instructed.

App Platform - Environment variables

The example below shows how to add the CNAME record on Netlify. This step should be similar using others domain providers.

App Platform - Environment variables

Create Super Admin user

If everything went well, navigate to your app domain (ex.: https://cloud.yourdomain.com), and fill out the form to create the Super Admin.

The Parse Dashboard login page should appear. Go here to see which variables are needed to access to this tool.

Setup File Storage

Go to Spaces, and click Create a Space.

App Platform - Environment variables

Select a Region and type a unique name for the Space.

App Platform - Environment variables

Go to API and under Spaces access keys, click Generate New Key.

App Platform - Environment variables

Type a name for the access key.

App Platform - Environment variables

Once the key is created, it will display the access and private key.

App Platform - Environment variables

Go back to Spaces, click Settings and take note of your Space URL and Space endpoint.

App Platform - Environment variables

Navigate to Apps, select your app and click Settings. Select the component, and under Environment variables, click Edit.

App Platform - Environment variables

Add the following variables:

  • SPACES_ENDPOINT
  • SPACES_BUCKET_NAME
  • SPACES_BASE_URL
  • SPACES_REGION
  • SPACES_ACCESS_KEY
  • SPACES_SECRET_KEY

App Platform - Environment variables

Go ahead and try to add a new category or place with at least one image. If the configuration is correct, you should see the images listed in the Spaces section.

App Platform - Environment variables

There are other variables that should be set:

  • CUSTOM_LANG
  • PARSE_DASHBOARD_USER
  • PARSE_DASHBOARD_PASS
  • PARSE_DASHBOARD_USER_READ_ONLY
  • PARSE_DASHBOARD_PASS_READ_ONLY
  • STRIPE_SECRET_KEY
  • STRIPE_WEBHOOK_SECRET
  • MAILGUN_API_KEY
  • MAILGUN_DOMAIN
  • MAILGUN_HOST
  • MAILGUN_FROM_ADDRESS
  • MAILGUN_PUBLIC_LINK
  • GOOGLE_MAPS_API_KEY
  • PUSH_ANDROID_SENDER_ID
  • PUSH_ANDROID_API_KEY
  • PUSH_IOS_BUNDLE_ID

Click here to learn how to setup these variables. The only difference is that the variables should be added following the same steps described in this page.

Install Admin Portal

The steps to install the admin portal are pretty much the same as the instructions above.

  1. Go to the Nearme-X.X.X/admin folder, initialize a new repo and push all the code to a Github.

  2. Visit DigitalOcean and click on Apps > Launch your App.

  3. Choose GitHub as the source. Select the repo and click Next.

  4. Under Type, choose Static site and click Next.

  5. Enter your static site name and click Next.

  6. Choose a plan and click Launch App.

It will take several minutes to build the dependencies and deploy the final code. Once the Deployed successfully! message appears, navigate to the app domain (app_name.ondigitalocean.app), and you should see the Admin Portal login page. Here, enter your Super Admin credentials, and that’s it!.