Follow the steps below to deploy ToolJet on Cloud run with `gcloud` CLI.
## Deploying ToolJet application
1. Cloud Run requires prebuilt image to be present within cloud registry. You can pull specific tooljet image from docker hub and then tag with your project to push it to cloud registry.
```bash
gcloud auth configure-docker
docker pull tooljet/tooljet-ce:latest
docker tag tooljet/tooljet-ce:latest gcr.io/<replace-your-project-id>/tooljet/tooljet-ce:latest
4. Under containers tab, please make sure the port is set to 3000 and command `npm, run, start:prod` is entered in container argument field with CPU capacity set to 2GiB:
- Should you encounter any migration issues, please execute the following command. Be aware that executing this command may cause the revision to break. However, modifying the command back to `npm, run, start:prod` will successfully reboot the instance:
If you are using [Public IP](https://cloud.google.com/sql/docs/postgres/connect-run) for Cloud SQL, then database host connection (value for `PG_HOST`) needs to be set using unix socket format, `/cloudsql/<CLOUD_SQL_CONNECTION_NAME>`.
:::
6. Please go to the connection tab. Under Cloud SQL instance please select the PostgreSQL database which you have set-up.
Click on deploy once the above parameters are set.
:::info
Once the Service is created and live, to make the Cloud Service URL public. Please follow the steps [**here**](https://cloud.google.com/run/docs/securing/managing-access) to make the service public.
:::
### Deploying ToolJet Database
If you intend to use this feature, you'd have to set up and deploy PostgREST server which helps querying ToolJet Database.
#### PostgREST server
1. Cloud Run requires prebuilt image to be present within cloud registry. You can pull specific PostgREST image from docker hub and then tag with your project to push it to cloud registry.
```bash
gcloud auth configure-docker
docker pull postgrest/postgrest:v10.1.1.20221215
docker tag postgrest/postgrest:v10.1.1.20221215gcr.io/tooljet-test-338806/postgrest/postgrest:v10.1.1.20221215
5. Under environmental variable please add corresponding Tooljet database env variables. You can also refer [env variable](/docs/setup/env-vars#tooljet-database).
6. Please go to connection tab. Under Cloud SQL instance please select the PostgreSQL database which you have set-up for Tooljet application or the separate PostgreSQL database created respective to Tooljet Database from the drop-down option.
Click on deploy once the above parameters are set.
:::info
Once the Service is created and live, to make the Cloud Service URL public. Please follow the steps [**here**](https://cloud.google.com/run/docs/securing/managing-access) to make the service public.
:::
7. Additional Environmental variable to be added to Tooljet application or Tooljet Server connect to PostgREST server. You can also refer env variable [**here**](/docs/setup/env-vars#tooljet-database)