sorry-cypress
  • Documentation
  • Guide
    • Get Started
    • Dashboard and API
    • Cloud Setup
  • Cloud
    • AWS
      • Basic AWS Setup
      • Advanced AWS Setup
      • AWS Networking
      • AWS S3 Manual Setup
    • Google Cloud
      • Google Cloud & MinIO - Deprecated
    • Microsoft Azure
    • Heroku
    • Kubernetes
    • Docker Images
  • Integrating Cypress
    • Integration options
    • cy2 - Deprecated
    • Agent Configuration - Deprecated
    • CLI One Liners - Deprecated
  • Configuration
    • Basic Setup
    • Full Setup
    • Director Service
      • AWS Role Assumption via Service Account
      • AWS S3 Configuration
      • Minio Configuration
      • Azure Blob Storage Configuration
    • API Service
    • Web Dashboard
      • Configuration
    • MongoDB Configuration
    • Troubleshooting
  • Integrations
    • Events
    • Webhooks
    • Slack Integration
    • GitHub Integration
    • BitBucket Integration
    • MS Teams Integration
  • Concepts
    • Parallelization Explained
    • Flaky Tests
    • Test Details
    • Test Status
  • CI
    • GitHub Actions
    • Travis
    • Jenkins
    • AWS Codebuild
  • Development
    • Changelog
    • Development Guide
  • Community Content
  • ❤️ Contributions
  • Support
  • Legal
  • FAQ
Powered by GitBook
On this page
  • MongoDB Setup
  • Storage Setup
  • Deploying sorry-cypress Kit
  • Configuring sorry-cypress Services
Edit on GitHub
  1. Cloud

Google Cloud

Sorry-cypress installation instructions for Google Cloud Run

PreviousAWS S3 Manual SetupNextGoogle Cloud & MinIO - Deprecated

Last updated 1 year ago

The suggested setup uses the following stack:

  • services to run sorry-cypress Director, API and Dashboard

  • with signed Read and Write URLs

  • MongoDB setup of your choice

Please make sure that you have

  • recent version of installed

  • Google Cloud project is configured and you have

  • recent version of Docker installed

MongoDB Setup

Please use MongoDB provider of your choice. is a simple and popular managed solution that also has a free tier.

Once you've created MongoDB cluster and a database, please obtain credentials and database name, you will need it in subsequent steps.

Storage Setup

You can use AWS S3 Storage instead, please refer to

Create Bucket

  1. Navigate to the

  2. Select a project or create a new project. Note the project ID.

  3. Select Create and follow the steps to create the bucket. Note the bucket name.

Authentication

Sorry-cypress Director authenticates on Google Cloud Storage using the Service Account assigned on the cloud run revision (usually Compute Engine default service account)

Make sure that service account has the Storage Object Creator Role, or assign the role / create a new service account with the role instead.

Access Control

By default the google-cloud-storage driver uses Signed URLs for both Read & Write URLs. This means the bucket access can be set to Uniform - Not Public

  • Allow public read access to the bucket

Deploying sorry-cypress Kit

Let's create 3 Cloud Run Services and deploy sorry-cypress components. We are going to run the following sequence of commands for each service:

  1. Pull latest docker image from Dockerhub

  2. Tag and push image to GCR associated with your project

  3. Deploy Google Cloud Run service using the newly generated image

Running a simple script hosted on GitHub would deploy the services.

  • -p is the current Google Cloud project

  • -n is the name prefix for generated Google Cloud Run services

curl -sL https://git.io/Jt4cB  \
|  source /dev/stdin -p <project> -n <services-prefix>

## Example output:
# 🏁  Finished deployment to Google Cloud Run
#
# test001-director: https://test001-dashboard-dwpifb4gla-uc.a.run.app
# test001-api: https://test001-dashboard-dwpifb4gla-uc.a.run.app
# test001-dashboard: https://test001-dashboard-dwpifb4gla-uc.a.run.app

Note the URLs of the generated services, we'll use those in the next step to configure the services so they'll be able to communicate one with another.

Configuring sorry-cypress Services

Run the commands below, please be careful while substituting template strings with values obtained at previous steps

# director configuration
gcloud run services update <services_prefix>-director \
--platform managed \
--set-env-vars DASHBOARD_URL="<dashboard_service_url>" \
--set-env-vars EXECUTION_DRIVER="../execution/mongo/driver" \
--set-env-vars MONGODB_URI="<mongodb_uri>" \
--set-env-vars MONGODB_DATABASE="<mongodb_dbname>" \
--set-env-vars SCREENSHOTS_DRIVER="../screenshots/google-cloud-storage.driver" \
--set-env-vars GCS_BUCKET="<bucket_name>" \
--set-env-vars GCS_PROJECT_ID="<project_id>" \
--set-env-vars GCS_IMAGE_KEY_PREFIX="screenshot/" \ # optional, default blank
--set-env-vars GCS_VIDEO_KEY_PREFIX="video/" \      # optional, default blank
--set-env-vars GCS_IS_BUCKET_PUBLIC_READ="false"    # optional, use 'true' only if the bucket has public read access

# api configuration
gcloud run services update <services_prefix>-api \
  --platform managed \
--set-env-vars MONGODB_URI="<mongodb_uri>" \
--set-env-vars MONGODB_DATABASE="<mongodb_dbname>" \
--set-env-vars APOLLO_PLAYGROUND="<apollo_playground>"

# dashboard configuration
gcloud run services update <services_prefix>-dashboard \
  --platform managed \
  --set-env-vars GRAPHQL_SCHEMA_URL="<api_service_url>"

🎉 Congratulations!

You've finished setting up sorry-cypress on Google Cloud - now you can open the Dashboard URL to see the dashboard.

Consider setting up a to keep only the most recent objects and keep costs down. Eg: Delete object, 7+ days since object was created

However, Google Cloud Storage Signed URLs have a . If you need to view the recording of your runs from sorry-cypress Dashboard for more than 7 days consider one of the following:

Use MinIO Gateway to access Google Cloud Storage instead.

Don't forget to to use Director service before running test.

Google Cloud Run
Google Cloud Storage
gcloud
sufficient permissions
MongoDB Atlas
AWS S3 setup instructions
API Console Storage page
Lifecycle Rule
max expiration time of 7 days
Instructions
reconfigure cypress agents