1.0.1 • Published 5 years ago

mc-change-history-search-gcf v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Change History Service (Buckets integration)

Working with GCP (GCF, BigQuery, CloudStorage)

Description

A micro service used to query data from the DB that contains the registers for project change history.

This package is intented to be deployed using a Google Cloud Function.

The idea is to have a Google Cloud Function that the MC Extension will use to fetch the data from BigQuery.

Google Function

Upload the code and set the following environment variables:

  • GC_PROJECT_ID: Google cloud project ID
  • GC_LOCATION: Location of the Big Query dataset and table
  • GCLOUD_STORAGE_BUCKET: Name of the bucket created for the project

Take into account that for development purposes the response of the Google Function should have this header in order to attack the service from localhost:

headers: {
  'Access-Control-Allow-Origin': '*',
},

For production use, it has to have the correct reestriction configured so only the needed urls can retrieve the information.

Deploy

src folder contains all the require files for deploying the Google Cloud Function.

We recommend the usage of the following command in package.json:

"deploy": "gcloud functions deploy <google_function_name> --region=<region> --source=src --runtime=nodejs8 --trigger-http --entry-point=handler --set-env-vars=GC_PROJECT_ID=<google_project_id>,GC_LOCATION=<big_query_location>"