# Setup GCS as file repository

Instructions how to setup a Google Cloud Storage bucket as file repository

# Pre-requirements

You need to have an Google Cloud Platform account. If not, you can register here cloud.google.com As a new customer Google will provide you with 300 USD for the first 12 months and alot of other benefits forever free, e.g. 5 GB of Google Cloud Storage. More details can be found here: cloud.google.com/free/

# Setup Guide

This guide will walk you through the creation of a bucket, the configuration of the bucket and the creation of a service account, before it helps you to configure it in psono.

# Create bucket

  1. Login to cloud.google.com

  2. Create a project at the top

  3. Go to Storage -> Browser

Step 3 Go to storage

  1. Click "Create bucket"

Step 4 Create bucket

  1. Click "Setup bucket"

Specify a name, a region and click "Create".

TIP

Remember the name that you specified as you will need it later.

Step 5 Setup bucket

TIP

Remember the bucket name. You will need it later.

# Configure CORS

  1. Click at the top to open a "Cloud Shell"

Step 6 Open Cloud Shell

  1. Copy & paste the following two commands
cat <<EOT >> gcs_cors.json
[
    {
      "origin": ["*"],
      "responseHeader": ["content-type", "cache-control", "if-modified-since", "pragma"],
      "method": ["*"],
      "maxAgeSeconds": 5
    }
]
EOT

gsutil cors set gcs_cors.json gs://psono-file-upload

TIP

Replace 'psono-file-upload' with your bucket name.

Step 6 Open Cloud Shell

# Create service account

  1. Go to IAM & admin > Service accounts

Step 8 Go to IAM & admin service accounts

  1. Click "Create service account"

Step 9 click "Create service account"

  1. Specify the service account name

Step 10 specify the service account name

  1. Configure the role and grant "Storage Object Admin"

Step 11 Configure the role as storage object admin

  1. Click "Create Key" and select JSON

Step 12 Create the key as JSON

# Configure the file repository

  1. Login to Psono

Step 13 Login to Psono

  1. Go to "Other"

Step 14 Go to other

  1. Go to "File Repositories" and click "Create new file repository"

Step 15 Go to "File Repositories" and click "Create new file repository"

  1. Configure the file repository

Use any descriptive title, select GCP Cloud Storage as type, add your buckets name and copy paste the content of the JSON Key.

Step 16 Configure the file repository

You can now upload files from the datastore to this file repository.