# Google Cloud Platform

## Google Cloud Console Lowcoder Setup

### Creating a VPC Network

1. In the Google Cloud Console, in VPC Network, click on VPC Networks
   * Enable Compute Engine API
2. Create a VPC Network
   * Name the VPC Network
   * Disable IPv6
   * Create a custom subnet
     * Name the subnet
     * Choose the region best for your
     * Choose an IP Range
     * Private Google Access: On
     * Flow Logs: Off
     * In the subnet, setting turn on Private Google Access (it is necessary to enable this setting otherwise the cloud-run services will not be able to communicate with one another)
       * This will be in the Edit subnet section using a custom subnet creation mode
       * If the subnet creation mode is automatic, you will have to go to the region of your VPC network and enable the Private Google Access setting from there once the VPC is created.

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FRFKy9Vlsd8EZQ8XKdH9t%2FVPC%20Network%20Setup.JPG?alt=media&#x26;token=d287397e-fb81-4992-8a06-2ff933f36d02" alt=""><figcaption></figcaption></figure>

### Creating a Serverless VPC Access Connector

1. In the VPC Network, create a Connector
   * Enable serverless VPC access API
2. Create a Serverless VPC Connector
   * Name the Serverless VPC Connector
   * Choose the same region as the VPC Network
   * Network: Select the VPC Network that was previously created
   * Subnet:
     * Custom IP range
     * IP range (cannot be the same subnet that was created before)

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FfxRWAknebguzArKo26bR%2FServerless%20VPC%20Access%20Connector%20Setup.JPG?alt=media&#x26;token=a8105813-bd87-4c80-bf00-d88ba589d647" alt=""><figcaption></figcaption></figure>

### Creating a Cloud NAT

* Creating a Cloud NAT is necessary because when connecting the lowcoder services to MongoDB, you must whitelist an IP address that can access the MongoDB cluster.
  * Google Cloud services will use different IP addresses each time to communicate with the internet unless a Cloud NAT is set up on the VPC

1. Within the “Network Services” in the Google Cloud Console click on “Cloud NAT” and then “Create Cloud NAT gateway”
2. Name the Cloud NAT gateway
3. Set the NAT type to public
4. Select a Cloud Router
   * Connect it to the VPC Network created previously
   * Select the region for your Router (the one VPC are running on)
   * Create a New Router
     * Name the router
5. Cloud NAT mapping
   * Source: Primary and secondary ranges for all subnets
   * Cloud NAT IP Addresses: Manual
     * IP Addresses:
       * Premium Network Service Tier
       * IP address:
         * Create and Name an IP address and then click on “Reserve”
       * IP draining: Off (default)
6. Click on Create Cloud NAT
7. After creating a Cloud NAT IP address, whitelist this IP address on your MongoDB cluster

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FyqNDpnIbCDoSitRn8mAM%2FCloud%20NAT%20Setup.JPG?alt=media&#x26;token=28fb0452-5685-429a-985a-f152560e5fc9" alt=""><figcaption></figcaption></figure>

### Creating a Redis Instance

1. Within Google Cloud Console in Memorystore, on the Redis page, create a Redis instance
2. Enable Google Cloud Memorystore for Redis API
3. Create a Redis Instance:

   * Name Redis instance in the Instance ID
   * Basic Tier
   * 1 GB of capacity is more than sufficient in our environment however if you face trouble then you can always adjust the capacity as necessary
   * Choose the same region as the VPC Network
   * Set up Connection: connect your Redis instance to the VPC network created previously

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FaVEfObZ29xz8ZWdyEnkr%2FRedis%20Instance%20Setup.JPG?alt=media&#x26;token=5bc4d2d2-8a49-49cc-8625-cdebff99c7fc" alt=""><figcaption></figcaption></figure>

### Setting up the Node Service

