GCP Cloud Run

This tutorial will walk you through how to create an example Form.io deployment environment on GCP Cloud Run. This tutorial assumes you have prior knowledge of of Form.io and GCP Cloud Run.

MongoDB Atlas

Before we start our deployment, we will first need to create a Database to store all of our Forms and Submissions within our Form.io deployment. MongoDB Atlas is a NoSQL database solution that we will run within GCP to store projects, forms, and submissions.

Within your GCP console, type MongoDB and click on the link that says MongoDB Atlas

On the next page, click on the button that says MANAGE ON PROVIDER

After clicking the link, a new tab should open and navigate to cloud.mongodb.com. Sign in or create an account and create a project.

After creating a project, create a deployment.

Follow the steps to select a configuration template. Give your database a name. Select Google Cloud as the provider and select your desired region. When finished click Create Deployment.

Specify the IP addresses or range of IP addresses that will be allowed to access the new database. Afterwards, provide the desired username and password. Once that's completed click Create Database User.

After adding IP addresses and creating a database user, click Choose a connection method.

NOTE: If the desired IP address or range is not known. Selected the default to complete the configuration. Later, once the IP addresses have been acquired, navigate to Network Access for the created database and add or remove IP addresses as needed. For this tutorial, we will set the IP address range to allow any IP address to connect to the database.

After clicking Choose a connection method, click the Drivers option under the Connect to your application section.

Make sure Node.js driver is selected and copy the connection string. This string will be used later as an environment variable within GCP.

The database should be configured and ready to use.

GCP Cloud Run

In the GCP Console, type in Cloud Run in the search bar.

You may need to enable the Cloud Run Admin API. If so, click ENABLE.

If Cloud Run is enabled, select CREATE SERVICE.

This will display the service configuration screen.

Enter or select the following:

For this tutorial, we use the Form.io version 8.5.0 image. For the latest version, replace with docker.io/formio/formio-enterprise:latest

We recommend setting the number of instances to a minimum of 1.

Next, set the port to 3000.

Enter the environment variables.

  • For the MONGO variable, copy and paste the connection string from the database configuration. But modify the string to include the name of the database. In our case, our database name is formio. See below:

For this tutorial we set Maximum number of instances to 3.

After entering the fields click DEPLOY.

The screen should navigate to a progress screen showing the service being deployed.

Once completed, the service will be deployed and will show a green checkmark.

Click the URL link to view the app. This should open a new tab and show the Form.io login screen.

Login using the username and password specified in the environment variables and begin creating a project.

Last updated