Requirements
- The MT Photo Analysis Cloud Function is deployed in a Google Cloud project
-
Create a service account with the required role
gcloud iam service-accounts create mt-website --display-name "mt-website" id="mt-website@${GCP_PROJECT}.iam.gserviceaccount.com" gcloud iam service-accounts add-iam-policy-binding "${id}" \ --member="serviceAccount:${id}" \ --role="roles/pubsub.publisher"
-
Create a key for that service account
gcloud iam service-accounts keys create keyfile.json --iam-account="${id}"
-
Set the content of the
keyfile.json
as constantGCP_APPLICATION_KEY
in thewp-config.php
filedefine('GCP_APPLICATION_KEY', '{ "type": "service_account", [...] }');
-
Set the JWT used by the cloud function in the
wp-config.php
filedefine('GCP_JWT', 'JWT-HERE');
Requirements
- PHP and Composer (dependency manager for PHP) are installed
Steps
- Install the requirements:
composer install
rsync -r --relative *.php src vendor/autoload.php vendor/composer <host>:<wordpress-dir>/wp-content/plugins/mt-wp-photo-analysis/