1. In the Google Console go to Cloud Run
2. Create a Service
3. In the Container Image URL input: lowcoderorg/lowcoder-ce-node-service
   * This is from the lowcoder docker hub (<https://hub.docker.com/r/lowcoderorg/lowcoder-ce-node-service>)
4. Select the Region, same as the region for the VPC Network
5. CPU allocation and pricing: CPU is only allocated during request processing
6. Ingress Control is set to Internal (this is necessary to not expose the Node Service to the rest of the internet)
7. Authentication: Allow unauthenticated access invocations

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FA1HBIlHinT0pLV3dFKJY%2FNode%20Service%20Settings.JPG?alt=media&#x26;token=75ccf1c2-0c05-4c5d-880e-a3f9797db974" alt=""><figcaption></figcaption></figure>

#### Container Settings

1. Container port: 6060
2. CPU allocation:
   * Only allocated during the request processing
3. Capacity (allocate as necessary)
   * Memory: 1 GiB
   * CPU: 1
4. Execution environment: Default

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FbitjMpuQvx6Ewy9bJKYl%2FNode%20Service%20Container%20Settings.JPG?alt=media&#x26;token=ce4c8128-78b1-4e15-91c7-ef5f9e53dd00" alt=""><figcaption></figcaption></figure>

5. Environment Variable:

* Name 1: LOWCODER\_API\_SERVICE\_URL
* Value 1: Paste the API Service URL (Once the API Service is created after the next step

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FA1uDzQnLTxNxtHAFYYHm%2FNode%20Service%20Environment%20Variables.JPG?alt=media&#x26;token=34ea008b-b8b5-417f-a54f-74d03d30f41d" alt=""><figcaption></figcaption></figure>

#### Networking Settings

* Connect to a VPC for outbound traffic
  * Use Serverless VPC Access Connectors
    * Network: Select the VPC network that was created
  * Traffic routing:
    * Route only requests to private IPs to the VPC (this is necessary to not expose the Node Service to the rest of the internet)

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FOqFjm0Jivxq1ciit70AF%2FNode%20Service%20Networking%20Settings.JPG?alt=media&#x26;token=34221725-95b2-4dfd-a7c7-5199c914c41f" alt=""><figcaption></figcaption></figure>

### Setting up the API Service

1. In the Google Console go to Cloud Run
2. Create a Service
3. In the Container Image URL input: lowcoderorg/lowcoder-ce-api-service
   * This is from the lowcoder docker hub (<https://hub.docker.com/r/lowcoderorg/lowcoder-ce-api-service>)
4. Select the Region, same as the region for the VPC Network
5. CPU allocation and pricing: CPU is only allocated during request processing
6. Ingress Control is set to Internal (this is necessary to not expose the API Service to the rest of the internet)
7. Authentication: Allow unauthenticated access invocations

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FhP9EuFk05Dk2nN55ljae%2FAPI%20Service%20Settings.JPG?alt=media&#x26;token=0d753fde-0a4f-4dc9-b8b1-b651d35f6fab" alt=""><figcaption></figcaption></figure>

#### Container Settings

1. Container port: 8080
2. Capacity (allocate as necessary)
   * Memory: 1 GiB
   * CPU: 1
3. Execution environment: Second generation

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FVL6eR1jRTiHo9XMn52Ed%2FAPI%20Service%20Container%20Settings.JPG?alt=media&#x26;token=ba9fd45c-c1aa-435a-bf81-512d1ee01aa5" alt=""><figcaption></figcaption></figure>

4. Environment Variable: add any other environment variable as per your requirement (list of environment variables <https://raw.githubusercontent.com/lowcoder-org/lowcoder/main/deploy/docker/docker-compose-multi.yaml>)

* Variable 1:
  * Name 1: REDIS\_URL
  * Value 1: use: redis\://10.0.0.0:6379?db=databasename and replace 10.0.0.0 with your Redis instance IP address and database name with the name of your database
* Variable 2:
  * Name 2: MONGODB\_URL
  * Value 2: Paste the MongoDB URL
* Variable 3:
  * Name 3: LOWCODER\_NODE\_SERVICE\_URL
  * Value 3: Paste the Node Service URL
* Variable 4:
  * Name 4: ENABLE\_USER\_SIGN\_UP
  * Value 4: TRUE&#x20;
    * If it is a new setup then set it to true; if it will be used for an existing setup then set it to FALSE
* Variable 5:
  * Name 5: ENCRYPTION\_PASSWORD
  * Value 5: lowcoder.org
* Variable 6:
  * Name 6: ENCRYPTION\_SALT
  * Value 6: lowcoder.org
* Variable 7:
  * Name 7: CORS\_ALLOWED\_DOMAINS
  * Value 7: \*

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2F1zTI23LClhQi84TuNOah%2FAPI%20Service%20Envirnoment%20Variables.JPG?alt=media&#x26;token=7e68ef5b-0f85-4fc6-8c6f-f18681c6b1c2" alt=""><figcaption></figcaption></figure>

#### Networking Settings

* Connect to a VPC for outbound traffic
  * Use Serverless VPC Access Connectors
    * Network: Select the VPC network that was created
  * Traffic routing:
    * Route all traffic to the VPC

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FitJwQuNLPGml0GU7ZBN1%2FAPI%20Service%20Networking%20Settings.JPG?alt=media&#x26;token=1616405f-6271-412c-a74c-b57c4036e5a9" alt=""><figcaption></figcaption></figure>

### Setting up the Front-End Service

1. In the Google Console go to Cloud Run
2. Create a Service
3. In the Container Image URL input: lowcoderorg/lowcoder-ce-frontend
   * This is from the lowcoder docker hub (<https://hub.docker.com/r/lowcoderorg/lowcoder-ce-frontend>)
4. Select the Region, same as the region for the VPC Network
5. CPU allocation and pricing: CPU is only allocated during request processing
6. Ingress Control is set to all (the front-end should be exposed to the internet)
7. Authentication: Allow unauthenticated access invocations

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2F3ojKswkh1qjl06dvezvk%2FFrontend%20Service%20Settings.JPG?alt=media&#x26;token=a20a90ed-fe14-4a31-89b5-1a97424fea4b" alt=""><figcaption></figcaption></figure>

#### Container Settings

1. Container port: 3000
2. Capacity (allocate as necessary)
   * Memory: 512 MiB
   * CPU: 1
3. Execution environment: Default

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2Fh5OvZFh9mbIdOAkK5rIJ%2FFrontend%20Service%20Container%20Settings.JPG?alt=media&#x26;token=b2680fba-d501-4692-ab49-3d8a91c91736" alt=""><figcaption></figcaption></figure>

4. Environment Variable: add any other environment variable as per your requirement (list of environment variables <https://raw.githubusercontent.com/lowcoder-org/lowcoder/main/deploy/docker/docker-compose-multi.yaml>)

* Variable 1:
  * Name 1: LOWCODER\_API\_SERVICE\_URL
  * Value 1: Paste the API Service URL
* Variable 2:
  * Name 2: LOWCODER\_NODE\_SERVICE\_URL
  * Value 2: Paste the Node Service URL

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FrZG9auPb19v0ThPjbS66%2FFrontend%20Service%20Environment%20Variables.JPG?alt=media&#x26;token=936beeea-b3ac-4844-8a3e-ce719081934c" alt=""><figcaption></figcaption></figure>

#### Networking Settings

* Connect to a VPC for outbound traffic
  * Use Serverless VPC Access Connectors
    * Network: Select the VPC network that was created
  * Traffic routing:
    * Route all traffic to the VPC

<figure><img src="https://934254130-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjNgeI0mUzgw6Re92iTOw%2Fuploads%2FNGZkPB00uQTc3Xb9JCwx%2FFrontend%20Service%20Networking%20Settings.JPG?alt=media&#x26;token=0b7a6f5d-e8e4-4919-b853-c3afbd2125fc" alt=""><figcaption></figcaption></figure>

#### Post Deployment Settings

* Can set up a DNS for the front URL through Google Domains

Author: Eshaan V Saxena, (10/10/2023)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lowcoder.cloud/lowcoder-documentation/setup-and-run/self-hosting/google-cloud-platform.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
