---
title: "Google Cloud Storage support in File Repository"
canonical: "https://onesaitplatform.refined.site/space/DOCT/3760357377/Google%20Cloud%20Storage%20support%20in%20File%20Repository"
format: markdown
---
# Target

The File Repository is a platform component that allows you to upload and share files from the platform, either from the Control Panel or from a REST API.

Until now, this component was able to work with GridFS when you had MongoDB in the installation, or with MinIO for installations that used this distributed file system.

The point is supporting Google Cloud Storage as another of the mechanisms on which to store the files managed by the File Repository. 

In this way, when a project is deployed over GCP, it will be able to use this persistence. This can be easily configured in the platform installation.

On the other hand, it will be used to unify the management UIs.

# Before you start

If you have a Platform installation on GCP and you want to use Google Cloud Storage as File Repository, you have to request the activation of this functionality. To do this you will need to follow these steps:

- Create a request in the [support mailbox of the infrastructure team of the requesting product unit](https://servicedesk-onesait.atlassian.net/servicedesk/customer/portal/2) requesting:
  - The creation of a bucket in the Google Cloud Storage of the project where the Platform is deployed.
  - A JSON file with the necessary keys to communicate the Platform with the GCS bucket. This file will be configured as a secret in the Kubernetes cluster where the Platform is deployed.
- Once the bucket has been created by the support team, they will provide you with the name of the bucket and you will have to enter the Centralized Configuration of the Platform through the menu option **Dev tools > Centralized Configuration** with the administrator role, and edit the Platform configuration to modify the following properties:

```yaml
onesaitplatform:
   env:
      files:
         gcp-project-id: <gcp-project-id>
         gcp-bucket-onesaitplatform-development_onesaitplatform: <gcp-bucket-id>
```

Where:

- **gpc-project-id **corresponds to the GCP project identifier in which the Platform has been deployed.
- **gcp-bucket-onesaitplatform-development_onesaitplatform** is the bucket identifier provided by the support team for the default vertical/tenant.

## Multitenant configuration

If the multitenant mode is enabled and there are several verticals/tenants, then you must perform the following additional tasks:

- Create a request in the [support mailbox of the infrastructure team of the requesting product unit](https://servicedesk-onesait.atlassian.net/servicedesk/customer/portal/2):
  - Create a bucket in the Google Cloud Storage of the project where the Platform is deployed, for each vertical-tenant.
- Add the new buckets with the following nomenclature to the centralized configuration:

`gcp-bucket-<vertical_name>-<tenant_name>`

# Implementation

Once the Google Cloud Storage is configured, you can access the new functionality. To do this, access the menu option **Dev Tools > My Files **and a list will appear with the available options to use in the File Repository:

![image](media://fe44ee2b-d996-4a9a-aed4-6132f2d291cb)

Select the option **Google Cloud Storage** and you will access the list of files uploaded to GCP. To add a file, select the **+** option and fill in the form attaching the file you want to upload:

![image](media://5bc6208a-836d-426e-8f20-2bc33e2d1370)

The **Destination file** **path **field is optional and allows the user to manage his files within a folder structure.

![image](media://c8dc68d9-dbd2-4f19-a516-12aaf72665ed)

Once the file is uploaded, you can operate with it as with the files uploaded to MinIO or GridFS.

On the other hand, a REST API is available to the user to use this functionality:

![image](media://072cd872-a27d-4878-acdc-fd64fae26c90)

This is the same API as if you use GridFS, but a new optional **repository **field has been added to the operations:

![image](media://fe953370-ef18-4a21-a8ec-076aca69ea80)

where you will have to choose the **GCP **option if you want to use Google Cloud Storage.

> ℹ️ If this field is not specified, by default **MONGO_GRIDFS **will be taken.