# GCP Cloud Run

## GCP Project

GCP projects serve as a "container" to organize and manage GCP services and applications.

1. Navigate to the [**GCP Console**](https://console.cloud.google.com/)**.**
2. **Log in** or **Create** an account.
3. Click the Project dropdown and select **Create New Project.**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FhVQB4jFKmy7HZdCyRhCi%2Fcreatenewproject.jpg?alt=media&#x26;token=b8b9cbfe-d7bc-43c3-b2ea-24a936ab4c6b" alt=""><figcaption></figcaption></figure>

4. Input a **Project name** for your project.
5. Select (or create) an **Organization.**
6. Click the **Create** button.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Fg13Tmogrofsq9sxIVGAg%2Fselectproject.jpg?alt=media&#x26;token=9fd06c22-9935-4c03-b589-8714307d0925" alt="" width="530"><figcaption></figcaption></figure>

## MongoDB Atlas

Before a deployment can be created, a database is required to store the Form.io deployment data. [**MongoDB Atlas**](https://cloud.google.com/mongodb) is a NoSQL database solution that will be used in this example within the GCP project to store projects, forms, and submissions.&#x20;

### Creating a MongoDB Atlas Project

1. Within the GCP Project, search and select **MongoDB Atlas.**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F6dGjIwM3oCi09jFCdija%2Fsearchmongodbatlas.jpg?alt=media&#x26;token=0e081891-d1d9-40ae-95db-6c57aea36d33" alt=""><figcaption></figcaption></figure>

2. Click the **Manage On Provider** button, which will open *cloud.mongodb.com* in a new tab.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FPS0CXy7Jj5AJ9Bic8Q0L%2Fmanageonprovider.jpg?alt=media&#x26;token=0366816f-6990-4a3b-80e6-8d96a3d47b9c" alt=""><figcaption></figcaption></figure>

3. **Log in** or **create** a MongoDB account.
4. Select **MongoDB Atlas** from the Cloud Service options. If there is no organization, a new organization should be created.
5. Give the Organization a **name** and select a **Cloud Service.**
6. Add **Members** to the organization and click the **Create Organization** button.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F1TS5ah0b1VfJmTmk7RAy%2Forganization.jpg?alt=media&#x26;token=943f789f-81c6-4c56-915d-3b2994a4a18d" alt=""><figcaption></figcaption></figure>

5. Within the Organization, click the **New Project** button.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FhuWnmMgzWEFXF12IkWf5%2Fnewproject.jpg?alt=media&#x26;token=5bd16323-9a27-4ccb-9b12-1847fa4aa6f3" alt=""><figcaption></figcaption></figure>

6. Select **MongoDB Atlas** from the Cloud Service options.
7. Give the MongoDB Project a **Name.**
8. Add any additional users to MongoDB Project through **Add members.**
9. Click the **Create Project** button.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FHTSY83myhQokYlambdyn%2Fcreatemongoproject.png?alt=media&#x26;token=60009d49-533e-40f4-8b53-66290b612d2f" alt=""><figcaption></figcaption></figure>

### Create a Cluster

A **MongoDB Atlas cluster** is a collection of MongoDB servers that work together to store and manage Form.io data.

1. Click the **+Create** cluster button within the MongoDB Overview page.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FOJ0XrnIN1e04wK0d0OdS%2Fcreatecluster.jpg?alt=media&#x26;token=d8e5466a-0a22-4de1-b505-7ae2b8bc84f0" alt=""><figcaption></figcaption></figure>

2. Select the desired Cluster Template. For this example, the **M0** option will be selected.
3. Give the Cluster a **name.**
4. Select **Google Cloud** as the **Provider.**
5. Click the **Create Deployment** button.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FcJMStaJaMph3S1hHlLR7%2FDeployCluster1.jpg?alt=media&#x26;token=bfa07a3b-144a-482e-b213-9bcb4e4e394d" alt=""><figcaption></figcaption></figure>

### Connect to FormioCluster

Complete the following steps to connect the cluster to all required IP addresses and configure the database users.

#### Set up connection security

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FQYknSWkk83ZC7XyAvhST%2Fconnecttoformiocluster.jpg?alt=media&#x26;token=917b8fde-e2a3-425a-bf03-8e4f9ba3fa7c" alt="" width="563"><figcaption></figcaption></figure>

1. By default, the current IP address should be added. Click the **Network Access** button to add any additional IP addresses. This example is set to allow any IP address to connect to the database \
   E.g. `0.0.0.0`

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FK0Qj0cdlbLnEfTtTtXtb%2Fnetworkaccess.jpg?alt=media&#x26;token=29cf4608-4e06-4193-ae5e-5f81216d45d4" alt="" width="563"><figcaption></figcaption></figure>

2. Set the **Username** and **Password** for any users that will have access to the project.
3. Click **Create Database User.**
4. Click the **Choose a connection method** button.

#### Choose a connection method

1. Select **Drivers** as the connection option.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FnRpdBThi8TI6kK3CsWGT%2Fdrivers.jpg?alt=media&#x26;token=a62e42ce-5f00-4c48-b7bf-59646f509539" alt="" width="563"><figcaption></figcaption></figure>

2. Ensure **Node.js** is selected for the **Driver** option.
3. Copy the connection string. This string will be used later as an environment variable within GCP.

{% hint style="info" %}
The MongoDB Cluster may take some time to build before a Connection String can be copied.
{% endhint %}

4. Click **Done** to finalize the database.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FBu1Rpx7jLPAcN2l2S5D0%2Fconnect.jpg?alt=media&#x26;token=91c25e4d-286d-441f-b59d-fa9325dc48f4" alt="" width="563"><figcaption></figcaption></figure>

### Create Database

Create a database to connect to the cluster by completing the following steps:

1. Navigate to the **Cluster** tab.
2. Click the **Browse Collections** for the cluster.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FfZ1uZxUeudpotiURGWU2%2Fbrowsercollections.jpg?alt=media&#x26;token=9f8fa0a5-4c59-4475-b1d4-c5e14546ad7d" alt=""><figcaption></figcaption></figure>

3. Click **Add My Own Data** button to create database.
4. Set a **Database Name**, **Collection Name**, then click **Create.**

{% hint style="info" %}
Take note of the **Database Name.** It will be required in the connection string for GCP deployments. MongoDB Atlas will create a database by default called `test`if a Database is not created manually.
{% endhint %}

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F7k0RdWxikbvmNYx5SpDv%2Fdatabase12.jpg?alt=media&#x26;token=1cad4095-e872-481d-ae56-59caf262a4bf" alt="" width="563"><figcaption></figcaption></figure>

## Google Cloud File Storage

Create a Google File Storage bucket to store file uploads and PDFs:&#x20;

1. Navigate to the [**GCP Console**](https://console.cloud.google.com/)**.**
2. Select the GCP **Project.**
3. Search and select **Cloud Storage** within the search bar.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FAvVRxX7lBCtM7xtppaOy%2Fcloudstorage.jpg?alt=media&#x26;token=1197c7e6-b5f5-4ea1-aaac-3b091d6072f6" alt=""><figcaption></figcaption></figure>

4. Click **+Create** to create a bucket.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FRMowRU427ELKNGCpTgfb%2Fcreatebucket.jpg?alt=media&#x26;token=ba525145-516d-4d03-87f4-8b849e0de2f5" alt=""><figcaption></figcaption></figure>

5. Set a **name** for the Bucket
6. Click the **Create** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FzIdLykzhQ6VZfhF2YD5Y%2Fbucketname.jpg?alt=media&#x26;token=cdf2b64b-0daf-4208-b442-60b8acbe3e04" alt=""><figcaption></figcaption></figure>

7. Check the **Enforce public access** setting.
8. Click **Confirm.**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F78Mkp313xcL6POdAUYyi%2Faccessprompt.png?alt=media&#x26;token=5a109197-aef2-4001-b7bb-ac8a0eda66f4" alt="" width="563"><figcaption></figcaption></figure>

9. Within the bucket settings, click the **Settings** button on the left-hand side bar.
10. Select the **Interoperability** tab.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FH1FW2LLP2oh9ZezX4R2R%2Finteroperability.jpg?alt=media&#x26;token=026a4701-1447-4dbb-8787-2bd7102ed924" alt=""><figcaption></figcaption></figure>

11. Scroll down to the **Access keys for your user account** section and click **Create a Key.**
12. Record the **Access key** and **Secret** somewhere safe. They will be needed later.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FMhO7Otd8cayB1XV65gws%2Faccesskey.jpg?alt=media&#x26;token=b9257aa1-dd4e-407c-bf91-1c8b957f8b1c" alt="" width="563"><figcaption></figcaption></figure>

## GCP Cloud Run

Set up a GCP Cloud Run to deploy and run the containerized Form.io application in a serverless environment.

1. Navigate to the [**GCP Console**](https://console.cloud.google.com/)**.**
2. Select your **GCP Project.**
3. Search and select **Cloud Run** within the search bar.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FxXvsS8yZJ9J0aSA1bZia%2Fcloud%20run.jpg?alt=media&#x26;token=25563092-ba33-433a-8ba6-f35b5cbd99a4" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You may need to enable the Cloud Run Admin API. If so, click **Enable.**
{% endhint %}

4. Ensure **Cloud Run** is **enabled.**

### Enterprise Server Deployment

1. Within GCP Cloud Run, click the **Create Service** button. \
   This will display the service configuration screen.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FHA6Rv1bP3pCS9pq838AL%2Fcreatservice.jpg?alt=media&#x26;token=f6c2c016-7627-46a0-9e49-ea2805408a58" alt="" width="563"><figcaption></figcaption></figure>

2. Enter the formio-enterprise.io Docker container image URL within the **Container image URL** setting field:\
   \&#xNAN;*`docker.io/formio/formio-enterprise:9.3.0`*

{% hint style="info" %}
For this tutorial, the container tag being utilized is the formio-enterprise docker image tag 9.3.0. [**Click Here**](https://hub.docker.com/r/formio/formio-enterprise/tags) for a list of available formio-enterprise server version tags .\
\
For the latest version, replace the version number with *latest*\
\
&#x20;*docker.io/formio/formio-enterprise:latest*
{% endhint %}

3. Set a **Service Name.**
4. Set the **Authentication** method.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FG9jmGLdo23nLgm6oFRsS%2Fcontainerimage.jpg?alt=media&#x26;token=108e79e3-ac6d-4efe-af63-9b5c016cec7d" alt=""><figcaption></figcaption></figure>

5. Set the **Service Autoscaling** number, the minimum recommendation is **1**.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F5VeP7xmUxWfGaEasAbBU%2Fserviceautoscaling.jpg?alt=media&#x26;token=c51d9abd-ca36-42d0-93ab-4e99b0b7a20c" alt=""><figcaption></figcaption></figure>

6. Open the **Container(s), Volumes, Networking, Security** tab.
7. Set the **Container Port** to **3000.**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FLc9i4T9sYcKY9bEWSXE1%2Fenterpriseport.jpg?alt=media&#x26;token=731a9b0a-a6a6-42e7-8c99-42e6c005a9a1" alt=""><figcaption></figcaption></figure>

8. Within the Container(s), Volumes, Networking, Security settings, click the **Variables and Secrets** tab.
9. Click the **+Add Variable** button.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F1Or27yArddFYFEaDgMRT%2Fenvironmentvariables.jpg?alt=media&#x26;token=de3ae6b2-adec-4d19-bd82-1a183f131109" alt=""><figcaption></figcaption></figure>

10. Enter the following **environment** **variables:**

{% hint style="info" %}
For the **MONGO** **variable**, copy and paste the connection string from the [**database configuration**](#connect-to-formiocluster) step.\
\
Update this string to include the database name of the MongoDB Cluster; in this example, the database name is <mark style="color:red;">**`formio`**</mark>. \
\
MongoDB Atlas will create a database by default called `test`if a Database was not created in the [**previous steps**](#create-database). Verify the database name by navigating to the MongoDB Cluster and viewing the Collections (see screenshot below)
{% endhint %}

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Ftn3I1xMaTo3PbEH6eJ4W%2Fdbname.jpg?alt=media&#x26;token=6bd49b4c-edb1-4d9d-84cd-da7ff77db441" alt=""><figcaption></figcaption></figure>

| MONGO           | The MongoDB connection string to connect to your remote database. This is the value we copied in the cluster deployment step. Ensure the correct MongoDB username, password, and database name is included in the string. | mongodb+srv://mongouser:<mypassword@formiocluster.apgbu.mongodb.net>/<mark style="color:red;">**formio**</mark>?retryWrites=true\&w=majority\&appName=FormioCluster |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| LICENSE\_KEY    | The[ **license key**](https://help.form.io/licenses/license-management#accessing-license-management) for your deployment. You will get this when you upgrade a project to Enterprise.                                     | <—YOUR LICENSE—>                                                                                                                                                    |
| DEBUG           | Application Logging Settings.                                                                                                                                                                                             | \*.\*                                                                                                                                                               |
| PORTAL\_ENABLED | Used to enable the Self-Hosted Portal.                                                                                                                                                                                    | 1                                                                                                                                                                   |
| ADMIN\_EMAIL    | An admin account you would like to use as the first Admin user authenticating into the deployed environment.                                                                                                              | <admin@example.com>                                                                                                                                                 |
| ADMIN\_PASS     | A password for the first Admin user.                                                                                                                                                                                      | CHANGEME                                                                                                                                                            |
| DB\_SECRET      | A secure secret that you will pick that is used to encrypt the project settings.                                                                                                                                          | CHANGEME                                                                                                                                                            |
| JWT\_SECRET     | A secure secret that you will pick that is used to establish secure JWT tokens.                                                                                                                                           | CHANGEME                                                                                                                                                            |
| PDF\_SERVER     | The endpoint of the GCP PDF Server deployment (created in the next section).                                                                                                                                              | <https://pdf-server-1234.us-central1.run.app>                                                                                                                       |

{% hint style="warning" %}
Add the **`PDF_SERVER`** variable after completing the PDF deployment in GCP in the following section.
{% endhint %}

11. Scroll down and set the **Maximum number of instances**. \
    For this example, the instance number will be set to **3**.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FLSQXHmk4tzNh9uTwHlNw%2Fautoscaling.jpg?alt=media&#x26;token=e4173f3e-5ba7-437e-8d86-a5d5fd1f96c4" alt=""><figcaption></figcaption></figure>

12. Click the **Create** button. The screen should proceed to a progress screen showing the service being deployed.\
    Once completed, the service will be deployed and will show a green checkmark.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FTUkTC8CN1OLgGMd8NSJp%2Fdeployed.jpg?alt=media&#x26;token=4fbd78a9-699b-45d7-9690-f456a28d3c23" alt=""><figcaption></figcaption></figure>

### PDF Server Deployment

1. Within GCP Cloud Run, click +**Deploy Service**, and select **Service.**\
   This will display the service configuration screen.&#x20;

2. Enter the Form.io pdf-server Docker container image URL in the URL settings field:\
   \&#xNAN;*`docker.io/formio/pdf-server:5.6.0`*

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>For this example, the container tag being utilized is the pdf-server docker image tag 5.6.0. <a href="https://hub.docker.com/r/formio/pdf-server/tags"><strong>Click Here</strong></a> for a list of available pdf-server version tags <br><br>For the latest PDF version, replace with <em>docker.io/formio/pdf-server:latest</em></p></div>

3. Input a **Service Name.**

4. Set the **Authentication** method.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FfJfRRgU5BJlBd9gWc4X7%2Fpdfsettings.jpg?alt=media&#x26;token=2d3392ef-e22b-400b-9ccc-1ca91bcb297c" alt=""><figcaption></figcaption></figure>

5. Set the **Service Autoscaling** number. The minimum suggested setting is **1**.&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F5VeP7xmUxWfGaEasAbBU%2Fserviceautoscaling.jpg?alt=media&#x26;token=c51d9abd-ca36-42d0-93ab-4e99b0b7a20c" alt=""><figcaption></figcaption></figure>

6. Open the **Container(s), Volumes, Networking, Security** tab.
7. Set the **Container Port.**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FBEve3VRatWlGu1jcGrFq%2Fpdfserverport.jpg?alt=media&#x26;token=467010be-5661-49b7-b62a-a9fa71f42413" alt=""><figcaption></figcaption></figure>

8. Within the Container(s), Volumes, Networking, Security settings, click the **Variables and Secrets** tab.
9. Click the **+Add Variable** button

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2F1Or27yArddFYFEaDgMRT%2Fenvironmentvariables.jpg?alt=media&#x26;token=de3ae6b2-adec-4d19-bd82-1a183f131109" alt=""><figcaption></figcaption></figure>

10. Enter the **following Environment Variables:**<br>

    <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><ul><li>For the <strong>MONGO</strong> <strong>variable</strong>, copy and paste the connection string from the <a href="#connect-to-formiocluster"><strong>database configuration</strong></a> step. Update this string to include the name of the MongoDB Atlas database used by the cluster; in this example, the database name is <mark style="color:red;"><strong><code>formio</code></strong></mark>. <br><br>MongoDB Atlas will create a database by default called <code>test</code>if a database was not created manually in the <a href="#create-database"><strong>previous steps</strong></a>. Verify the database name by navigating to the MongoDB Cluster and viewing the Collections (see screenshot below)</li><li>For the <strong>FORMIO_S3 variables</strong>, enter the credentials from the <a href="#google-cloud-file-storage"><strong>Google Storage Step</strong></a></li><li>The application sets the <strong><code>FORMIO_S3_PORT</code></strong> variable to <code>9000</code> by default. In this example, where <code>FORMIO_S3_SERVER</code> is set to <code>https://storage.googleapis.com</code>, the <code>FORMIO_S3_PORT</code> environment variable should be left empty</li></ul></div>

<table><thead><tr><th width="223">Setting</th><th width="210">Description</th><th>Example</th></tr></thead><tbody><tr><td>MONGO</td><td>The MongoDB connection string to connect to your remote database. This is the value we copied before.</td><td>mongodb+srv://user:mypassword@formiocluster.apgbu.mongodb.net/<mark style="color:red;"><strong>formio</strong></mark>?retryWrites=true&#x26;w=majority&#x26;appName=FormioCluster</td></tr><tr><td>LICENSE_KEY</td><td>The license key for your deployment. You will get this when you upgrade a project to Enterprise.</td><td>&#x3C;—YOUR LICENSE—></td></tr><tr><td>DEBUG</td><td></td><td>*.*</td></tr><tr><td>FORMIO_S3_SERVER</td><td>Storage URI of the File Storage bucket. </td><td>https://storage.googleapis.com</td></tr><tr><td>FORMIO_S3_BUCKET</td><td>Name of the Google bucket.</td><td>mybucket-name</td></tr><tr><td>FORMIO_S3_KEY</td><td>The Access Key of the Google Cloud storage bucket, found within the Interoperability tab.</td><td>ABCD1234</td></tr><tr><td>FORMIO_S3_SECRET</td><td>The  Secret of the Google Cloud storage bucket, found within the Interoperability tab.</td><td>abc+123+def+L+ghiJKLmno</td></tr><tr><td>FORMIO_S3_REGION</td><td>Region of the bucket.</td><td>us-central1</td></tr><tr><td>FORMIO_S3_PORT</td><td></td><td></td></tr></tbody></table>

11. Under **Billing** select the **Instance-based** option (This is a puppeteer requirement. [Find out more here](https://pptr.dev/troubleshooting#running-puppeteer-on-google-cloud-run))

<div align="left"><figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2Few9CaQnvoBRzSensWtSn%2Fimage.png?alt=media&#x26;token=1e07c6e6-3918-44fa-a755-b22e048f93dd" alt=""><figcaption></figcaption></figure></div>

12. Scroll down and set the **Maximum number of instances**. \
    For this example, the instance number will be set to **3**.

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FLSQXHmk4tzNh9uTwHlNw%2Fautoscaling.jpg?alt=media&#x26;token=e4173f3e-5ba7-437e-8d86-a5d5fd1f96c4" alt=""><figcaption></figcaption></figure>

13. Click the **Create** button.

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.

14. Copy the **PDF Server URL**

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FPNj4ELUF8rkpLqHl63z0%2Fpdfserverurl.jpg?alt=media&#x26;token=7753e35b-9afc-4aff-a717-bdd81a65a3d4" alt=""><figcaption></figcaption></figure>

15. Within the GCP Cloud Run, add the following **environment** **variable** to the **Enterprise API Deployment** &#x20;

| Environment Variable | Description                            | Value                                         |
| -------------------- | -------------------------------------- | --------------------------------------------- |
| PDF\_SERVER          | The GCP PDF Server deployment endpoint | <https://pdf-server-1234.us-central1.run.app> |

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FKUqcEwWlaMS8ukGoglih%2Fpdfserveenv.jpg?alt=media&#x26;token=25a3f33e-d988-4599-9f64-c0f4c256914c" alt="" width="563"><figcaption></figcaption></figure>

## Access Deployment

The Cloud Run service provides a URL to access the Form.io deployment

1. Navigate to the [**GCP Console**](https://console.cloud.google.com/)
2. Select your **Google Cloud Project**
3. Search and select **Cloud Run** within the search bar
4. Click on the Form.io Enterprise Server **service**&#x20;

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FpYjoYR4tB6IJzQViE0oB%2Fdeployed.jpg?alt=media&#x26;token=1cb26341-2a60-4ecf-ba03-ac0546d26534" alt=""><figcaption></figcaption></figure>

5. Click the **URL** link next to the service name

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FnXkztBRRTD8fiDBoRsuV%2Fdeploymentendppint.jpg?alt=media&#x26;token=97bdc48c-f8e6-4a0c-bcf5-601f86551ea0" alt=""><figcaption></figcaption></figure>

6. Login using the **username** and **password** specified in the environment variables

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FfhUxOypSddaZX4U56NxS%2Flogin.jpg?alt=media&#x26;token=423a0abc-74a6-4a70-8481-cfe294a6676b" alt="" width="563"><figcaption></figcaption></figure>

7. Create a Project.

{% hint style="info" %}
For more information on next steps, visit the [**Getting Started**](https://help.form.io/master/form.io-beginners-walkthrough) guide
{% endhint %}

<figure><img src="https://3305536326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPHoF2HwOA0s5HV_AIB%2Fuploads%2FvgHGibA9WGPrVcbb8Una%2Fform.iologin.jpg?alt=media&#x26;token=fdf27bfc-b8c0-4390-bac1-53e6fd9b9956" alt=""><figcaption></figcaption></figure>
