Skip to content

Latest commit

 

History

History
79 lines (58 loc) · 3.17 KB

README.MD

File metadata and controls

79 lines (58 loc) · 3.17 KB

Magento logo       Google Cloud logo

Google Cloud Functions for the Magento 2 Serverless Framework

This Magento module will extend the Magento 2 serverless framework module allowing us to use Google Cloud Functions.


   


Installation

Requirements


Installing the module and enabling it

To install this module we must run the composer require command requesting its installation:

composer require imdigital/magento-serverless-gcp

Then, enable it by modifying the app/etc/config.php or running the CLI command:

php bin/magento module:enable ImDigital_ServerlessGcp


Serverless function setup

When adding a new serverless function into the serverless_functions database table, we must use gcp as the cloud provider code on the cloud_provider field.

The cloud config field expects a (encrypted) JSON on this format:

{
    "region_id": "us-central1",
    "serviceaccount_key": {
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "client_email": "my-service-account-email",
        "client_id": "my-client-id",
        "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/my-cert-url",
        "private_key": "my-private-key",
        "private_key_id": "my-private-key-id",
        "project_id": "my-gcp-project-id",
        "token_uri": "https://oauth2.googleapis.com/token",
        "type": "service_account"
    }
}

The region_id is the region where the cloud function is hosted. The serviceaccount_key field is a service account that we must create, and then generate a JSON service account key with access to execute the functions.

These are the permissions you must add to your service account in order to be able to execute cloud functions:


Service Account permissions
Service account permissions