> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kuest.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloud Run

> Deploy Kuest to Google Cloud Run with Cloud Build and Secret Manager.

## Prerequisites

* GCP project with billing enabled
* `gcloud` installed and authenticated
* Cloud Build, Artifact Registry, Cloud Run Admin, and Secret Manager APIs enabled
* Base values from [Environment Variables](/configuration/environment-variables)
* A storage profile from [Manual Installation Overview](/manual-installation/overview)

## Build and deploy

The Cloud Run path uses `infra/cloud-run/cloudbuild.yaml`, which builds from `infra/docker/Dockerfile`, pushes the image to Artifact Registry, and deploys the service.

Supabase mode example:

```bash theme={null}
gcloud builds submit --config infra/cloud-run/cloudbuild.yaml \
  --substitutions=_SERVICE=kuest-web,_REGION=us-central1,_SITE_URL=https://markets.example.com,_STORAGE_MODE=supabase
```

S3 mode example:

```bash theme={null}
gcloud builds submit --config infra/cloud-run/cloudbuild.yaml \
  --substitutions=_SERVICE=kuest-web,_REGION=us-central1,_SITE_URL=https://markets.example.com,_STORAGE_MODE=s3,_S3_ENDPOINT=https://s3.example.com,_S3_REGION=us-east-1,_S3_FORCE_PATH_STYLE=true
```

## Secrets to create in Secret Manager

* `POSTGRES_URL`
* `CRON_SECRET`
* `BETTER_AUTH_SECRET`
* `REOWN_APPKIT_PROJECT_ID`
* `ADMIN_WALLETS`
* `KUEST_ADDRESS`
* `KUEST_API_KEY`
* `KUEST_API_SECRET`
* `KUEST_PASSPHRASE`

Add either:

* `SUPABASE_URL` and `SUPABASE_SERVICE_ROLE_KEY`

or:

* `S3_BUCKET`
* `S3_ACCESS_KEY_ID`
* `S3_SECRET_ACCESS_KEY`

## Scheduler

If you are not on Supabase mode, create Cloud Scheduler jobs that follow [Scheduled Jobs](/manual-installation/scheduler-jobs).

<Warning>
  Do not create Cloud Scheduler jobs when Supabase mode is already using `pg_cron`.
</Warning>

## Optional Terraform

```bash theme={null}
cd infra/terraform/environments/production/cloud-run
cp terraform.tfvars.example terraform.tfvars
terraform init
terraform plan
terraform apply
```
