EngineNew Features

Google Cloud Storage support in File Repository

In version 4.3.0-Quest of the Onesait Platform, the possibility of using Google Cloud Storage as a File Repository in installations deployed on Google Cloud Storage (GCP) has been added.

The File Repository is a component of the Platform that allows uploading and sharing files from the platform, both from the Control Panel and from a REST API.

Until now, this component was able to work with GridFS when we had MongoDB installed, or with MinIO for installations using this distributed file system.

Besides, the management UIs of this component have been unified.

Before starting

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

  • We will create a request in the support mailbox of the infrastructure team of the product unit, where we will request:
    • To create a bucket in the project’s Google Cloud Storage where the Platform is deployed.
    • A JSON file with the keys necessary 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 support team has created the bucket, they will provide us with its name and we will have to enter the Platform’s Centralized Configuration through the Dev tools > Centralized Configuration menu option with the role «administrator» and edit the Platform’s configuration by modifying the following properties:
onesaitplatform:
env:
   files:
      gcp-project-id: <gcp-project-id>
      gcp-bucket-id: <gcp-bucket-id>

Where:

  • gpc-project-id corresponds to the identifier of the GCP project in which the Platform has been deployed.
  • gcp-bucket-id is the bucket identifier that the support team provided you with.

Implementation

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

We select the  «Google Cloud Storage» option and access the list of files uploaded to GCP. To add a file, we select the + option and fill out the form attaching the file we want to upload:

The «Destination file path» field is optional and allows the user to manage their files within a folder structure.

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

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

This is the same API as if we were using GridFS, but we have added a new optional «repository» field to the operations:

Here, we will have to choose the GCP option if we want to use Google Cloud Storage. If this field is not specified, MONGO_GRIDFS will be chosen by default.

✍🏻 Author(s)

Leave a Reply

Your email address will not be published. Required fields are marked *