In this article, you will learn how to configure Google Cloud Storage (GCS) if you are running Hyperscience on Google Cloud Platform (GCP).
GCS Setup
The steps required to set up Google Cloud Storage depend on which version of Hyperscience you are using.
v40.1 and later
Create a bucket in GCS, or designate a prefix in an existing bucket.
On the Roles page of the Google Cloud console, create an IAM role with the following permissions:
storage.multipartUploads.abort storage.multipartUploads.create storage.multipartUploads.list storage.objects.create storage.objects.delete storage.objects.get storage.objects.list
On the Service Accounts page of the Google Cloud console, create a service account to be used by the Hyperscience application.
Assign the role you created in step 2 to the service account with the following IAM conditions:
Condition type — Name
Operator — Starts with
Value depends on whether you want to put files under a prefix or at the root of the bucket:
If files will be stored at bucket’s root:
Value = projects/_/buckets//objects/
If files will be stored under a prefix:
Value = projects/_/buckets//objects//
Generate and download the service account key in JSON format. Add the Base64 representation of the contents to the in the “.env” file by adding the following variable and value:
FILE_STORE_GOOGLE_CLOUD_KEY=<base_64_sa_json_file>
Add the following variables to the “.env” file:
FORMS_STORAGE_MODE=GCS FILE_STORE_GCS_BUCKET=<bucket_name> IMAGE_STORAGE_GCS_KEY_PREFIX=</parent_prefix_name/prefix_name/>
v40.0 and earlier
Follow the steps below to set up your Google Cloud Storage.
Create a bucket in GCS, or designate a prefix in an existing bucket.
On the Roles page of the Google Cloud console, create an IAM role with the following permissions:
storage.multipartUploads.abort storage.multipartUploads.create storage.multipartUploads.list storage.objects.create storage.objects.delete storage.objects.get storage.objects.list
On the Service Accounts page of the Google Cloud console, create a service account to be used by the Hyperscience application.
Assign the role you created in step 2 to the service account with the following IAM conditions:
Condition type — Name
Operator — Starts with
Value depends on whether you want to put files under a prefix or at the root of the bucket:
If files will be stored at bucket’s root:
Value = projects/_/buckets//objects/
If files will be stored under a prefix:
Value = projects/_/buckets//objects//
Create an HMAC key for the service account.
Learn more in Google’s Manage HMAC keys for service accounts.
Enter the created HMAC key’s Access Key and Secret in the “.env” file as values for FILE_STORE_S3_ACCESS_ID and FILE_STORE_S3_ACCESS_KEY, respectively.
Note that the Access Key is not the value for FILE_STORE_S3_ACCESS_KEY.
Add the following variables to the “.env” file:
FORMS_STORAGE_MODE=S3 FILE_STORE_S3_BUCKET=<bucket_name> FILE_STORE_S3_ENDPOINT_URL=https://storage.googleapis.com
If storing files under a prefix, add the following variable to the “.env” file:
FILE_STORE_S3_KEY_PREFIX=</parent_folder_name/folder_name/>