Accessing data in GCE persistent disk from .net App deployed in Cloud Run

27 Views Asked by At

We are migrating .net app from on perm to GCP. I need suggestion to solve one of the use case problem.

Problem Statement

The application is a .NET API which is containerized and hosted in Cloud Run.

We have a Microstrategy Commmand Manager Tool that will be hosted in a GCE windows VM.

The application would create a script file which should be placed in a folder of the disk which the command manager tool could access internally in the GCE instance (A specific folder in the persistent disk) and would pick it up to run. The command manager would place the log files in a different folder which should be accessed by the .NET App hosted in Cloud run

PS: the .NET app runs on the "mcr.microsoft.com/dotnet/aspnet:3.1" base image

What would be the right approach to tackle this scenario? Please suggest.

Is it possible to sync specific folders of persistent disk with a GCS bucket and have the app connect to the GCS bucket? Or is there a way to directly connect to the persistent disk and access the file.

Existing setup on-premise

Currently in the on-premise setup, the application is hosted on the same Windows Server machine where the command manager is installed. So the script file will be placed locally in a folder and the command manager could access it.

Please suggest the right approach for this scenario.

1

There are 1 best solutions below

0
guillaume blaquiere On

You can't share a persistent disk with Cloud Run. It's the design cloud run, it's stateless and persistent disk can't be shared.

However, you have 3 solutions:

  • Expose an API on your GCE VM to allow Cloud Run service to read the script file
  • You can use a Cloud Run feature that allows you to mount
    • Cloud Storage bucket as a volume. You can use GCS fuse to mount a bucket in your linux file system. Your GCE VM could put the script file in Cloud Storage and the Cloud Run service read it as a local file. Be careful, GCS Fuse is a API call wrapper, and the feature and latency are the same as GCS, it's not a file system
    • NFS mount. You can use Filestore to mount a filesystem in your GCE VM and on Cloud Run. This time, it's a real file system, with high performances. Be Careful, the minimum Filestore instance is 1Tb, $400/month