Skip to main content

Deploy to production

Heroku

When hosting your server on Heroku you need make sure to:

Next login or sign-up for Heroku and configure your app:

Create a new app from the top menu and set your app name and preferred region where the server is hosted:

Deploy your by connecting via Github or using the Heroku CLI. This will import your code to heroku and will automatically rebuild your app when changes are pushed to your repo.

As a final step you need to set your environment variables.

Navigate to "Settings" and reveal the keys. Here you can paste all the variables from your .env file. Make sure that these variables are production-ready (no references to localhost, and different database that used in local development)

info

Make sure to update SERVER_URL in the config vars to the deployed url on Heroku. This looks something like moralis-demo.herokuapp.com/server. Also make sure to set this same serverUrl in your frontend.

Google App Engine

Prerequisites

Deployment

Be aware!

If your Google Cloud free trial has ended, the following process could resort to expenses.

Replace the environment variables values in app.yaml with your own:

Open the terminal, make sure you're in the root folder and run:

gcloud app deploy

Choose your region:

Type Y to continue:

After a couple minutes the application is deployed:

Now run the following command to see it on the browser:

gcloud app browse

Add /server to the URL and you'll be accessing your Moralis Parse Server hosted on Google App Engine:

Deployment successful

AWS Elastic Beanstalk

Prerequisites

Manual deployment

Coming soon!

One-click deployment

caution

Be aware that this process could resort to expenses as Elastic Beanstalk is not part of AWS Free Tier.

Click here to deploy automatically

And follow the instructions below:

Scroll down leaving all the other settings as default and choose Upload your code:

Public S3 URL should be automatically selected and filled. Make sure it is so and choose Review and launch:

Scroll down leaving all the settings as default and choose Create app:

After a couple minutes the application is created but the environment is not ready because you need to set your environment variables:

In the left navigation pane, go to Configuration and at the row where we find Environment properties, choose Edit:

Paste the environment variables retrieved on the previous steps to the corresponding fields (marked in green) and choose Apply:

info

This video also shows you how to get the environment variables.

Elastic Beanstalk will update your environment and after a couple of minutes it will be ready:

In the left navigation pane, choose Go to environment to test it:

Add /server to the URL and you'll be accessing your Moralis Parse Server hosted on AWS Elastic Beanstalk:

Deployment successful!

AWS ECS

Deprecated

Setup ECS environment

Create ECR repository

Open the Amazon ECR console and choose Get Started Create repo. Name it parse-server-moralis-repo:

Leave everything else as it is and choose Create repository.

Copy and save the Repository name and the URI as you'll need them in the next step:

ECR repository created!

Create a Task Definition //TODO Maybe through JSON?

Open the Amazon ECS console. In the navigation pane, choose Task Definitions and Create new task definition:

On the Select compatibilities page, select EC2 and choose Next step:

Name your task parse-server-moralis-task:

On the Container definitions section, click on Add container:

Fill the Container name and the Image with the Repository name and the URI that you copied from the created ECR repository:

Set Memory Limits to 500 and Port mappings to 80:80:

Leave all the other settings as default and choose Add.

With the container added, scroll down and choose Create. You should see the task definition created:

Task definition created!

Create a Cluster

Open the Amazon ECS console. In the navigation pane, choose Clusters and Create Cluster:

For Select cluster compatibility, choose EC2 Linux + Networking and then choose Next Step:

On the Configure cluster page, enter a Cluster name, like parse-server-moralis-cluster:

Scroll down leaving all the other settings as default and choose Create. After some seconds you should see the cluster created:

Cluster created!

Create a service

Open the Amazon ECS console. In the navigation pane, choose Clusters and select your created cluster:

On the Services tab, choose Create:

On the Configure service page, choose EC2 as Launch type:

Select the Task definition and the Cluster that you just created:

Set the Service name as parse-server-moralis-service:

Set the following fields:

  • Number of tasks: 1
  • Minimum healthy percent: 0
  • Maximum percent: 100
info

This value configuration will allow the deployment of updated containers.

Scroll down leaving the other settings as default and choose Next step a couple times and then Create service. You should see the service created:

Service created!

Railway

Instructions

Click here to deploy automatically

This will also create a MongoDB and Redis instance for you automatically, all managed by Railway. If you are using your own MongoDB/Redis instances, you can follow Manual Deployment, or use this template and just delete the MongoDB and Redis services later.

  1. After your server has deployed, assign it a domain (see Step 4 of Manual Deployment).
  2. Copy your MongoDB and Parse connection URL (from the "Connect" tab from Mongo).
  3. Click on the "Variables" tab in your Parse Server and update:

Your server will re-deploy after these changes.

Manual Deployment

  1. Go to Railway, click "Start a New Project" and choose "Deploy from GitHub repo". Connect your GitHub account.
  2. Give permission for Railway to access your self-hosted server repository and click "Deploy Now":

  1. In your project's deployment page, click on the "Variables" tab and then "Raw Editor". Paste in your environment variables and click "Update Variables":

  1. Click on the "Settings" tab and under "Domains", click "Generate Domain". You can choose a different Railway domain or use your own custom domain:

  1. Copy this domain and update your SERVER_URL environment variable. Your project will re-deploy:

6: After your re-deploy is successful, open your Railway project URL in your browser to test: